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

GdipGetFontUnit

関数
フォントサイズの単位を取得する。
DLLgdiplus.dll呼出規約winapi

シグネチャ

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

Status GdipGetFontUnit(
    GpFont* font,
    Unit* unit
);

パラメーター

名前方向
fontGpFont*inout
unitUnit*inout

戻り値の型: Status

各言語での呼び出し定義

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

Status GdipGetFontUnit(
    GpFont* font,
    Unit* unit
);
[DllImport("gdiplus.dll", ExactSpelling = true)]
static extern int GdipGetFontUnit(
    IntPtr font,   // GpFont* in/out
    ref int unit   // Unit* in/out
);
<DllImport("gdiplus.dll", ExactSpelling:=True)>
Public Shared Function GdipGetFontUnit(
    font As IntPtr,   ' GpFont* in/out
    ByRef unit As Integer   ' Unit* in/out
) As Integer
End Function
' font : GpFont* in/out
' unit : Unit* in/out
Declare PtrSafe Function GdipGetFontUnit Lib "gdiplus" ( _
    ByVal font As LongPtr, _
    ByRef unit As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

GdipGetFontUnit = ctypes.windll.gdiplus.GdipGetFontUnit
GdipGetFontUnit.restype = ctypes.c_int
GdipGetFontUnit.argtypes = [
    ctypes.c_void_p,  # font : GpFont* in/out
    ctypes.c_void_p,  # unit : Unit* in/out
]
require 'fiddle'
require 'fiddle/import'

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

var (
	gdiplus = windows.NewLazySystemDLL("gdiplus.dll")
	procGdipGetFontUnit = gdiplus.NewProc("GdipGetFontUnit")
)

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