Win32 API 日本語リファレンス
ホームDevices.Display › FONTOBJ_cGetAllGlyphHandles

FONTOBJ_cGetAllGlyphHandles

関数
フォントオブジェクトの全グリフのハンドルを取得する。
DLLGDI32.dll呼出規約winapi対応OSWindows 2000 以降

シグネチャ

// GDI32.dll
#include <windows.h>

DWORD FONTOBJ_cGetAllGlyphHandles(
    FONTOBJ* pfo,
    DWORD* phg
);

パラメーター

名前方向説明
pfoFONTOBJ*inoutダウンロード対象となる FONTOBJ 構造体へのポインターです。
phgDWORD*inoutフォント内のすべてのグリフハンドルを格納できる十分な大きさのバッファーへのポインターです。このパラメーターには NULL を指定できます。

戻り値の型: DWORD

公式ドキュメント

FONTOBJ_cGetAllGlyphHandles 関数を使用すると、デバイスドライバーは GDI フォントのすべてのグリフハンドルを取得できます。

戻り値

戻り値は、フォントがサポートするグリフハンドルの数です。

解説(Remarks)

ドライバーは、フォント全体をダウンロードするためにこの関数を使用します。

ドライバーは、出力を格納できる十分な大きさのバッファーを用意する必要があります。GDI は、関連付けられたフォントに属するすべてのグリフハンドルをこのバッファーにコピーします。

フォント内のグリフ数は、FONTOBJ_vGetInfo を呼び出すか、phg パラメーターに NULL を設定して FONTOBJ_cGetAllGlyphHandles を呼び出すことで判別できます。

出典・ライセンス: 上記「公式ドキュメント」の内容は Microsoft の Win32 API ドキュメント(MicrosoftDocs/sdk-api)を日本語に翻訳・改変したものです。© Microsoft Corporation. CC BY 4.0 で提供。
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)

各言語での呼び出し定義

// GDI32.dll
#include <windows.h>

