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

GdipGetLogFontW

関数
フォントからLOGFONT構造体を取得する(Unicode版)。
DLLgdiplus.dll文字セットUnicode (-W)呼出規約winapi

シグネチャ

// gdiplus.dll  (Unicode / -W)
#include <windows.h>

Status GdipGetLogFontW(
    GpFont* font,
    GpGraphics* graphics,
    LOGFONTW* logfontW
);

パラメーター

名前方向
fontGpFont*inout
graphicsGpGraphics*inout
logfontWLOGFONTW*inout

戻り値の型: Status

各言語での呼び出し定義

// gdiplus.dll  (Unicode / -W)
#include <windows.h>

Status GdipGetLogFontW(
    GpFont* font,
    GpGraphics* graphics,
    LOGFONTW* logfontW
);
[DllImport("gdiplus.dll", CharSet = CharSet.Unicode, ExactSpelling = true)]
static extern int GdipGetLogFontW(
    IntPtr font,   // GpFont* in/out
    IntPtr graphics,   // GpGraphics* in/out
    IntPtr logfontW   // LOGFONTW* in/out
);
<DllImport("gdiplus.dll", CharSet:=CharSet.Unicode, ExactSpelling:=True)>
Public Shared Function GdipGetLogFontW(
    font As IntPtr,   ' GpFont* in/out
    graphics As IntPtr,   ' GpGraphics* in/out
    logfontW As IntPtr   ' LOGFONTW* in/out
) As Integer
End Function
' font : GpFont* in/out
' graphics : GpGraphics* in/out
' logfontW : LOGFONTW* in/out
Declare PtrSafe Function GdipGetLogFontW Lib "gdiplus" ( _
    ByVal font As LongPtr, _
    ByVal graphics As LongPtr, _
    ByVal logfontW As LongPtr) As Long
' Unicode(W): 文字列は ByVal As LongPtr とし StrPtr(unicodeStr) を渡す
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

GdipGetLogFontW = ctypes.windll.gdiplus.GdipGetLogFontW
GdipGetLogFontW.restype = ctypes.c_int
GdipGetLogFontW.argtypes = [
    ctypes.c_void_p,  # font : GpFont* in/out
    ctypes.c_void_p,  # graphics : GpGraphics* in/out
    ctypes.c_void_p,  # logfontW : LOGFONTW* in/out
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('gdiplus.dll')
GdipGetLogFontW = Fiddle::Function.new(
  lib['GdipGetLogFontW'],
  [
    Fiddle::TYPE_VOIDP,  # font : GpFont* in/out
    Fiddle::TYPE_VOIDP,  # graphics : GpGraphics* in/out
    Fiddle::TYPE_VOIDP,  # logfontW : LOGFONTW* in/out
  ],
  Fiddle::TYPE_INT)
# Wide strings: pass str.encode("UTF-16LE") + "\x00\x00"
#[link(name = "gdiplus")]
extern "system" {
    fn GdipGetLogFontW(
        font: *mut GpFont,  // GpFont* in/out
        graphics: *mut GpGraphics,  // GpGraphics* in/out
        logfontW: *mut LOGFONTW  // LOGFONTW* in/out
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("gdiplus.dll", CharSet = CharSet.Unicode)]
public static extern int GdipGetLogFontW(IntPtr font, IntPtr graphics, IntPtr logfontW);
"@
$api = Add-Type -MemberDefinition $sig -Name 'gdiplus_GdipGetLogFontW' -Namespace Win32 -PassThru
# $api::GdipGetLogFontW(font, graphics, logfontW)
#uselib "gdiplus.dll"
#func global GdipGetLogFontW "GdipGetLogFontW" wptr, wptr, wptr
; GdipGetLogFontW varptr(font), varptr(graphics), varptr(logfontW)   ; 戻り値は stat
; font : GpFont* in/out -> "wptr"
; graphics : GpGraphics* in/out -> "wptr"
; logfontW : LOGFONTW* in/out -> "wptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "gdiplus.dll"
#cfunc global GdipGetLogFontW "GdipGetLogFontW" var, var, var
; res = GdipGetLogFontW(font, graphics, logfontW)
; font : GpFont* in/out -> "var"
; graphics : GpGraphics* in/out -> "var"
; logfontW : LOGFONTW* in/out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; Status GdipGetLogFontW(GpFont* font, GpGraphics* graphics, LOGFONTW* logfontW)
#uselib "gdiplus.dll"
#cfunc global GdipGetLogFontW "GdipGetLogFontW" var, var, var
; res = GdipGetLogFontW(font, graphics, logfontW)
; font : GpFont* in/out -> "var"
; graphics : GpGraphics* in/out -> "var"
; logfontW : LOGFONTW* in/out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	gdiplus = windows.NewLazySystemDLL("gdiplus.dll")
	procGdipGetLogFontW = gdiplus.NewProc("GdipGetLogFontW")
)

// font (GpFont* in/out), graphics (GpGraphics* in/out), logfontW (LOGFONTW* in/out)
r1, _, err := procGdipGetLogFontW.Call(
	uintptr(font),
	uintptr(graphics),
	uintptr(logfontW),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // Status
function GdipGetLogFontW(
  font: Pointer;   // GpFont* in/out
  graphics: Pointer;   // GpGraphics* in/out
  logfontW: Pointer   // LOGFONTW* in/out
): Integer; stdcall;
  external 'gdiplus.dll' name 'GdipGetLogFontW';
result := DllCall("gdiplus\GdipGetLogFontW"
    , "Ptr", font   ; GpFont* in/out
    , "Ptr", graphics   ; GpGraphics* in/out
    , "Ptr", logfontW   ; LOGFONTW* in/out
    , "Int")   ; return: Status
●GdipGetLogFontW(font, graphics, logfontW) = DLL("gdiplus.dll", "int GdipGetLogFontW(void*, void*, void*)")
# 呼び出し: GdipGetLogFontW(font, graphics, logfontW)
# font : GpFont* in/out -> "void*"
# graphics : GpGraphics* in/out -> "void*"
# logfontW : LOGFONTW* in/out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
# ※-W(Unicode)関数。なでしこ1はANSIのため -A 版の利用を推奨。