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

GdipGetEmHeight

関数
フォントファミリーのemサイズ高さを取得する。
DLLgdiplus.dll呼出規約winapi

シグネチャ

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

Status GdipGetEmHeight(
    const GpFontFamily* family,
    INT style,
    WORD* EmHeight
);

パラメーター

名前方向
familyGpFontFamily*in
styleINTin
EmHeightWORD*inout

戻り値の型: Status

各言語での呼び出し定義

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

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

GdipGetEmHeight = ctypes.windll.gdiplus.GdipGetEmHeight
GdipGetEmHeight.restype = ctypes.c_int
GdipGetEmHeight.argtypes = [
    ctypes.c_void_p,  # family : GpFontFamily*
    ctypes.c_int,  # style : INT
    ctypes.POINTER(ctypes.c_ushort),  # EmHeight : WORD* in/out
]
require 'fiddle'
require 'fiddle/import'

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

var (
	gdiplus = windows.NewLazySystemDLL("gdiplus.dll")
	procGdipGetEmHeight = gdiplus.NewProc("GdipGetEmHeight")
)

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