ホーム › Devices.Display › FONTOBJ_cGetGlyphs
FONTOBJ_cGetGlyphs
関数フォントオブジェクトから指定グリフのビットマップ情報を取得する。
シグネチャ
// GDI32.dll
#include <windows.h>
DWORD FONTOBJ_cGetGlyphs(
FONTOBJ* pfo,
DWORD iMode,
DWORD cGlyph,
DWORD* phg,
void** ppvGlyph
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| pfo | FONTOBJ* | inout | 対象のFONTOBJ構造体へのポインター。 |
| iMode | DWORD | in | グリフデータの形式(FO_GLYPHBITS/FO_PATHOBJ等)を示すモード値。 |
| cGlyph | DWORD | in | 取得するグリフの数。 |
| phg | DWORD* | inout | 取得対象グリフのハンドル(HGLYPH)配列へのポインター。 |
| ppvGlyph | void** | inout | グリフデータへのポインターを受け取るポインター。 |
戻り値の型: DWORD
各言語での呼び出し定義
// GDI32.dll
#include <windows.h>
DWORD FONTOBJ_cGetGlyphs(
FONTOBJ* pfo,
DWORD iMode,
DWORD cGlyph,
DWORD* phg,
void** ppvGlyph
);[DllImport("GDI32.dll", ExactSpelling = true)]
static extern uint FONTOBJ_cGetGlyphs(
IntPtr pfo, // FONTOBJ* in/out
uint iMode, // DWORD
uint cGlyph, // DWORD
ref uint phg, // DWORD* in/out
IntPtr ppvGlyph // void** in/out
);<DllImport("GDI32.dll", ExactSpelling:=True)>
Public Shared Function FONTOBJ_cGetGlyphs(
pfo As IntPtr, ' FONTOBJ* in/out
iMode As UInteger, ' DWORD
cGlyph As UInteger, ' DWORD
ByRef phg As UInteger, ' DWORD* in/out
ppvGlyph As IntPtr ' void** in/out
) As UInteger
End Function' pfo : FONTOBJ* in/out
' iMode : DWORD
' cGlyph : DWORD
' phg : DWORD* in/out
' ppvGlyph : void** in/out
Declare PtrSafe Function FONTOBJ_cGetGlyphs Lib "gdi32" ( _
ByVal pfo As LongPtr, _
ByVal iMode As Long, _
ByVal cGlyph As Long, _
ByRef phg As Long, _
ByVal ppvGlyph As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
FONTOBJ_cGetGlyphs = ctypes.windll.gdi32.FONTOBJ_cGetGlyphs
FONTOBJ_cGetGlyphs.restype = wintypes.DWORD
FONTOBJ_cGetGlyphs.argtypes = [
ctypes.c_void_p, # pfo : FONTOBJ* in/out
wintypes.DWORD, # iMode : DWORD
wintypes.DWORD, # cGlyph : DWORD
ctypes.POINTER(wintypes.DWORD), # phg : DWORD* in/out
ctypes.c_void_p, # ppvGlyph : void** in/out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('GDI32.dll')
FONTOBJ_cGetGlyphs = Fiddle::Function.new(
lib['FONTOBJ_cGetGlyphs'],
[
Fiddle::TYPE_VOIDP, # pfo : FONTOBJ* in/out
-Fiddle::TYPE_INT, # iMode : DWORD
-Fiddle::TYPE_INT, # cGlyph : DWORD
Fiddle::TYPE_VOIDP, # phg : DWORD* in/out
Fiddle::TYPE_VOIDP, # ppvGlyph : void** in/out
],
-Fiddle::TYPE_INT)#[link(name = "gdi32")]
extern "system" {
fn FONTOBJ_cGetGlyphs(
pfo: *mut FONTOBJ, // FONTOBJ* in/out
iMode: u32, // DWORD
cGlyph: u32, // DWORD
phg: *mut u32, // DWORD* in/out
ppvGlyph: *mut *mut () // void** in/out
) -> u32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("GDI32.dll")]
public static extern uint FONTOBJ_cGetGlyphs(IntPtr pfo, uint iMode, uint cGlyph, ref uint phg, IntPtr ppvGlyph);
"@
$api = Add-Type -MemberDefinition $sig -Name 'GDI32_FONTOBJ_cGetGlyphs' -Namespace Win32 -PassThru
# $api::FONTOBJ_cGetGlyphs(pfo, iMode, cGlyph, phg, ppvGlyph)#uselib "GDI32.dll"
#func global FONTOBJ_cGetGlyphs "FONTOBJ_cGetGlyphs" sptr, sptr, sptr, sptr, sptr
; FONTOBJ_cGetGlyphs varptr(pfo), iMode, cGlyph, varptr(phg), ppvGlyph ; 戻り値は stat
; pfo : FONTOBJ* in/out -> "sptr"
; iMode : DWORD -> "sptr"
; cGlyph : DWORD -> "sptr"
; phg : DWORD* in/out -> "sptr"
; ppvGlyph : void** in/out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "GDI32.dll" #cfunc global FONTOBJ_cGetGlyphs "FONTOBJ_cGetGlyphs" var, int, int, var, sptr ; res = FONTOBJ_cGetGlyphs(pfo, iMode, cGlyph, phg, ppvGlyph) ; pfo : FONTOBJ* in/out -> "var" ; iMode : DWORD -> "int" ; cGlyph : DWORD -> "int" ; phg : DWORD* in/out -> "var" ; ppvGlyph : void** in/out -> "sptr" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "GDI32.dll" #cfunc global FONTOBJ_cGetGlyphs "FONTOBJ_cGetGlyphs" sptr, int, int, sptr, sptr ; res = FONTOBJ_cGetGlyphs(varptr(pfo), iMode, cGlyph, varptr(phg), ppvGlyph) ; pfo : FONTOBJ* in/out -> "sptr" ; iMode : DWORD -> "int" ; cGlyph : DWORD -> "int" ; phg : DWORD* in/out -> "sptr" ; ppvGlyph : void** in/out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; DWORD FONTOBJ_cGetGlyphs(FONTOBJ* pfo, DWORD iMode, DWORD cGlyph, DWORD* phg, void** ppvGlyph) #uselib "GDI32.dll" #cfunc global FONTOBJ_cGetGlyphs "FONTOBJ_cGetGlyphs" var, int, int, var, intptr ; res = FONTOBJ_cGetGlyphs(pfo, iMode, cGlyph, phg, ppvGlyph) ; pfo : FONTOBJ* in/out -> "var" ; iMode : DWORD -> "int" ; cGlyph : DWORD -> "int" ; phg : DWORD* in/out -> "var" ; ppvGlyph : void** in/out -> "intptr" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; DWORD FONTOBJ_cGetGlyphs(FONTOBJ* pfo, DWORD iMode, DWORD cGlyph, DWORD* phg, void** ppvGlyph) #uselib "GDI32.dll" #cfunc global FONTOBJ_cGetGlyphs "FONTOBJ_cGetGlyphs" intptr, int, int, intptr, intptr ; res = FONTOBJ_cGetGlyphs(varptr(pfo), iMode, cGlyph, varptr(phg), ppvGlyph) ; pfo : FONTOBJ* in/out -> "intptr" ; iMode : DWORD -> "int" ; cGlyph : DWORD -> "int" ; phg : DWORD* in/out -> "intptr" ; ppvGlyph : void** in/out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
gdi32 = windows.NewLazySystemDLL("GDI32.dll")
procFONTOBJ_cGetGlyphs = gdi32.NewProc("FONTOBJ_cGetGlyphs")
)
// pfo (FONTOBJ* in/out), iMode (DWORD), cGlyph (DWORD), phg (DWORD* in/out), ppvGlyph (void** in/out)
r1, _, err := procFONTOBJ_cGetGlyphs.Call(
uintptr(pfo),
uintptr(iMode),
uintptr(cGlyph),
uintptr(phg),
uintptr(ppvGlyph),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // DWORDfunction FONTOBJ_cGetGlyphs(
pfo: Pointer; // FONTOBJ* in/out
iMode: DWORD; // DWORD
cGlyph: DWORD; // DWORD
phg: Pointer; // DWORD* in/out
ppvGlyph: Pointer // void** in/out
): DWORD; stdcall;
external 'GDI32.dll' name 'FONTOBJ_cGetGlyphs';result := DllCall("GDI32\FONTOBJ_cGetGlyphs"
, "Ptr", pfo ; FONTOBJ* in/out
, "UInt", iMode ; DWORD
, "UInt", cGlyph ; DWORD
, "Ptr", phg ; DWORD* in/out
, "Ptr", ppvGlyph ; void** in/out
, "UInt") ; return: DWORD●FONTOBJ_cGetGlyphs(pfo, iMode, cGlyph, phg, ppvGlyph) = DLL("GDI32.dll", "dword FONTOBJ_cGetGlyphs(void*, dword, dword, void*, void*)")
# 呼び出し: FONTOBJ_cGetGlyphs(pfo, iMode, cGlyph, phg, ppvGlyph)
# pfo : FONTOBJ* in/out -> "void*"
# iMode : DWORD -> "dword"
# cGlyph : DWORD -> "dword"
# phg : DWORD* in/out -> "void*"
# ppvGlyph : void** in/out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。