ホーム › Graphics.Gdi › GetKerningPairsA
GetKerningPairsA
関数フォントのカーニングペア情報を取得する(ANSI版)。
シグネチャ
// GDI32.dll (ANSI / -A)
#include <windows.h>
DWORD GetKerningPairsA(
HDC hdc,
DWORD nPairs,
KERNINGPAIR* lpKernPair // optional
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| hdc | HDC | in |
| nPairs | DWORD | in |
| lpKernPair | KERNINGPAIR* | outoptional |
戻り値の型: DWORD
各言語での呼び出し定義
// GDI32.dll (ANSI / -A)
#include <windows.h>
DWORD GetKerningPairsA(
HDC hdc,
DWORD nPairs,
KERNINGPAIR* lpKernPair // optional
);[DllImport("GDI32.dll", CharSet = CharSet.Ansi, ExactSpelling = true)]
static extern uint GetKerningPairsA(
IntPtr hdc, // HDC
uint nPairs, // DWORD
IntPtr lpKernPair // KERNINGPAIR* optional, out
);<DllImport("GDI32.dll", CharSet:=CharSet.Ansi, ExactSpelling:=True)>
Public Shared Function GetKerningPairsA(
hdc As IntPtr, ' HDC
nPairs As UInteger, ' DWORD
lpKernPair As IntPtr ' KERNINGPAIR* optional, out
) As UInteger
End Function' hdc : HDC
' nPairs : DWORD
' lpKernPair : KERNINGPAIR* optional, out
Declare PtrSafe Function GetKerningPairsA Lib "gdi32" ( _
ByVal hdc As LongPtr, _
ByVal nPairs As Long, _
ByVal lpKernPair As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
GetKerningPairsA = ctypes.windll.gdi32.GetKerningPairsA
GetKerningPairsA.restype = wintypes.DWORD
GetKerningPairsA.argtypes = [
wintypes.HANDLE, # hdc : HDC
wintypes.DWORD, # nPairs : DWORD
ctypes.c_void_p, # lpKernPair : KERNINGPAIR* optional, out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('GDI32.dll')
GetKerningPairsA = Fiddle::Function.new(
lib['GetKerningPairsA'],
[
Fiddle::TYPE_VOIDP, # hdc : HDC
-Fiddle::TYPE_INT, # nPairs : DWORD
Fiddle::TYPE_VOIDP, # lpKernPair : KERNINGPAIR* optional, out
],
-Fiddle::TYPE_INT)#[link(name = "gdi32")]
extern "system" {
fn GetKerningPairsA(
hdc: *mut core::ffi::c_void, // HDC
nPairs: u32, // DWORD
lpKernPair: *mut KERNINGPAIR // KERNINGPAIR* optional, out
) -> u32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("GDI32.dll", CharSet = CharSet.Ansi)]
public static extern uint GetKerningPairsA(IntPtr hdc, uint nPairs, IntPtr lpKernPair);
"@
$api = Add-Type -MemberDefinition $sig -Name 'GDI32_GetKerningPairsA' -Namespace Win32 -PassThru
# $api::GetKerningPairsA(hdc, nPairs, lpKernPair)#uselib "GDI32.dll"
#func global GetKerningPairsA "GetKerningPairsA" sptr, sptr, sptr
; GetKerningPairsA hdc, nPairs, varptr(lpKernPair) ; 戻り値は stat
; hdc : HDC -> "sptr"
; nPairs : DWORD -> "sptr"
; lpKernPair : KERNINGPAIR* optional, out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "GDI32.dll" #cfunc global GetKerningPairsA "GetKerningPairsA" sptr, int, var ; res = GetKerningPairsA(hdc, nPairs, lpKernPair) ; hdc : HDC -> "sptr" ; nPairs : DWORD -> "int" ; lpKernPair : KERNINGPAIR* optional, out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "GDI32.dll" #cfunc global GetKerningPairsA "GetKerningPairsA" sptr, int, sptr ; res = GetKerningPairsA(hdc, nPairs, varptr(lpKernPair)) ; hdc : HDC -> "sptr" ; nPairs : DWORD -> "int" ; lpKernPair : KERNINGPAIR* optional, out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; DWORD GetKerningPairsA(HDC hdc, DWORD nPairs, KERNINGPAIR* lpKernPair) #uselib "GDI32.dll" #cfunc global GetKerningPairsA "GetKerningPairsA" intptr, int, var ; res = GetKerningPairsA(hdc, nPairs, lpKernPair) ; hdc : HDC -> "intptr" ; nPairs : DWORD -> "int" ; lpKernPair : KERNINGPAIR* optional, out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; DWORD GetKerningPairsA(HDC hdc, DWORD nPairs, KERNINGPAIR* lpKernPair) #uselib "GDI32.dll" #cfunc global GetKerningPairsA "GetKerningPairsA" intptr, int, intptr ; res = GetKerningPairsA(hdc, nPairs, varptr(lpKernPair)) ; hdc : HDC -> "intptr" ; nPairs : DWORD -> "int" ; lpKernPair : KERNINGPAIR* optional, out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
gdi32 = windows.NewLazySystemDLL("GDI32.dll")
procGetKerningPairsA = gdi32.NewProc("GetKerningPairsA")
)
// hdc (HDC), nPairs (DWORD), lpKernPair (KERNINGPAIR* optional, out)
r1, _, err := procGetKerningPairsA.Call(
uintptr(hdc),
uintptr(nPairs),
uintptr(lpKernPair),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // DWORDfunction GetKerningPairsA(
hdc: THandle; // HDC
nPairs: DWORD; // DWORD
lpKernPair: Pointer // KERNINGPAIR* optional, out
): DWORD; stdcall;
external 'GDI32.dll' name 'GetKerningPairsA';result := DllCall("GDI32\GetKerningPairsA"
, "Ptr", hdc ; HDC
, "UInt", nPairs ; DWORD
, "Ptr", lpKernPair ; KERNINGPAIR* optional, out
, "UInt") ; return: DWORD●GetKerningPairsA(hdc, nPairs, lpKernPair) = DLL("GDI32.dll", "dword GetKerningPairsA(void*, dword, void*)")
# 呼び出し: GetKerningPairsA(hdc, nPairs, lpKernPair)
# hdc : HDC -> "void*"
# nPairs : DWORD -> "dword"
# lpKernPair : KERNINGPAIR* optional, out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。