Win32 API 日本語リファレンス
ホームGraphics.GdiPlus › GdipGetFontCollectionFamilyList

GdipGetFontCollectionFamilyList

関数
フォントコレクション内のファミリー一覧を取得する。
DLLgdiplus.dll呼出規約winapi

シグネチャ

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

Status GdipGetFontCollectionFamilyList(
    GpFontCollection* fontCollection,
    INT numSought,
    GpFontFamily** gpfamilies,
    INT* numFound
);

パラメーター

名前方向
fontCollectionGpFontCollection*in
numSoughtINTin
gpfamiliesGpFontFamily**out
numFoundINT*out

戻り値の型: Status

各言語での呼び出し定義

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

Status GdipGetFontCollectionFamilyList(
    GpFontCollection* fontCollection,
    INT numSought,
    GpFontFamily** gpfamilies,
    INT* numFound
);
[DllImport("gdiplus.dll", ExactSpelling = true)]
static extern int GdipGetFontCollectionFamilyList(
    IntPtr fontCollection,   // GpFontCollection*
    int numSought,   // INT
    IntPtr gpfamilies,   // GpFontFamily** out
    out int numFound   // INT* out
);
<DllImport("gdiplus.dll", ExactSpelling:=True)>
Public Shared Function GdipGetFontCollectionFamilyList(
    fontCollection As IntPtr,   ' GpFontCollection*
    numSought As Integer,   ' INT
    gpfamilies As IntPtr,   ' GpFontFamily** out
    <Out> ByRef numFound As Integer   ' INT* out
) As Integer
End Function
' fontCollection : GpFontCollection*
' numSought : INT
' gpfamilies : GpFontFamily** out
' numFound : INT* out
Declare PtrSafe Function GdipGetFontCollectionFamilyList Lib "gdiplus" ( _
    ByVal fontCollection As LongPtr, _
    ByVal numSought As Long, _
    ByVal gpfamilies As LongPtr, _
    ByRef numFound As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

GdipGetFontCollectionFamilyList = ctypes.windll.gdiplus.GdipGetFontCollectionFamilyList
GdipGetFontCollectionFamilyList.restype = ctypes.c_int
GdipGetFontCollectionFamilyList.argtypes = [
    ctypes.c_void_p,  # fontCollection : GpFontCollection*
    ctypes.c_int,  # numSought : INT
    ctypes.c_void_p,  # gpfamilies : GpFontFamily** out
    ctypes.POINTER(ctypes.c_int),  # numFound : INT* out
]
require 'fiddle'
require 'fiddle/import'

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

var (
	gdiplus = windows.NewLazySystemDLL("gdiplus.dll")
	procGdipGetFontCollectionFamilyList = gdiplus.NewProc("GdipGetFontCollectionFamilyList")
)

// fontCollection (GpFontCollection*), numSought (INT), gpfamilies (GpFontFamily** out), numFound (INT* out)
r1, _, err := procGdipGetFontCollectionFamilyList.Call(
	uintptr(fontCollection),
	uintptr(numSought),
	uintptr(gpfamilies),
	uintptr(numFound),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // Status
function GdipGetFontCollectionFamilyList(
  fontCollection: Pointer;   // GpFontCollection*
  numSought: Integer;   // INT
  gpfamilies: Pointer;   // GpFontFamily** out
  numFound: Pointer   // INT* out
): Integer; stdcall;
  external 'gdiplus.dll' name 'GdipGetFontCollectionFamilyList';
result := DllCall("gdiplus\GdipGetFontCollectionFamilyList"
    , "Ptr", fontCollection   ; GpFontCollection*
    , "Int", numSought   ; INT
    , "Ptr", gpfamilies   ; GpFontFamily** out
    , "Ptr", numFound   ; INT* out
    , "Int")   ; return: Status
●GdipGetFontCollectionFamilyList(fontCollection, numSought, gpfamilies, numFound) = DLL("gdiplus.dll", "int GdipGetFontCollectionFamilyList(void*, int, void*, void*)")
# 呼び出し: GdipGetFontCollectionFamilyList(fontCollection, numSought, gpfamilies, numFound)
# fontCollection : GpFontCollection* -> "void*"
# numSought : INT -> "int"
# gpfamilies : GpFontFamily** out -> "void*"
# numFound : INT* out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。