DWORD FONTOBJ_cGetAllGlyphHandles(
    FONTOBJ* pfo,
    DWORD* phg
);
[DllImport("GDI32.dll", ExactSpelling = true)]
static extern uint FONTOBJ_cGetAllGlyphHandles(
    IntPtr pfo,   // FONTOBJ* in/out
    ref uint phg   // DWORD* in/out
);
<DllImport("GDI32.dll", ExactSpelling:=True)>
Public Shared Function FONTOBJ_cGetAllGlyphHandles(
    pfo As IntPtr,   ' FONTOBJ* in/out
    ByRef phg As UInteger   ' DWORD* in/out
) As UInteger
End Function
' pfo : FONTOBJ* in/out
' phg : DWORD* in/out
Declare PtrSafe Function FONTOBJ_cGetAllGlyphHandles Lib "gdi32" ( _
    ByVal pfo As LongPtr, _
    ByRef phg As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

FONTOBJ_cGetAllGlyphHandles = ctypes.windll.gdi32.FONTOBJ_cGetAllGlyphHandles
FONTOBJ_cGetAllGlyphHandles.restype = wintypes.DWORD
FONTOBJ_cGetAllGlyphHandles.argtypes = [
    ctypes.c_void_p,  # pfo : FONTOBJ* in/out
    ctypes.POINTER(wintypes.DWORD),  # phg : DWORD* in/out
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('GDI32.dll')
FONTOBJ_cGetAllGlyphHandles = Fiddle::Function.new(
  lib['FONTOBJ_cGetAllGlyphHandles'],
  [
    Fiddle::TYPE_VOIDP,  # pfo : FONTOBJ* in/out
    Fiddle::TYPE_VOIDP,  # phg : DWORD* in/out
  ],
  -Fiddle::TYPE_INT)
#[link(name = "gdi32")]
extern "system" {
    fn FONTOBJ_cGetAllGlyphHandles(
        pfo: *mut FONTOBJ,  // FONTOBJ* in/out
        phg: *mut u32  // DWORD* in/out
    ) -> u32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("GDI32.dll")]
public static extern uint FONTOBJ_cGetAllGlyphHandles(IntPtr pfo, ref uint phg);
"@
$api = Add-Type -MemberDefinition $sig -Name 'GDI32_FONTOBJ_cGetAllGlyphHandles' -Namespace Win32 -PassThru
# $api::FONTOBJ_cGetAllGlyphHandles(pfo, phg)
#uselib "GDI32.dll"
#func global FONTOBJ_cGetAllGlyphHandles "FONTOBJ_cGetAllGlyphHandles" sptr, sptr
; FONTOBJ_cGetAllGlyphHandles varptr(pfo), varptr(phg)   ; 戻り値は stat
; pfo : FONTOBJ* in/out -> "sptr"
; phg : DWORD* in/out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "GDI32.dll"
#cfunc global FONTOBJ_cGetAllGlyphHandles "FONTOBJ_cGetAllGlyphHandles" var, var
; res = FONTOBJ_cGetAllGlyphHandles(pfo, phg)
; pfo : FONTOBJ* in/out -> "var"
; phg : DWORD* in/out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; DWORD FONTOBJ_cGetAllGlyphHandles(FONTOBJ* pfo, DWORD* phg)
#uselib "GDI32.dll"
#cfunc global FONTOBJ_cGetAllGlyphHandles "FONTOBJ_cGetAllGlyphHandles" var, var
; res = FONTOBJ_cGetAllGlyphHandles(pfo, phg)
; pfo : FONTOBJ* in/out -> "var"
; phg : DWORD* in/out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	gdi32 = windows.NewLazySystemDLL("GDI32.dll")
	procFONTOBJ_cGetAllGlyphHandles = gdi32.NewProc("FONTOBJ_cGetAllGlyphHandles")
)

// pfo (FONTOBJ* in/out), phg (DWORD* in/out)
r1, _, err := procFONTOBJ_cGetAllGlyphHandles.Call(
	uintptr(pfo),
	uintptr(phg),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // DWORD
function FONTOBJ_cGetAllGlyphHandles(
  pfo: Pointer;   // FONTOBJ* in/out
  phg: Pointer   // DWORD* in/out
): DWORD; stdcall;
  external 'GDI32.dll' name 'FONTOBJ_cGetAllGlyphHandles';
result := DllCall("GDI32\FONTOBJ_cGetAllGlyphHandles"
    , "Ptr", pfo   ; FONTOBJ* in/out
    , "Ptr", phg   ; DWORD* in/out
    , "UInt")   ; return: DWORD
●FONTOBJ_cGetAllGlyphHandles(pfo, phg) = DLL("GDI32.dll", "dword FONTOBJ_cGetAllGlyphHandles(void*, void*)")
# 呼び出し: FONTOBJ_cGetAllGlyphHandles(pfo, phg)
# pfo : FONTOBJ* in/out -> "void*"
# phg : DWORD* in/out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
const std = @import("std");

extern "gdi32" fn FONTOBJ_cGetAllGlyphHandles(
    pfo: [*c]FONTOBJ, // FONTOBJ* in/out
    phg: [*c]u32 // DWORD* in/out
) callconv(std.os.windows.WINAPI) u32;
proc FONTOBJ_cGetAllGlyphHandles(
    pfo: ptr FONTOBJ,  # FONTOBJ* in/out
    phg: ptr uint32  # DWORD* in/out
): uint32 {.importc: "FONTOBJ_cGetAllGlyphHandles", stdcall, dynlib: "GDI32.dll".}
pragma(lib, "gdi32");
extern(Windows)
uint FONTOBJ_cGetAllGlyphHandles(
    FONTOBJ* pfo,   // FONTOBJ* in/out
    uint* phg   // DWORD* in/out
);
ccall((:FONTOBJ_cGetAllGlyphHandles, "GDI32.dll"), stdcall, UInt32,
      (Ptr{FONTOBJ}, Ptr{UInt32}),
      pfo, phg)
# pfo : FONTOBJ* in/out -> Ptr{FONTOBJ}
# phg : DWORD* in/out -> Ptr{UInt32}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。
local ffi = require("ffi")
ffi.cdef[[
uint32_t FONTOBJ_cGetAllGlyphHandles(
    void* pfo,
    uint32_t* phg);
]]
local gdi32 = ffi.load("gdi32")
-- gdi32.FONTOBJ_cGetAllGlyphHandles(pfo, phg)
-- pfo : FONTOBJ* in/out
-- phg : DWORD* in/out
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
const koffi = require('koffi');
const lib = koffi.load('GDI32.dll');
const FONTOBJ_cGetAllGlyphHandles = lib.func('__stdcall', 'FONTOBJ_cGetAllGlyphHandles', 'uint32_t', ['void *', 'uint32_t *']);
// FONTOBJ_cGetAllGlyphHandles(pfo, phg)
// pfo : FONTOBJ* in/out -> 'void *'
// phg : DWORD* in/out -> 'uint32_t *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。
const lib = Deno.dlopen("GDI32.dll", {
  FONTOBJ_cGetAllGlyphHandles: { parameters: ["pointer", "pointer"], result: "u32" },
});
// lib.symbols.FONTOBJ_cGetAllGlyphHandles(pfo, phg)
// pfo : FONTOBJ* in/out -> "pointer"
// phg : DWORD* in/out -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。
<?php
$ffi = FFI::cdef(<<<C
uint32_t FONTOBJ_cGetAllGlyphHandles(
    void* pfo,
    uint32_t* phg);
C, "GDI32.dll");
// $ffi->FONTOBJ_cGetAllGlyphHandles(pfo, phg);
// pfo : FONTOBJ* in/out
// phg : DWORD* in/out
// 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
// WINAPI(stdcall): x64 では呼出規約が統一されるため問題なし。x86 では __stdcall 対応のラッパが必要な場合あり。
import com.sun.jna.*;
import com.sun.jna.ptr.*;
import com.sun.jna.win32.StdCallLibrary;
import com.sun.jna.win32.W32APIOptions;

public interface Gdi32 extends StdCallLibrary {
    Gdi32 INSTANCE = Native.load("gdi32", Gdi32.class);
    int FONTOBJ_cGetAllGlyphHandles(
        Pointer pfo,   // FONTOBJ* in/out
        IntByReference phg   // DWORD* in/out
    );
}
@[Link("gdi32")]
lib LibGDI32
  fun FONTOBJ_cGetAllGlyphHandles = FONTOBJ_cGetAllGlyphHandles(
    pfo : FONTOBJ*,   # FONTOBJ* in/out
    phg : UInt32*   # DWORD* in/out
  ) : UInt32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。
import 'dart:ffi';
import 'package:ffi/ffi.dart';

typedef FONTOBJ_cGetAllGlyphHandlesNative = Uint32 Function(Pointer<Void>, Pointer<Uint32>);
typedef FONTOBJ_cGetAllGlyphHandlesDart = int Function(Pointer<Void>, Pointer<Uint32>);
final FONTOBJ_cGetAllGlyphHandles = DynamicLibrary.open('GDI32.dll')
    .lookupFunction<FONTOBJ_cGetAllGlyphHandlesNative, FONTOBJ_cGetAllGlyphHandlesDart>('FONTOBJ_cGetAllGlyphHandles');
// pfo : FONTOBJ* in/out -> Pointer<Void>
// phg : DWORD* in/out -> Pointer<Uint32>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
function FONTOBJ_cGetAllGlyphHandles(
  pfo: Pointer;   // FONTOBJ* in/out
  phg: Pointer   // DWORD* in/out
): DWORD; stdcall;
  external 'GDI32.dll' name 'FONTOBJ_cGetAllGlyphHandles';
import Foreign
import Foreign.C.Types
import Foreign.C.String

foreign import stdcall safe "FONTOBJ_cGetAllGlyphHandles"
  c_FONTOBJ_cGetAllGlyphHandles :: Ptr () -> Ptr Word32 -> IO Word32
-- pfo : FONTOBJ* in/out -> Ptr ()
-- phg : DWORD* in/out -> Ptr Word32
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
open Ctypes
open Foreign

let fontobj_cgetallglyphhandles =
  foreign "FONTOBJ_cGetAllGlyphHandles"
    ((ptr void) @-> (ptr uint32_t) @-> returning uint32_t)
(* pfo : FONTOBJ* in/out -> (ptr void) *)
(* phg : DWORD* in/out -> (ptr uint32_t) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)
(cffi:define-foreign-library gdi32 (t "GDI32.dll"))
(cffi:use-foreign-library gdi32)

(cffi:defcfun ("FONTOBJ_cGetAllGlyphHandles" fontobj-c-get-all-glyph-handles :convention :stdcall) :uint32
  (pfo :pointer)   ; FONTOBJ* in/out
  (phg :pointer))   ; DWORD* in/out
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $FONTOBJ_cGetAllGlyphHandles = Win32::API::More->new('GDI32',
    'DWORD FONTOBJ_cGetAllGlyphHandles(LPVOID pfo, LPVOID phg)');
# my $ret = $FONTOBJ_cGetAllGlyphHandles->Call($pfo, $phg);
# pfo : FONTOBJ* in/out -> LPVOID
# phg : DWORD* in/out -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。

関連項目

公式の関連項目
使用する型