ホーム › Globalization › ScriptGetFontProperties
ScriptGetFontProperties
関数現フォントのスクリプト関連プロパティを取得する。
シグネチャ
// USP10.dll
#include <windows.h>
HRESULT ScriptGetFontProperties(
HDC hdc,
void** psc,
SCRIPT_FONTPROPERTIES* sfp
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| hdc | HDC | in |
| psc | void** | inout |
| sfp | SCRIPT_FONTPROPERTIES* | out |
戻り値の型: HRESULT
各言語での呼び出し定義
// USP10.dll
#include <windows.h>
HRESULT ScriptGetFontProperties(
HDC hdc,
void** psc,
SCRIPT_FONTPROPERTIES* sfp
);[DllImport("USP10.dll", ExactSpelling = true)]
static extern int ScriptGetFontProperties(
IntPtr hdc, // HDC
IntPtr psc, // void** in/out
IntPtr sfp // SCRIPT_FONTPROPERTIES* out
);<DllImport("USP10.dll", ExactSpelling:=True)>
Public Shared Function ScriptGetFontProperties(
hdc As IntPtr, ' HDC
psc As IntPtr, ' void** in/out
sfp As IntPtr ' SCRIPT_FONTPROPERTIES* out
) As Integer
End Function' hdc : HDC
' psc : void** in/out
' sfp : SCRIPT_FONTPROPERTIES* out
Declare PtrSafe Function ScriptGetFontProperties Lib "usp10" ( _
ByVal hdc As LongPtr, _
ByVal psc As LongPtr, _
ByVal sfp As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
ScriptGetFontProperties = ctypes.windll.usp10.ScriptGetFontProperties
ScriptGetFontProperties.restype = ctypes.c_int
ScriptGetFontProperties.argtypes = [
wintypes.HANDLE, # hdc : HDC
ctypes.c_void_p, # psc : void** in/out
ctypes.c_void_p, # sfp : SCRIPT_FONTPROPERTIES* out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('USP10.dll')
ScriptGetFontProperties = Fiddle::Function.new(
lib['ScriptGetFontProperties'],
[
Fiddle::TYPE_VOIDP, # hdc : HDC
Fiddle::TYPE_VOIDP, # psc : void** in/out
Fiddle::TYPE_VOIDP, # sfp : SCRIPT_FONTPROPERTIES* out
],
Fiddle::TYPE_INT)#[link(name = "usp10")]
extern "system" {
fn ScriptGetFontProperties(
hdc: *mut core::ffi::c_void, // HDC
psc: *mut *mut (), // void** in/out
sfp: *mut SCRIPT_FONTPROPERTIES // SCRIPT_FONTPROPERTIES* out
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("USP10.dll")]
public static extern int ScriptGetFontProperties(IntPtr hdc, IntPtr psc, IntPtr sfp);
"@
$api = Add-Type -MemberDefinition $sig -Name 'USP10_ScriptGetFontProperties' -Namespace Win32 -PassThru
# $api::ScriptGetFontProperties(hdc, psc, sfp)#uselib "USP10.dll"
#func global ScriptGetFontProperties "ScriptGetFontProperties" sptr, sptr, sptr
; ScriptGetFontProperties hdc, psc, varptr(sfp) ; 戻り値は stat
; hdc : HDC -> "sptr"
; psc : void** in/out -> "sptr"
; sfp : SCRIPT_FONTPROPERTIES* out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "USP10.dll" #cfunc global ScriptGetFontProperties "ScriptGetFontProperties" sptr, sptr, var ; res = ScriptGetFontProperties(hdc, psc, sfp) ; hdc : HDC -> "sptr" ; psc : void** in/out -> "sptr" ; sfp : SCRIPT_FONTPROPERTIES* out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "USP10.dll" #cfunc global ScriptGetFontProperties "ScriptGetFontProperties" sptr, sptr, sptr ; res = ScriptGetFontProperties(hdc, psc, varptr(sfp)) ; hdc : HDC -> "sptr" ; psc : void** in/out -> "sptr" ; sfp : SCRIPT_FONTPROPERTIES* out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; HRESULT ScriptGetFontProperties(HDC hdc, void** psc, SCRIPT_FONTPROPERTIES* sfp) #uselib "USP10.dll" #cfunc global ScriptGetFontProperties "ScriptGetFontProperties" intptr, intptr, var ; res = ScriptGetFontProperties(hdc, psc, sfp) ; hdc : HDC -> "intptr" ; psc : void** in/out -> "intptr" ; sfp : SCRIPT_FONTPROPERTIES* out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; HRESULT ScriptGetFontProperties(HDC hdc, void** psc, SCRIPT_FONTPROPERTIES* sfp) #uselib "USP10.dll" #cfunc global ScriptGetFontProperties "ScriptGetFontProperties" intptr, intptr, intptr ; res = ScriptGetFontProperties(hdc, psc, varptr(sfp)) ; hdc : HDC -> "intptr" ; psc : void** in/out -> "intptr" ; sfp : SCRIPT_FONTPROPERTIES* out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
usp10 = windows.NewLazySystemDLL("USP10.dll")
procScriptGetFontProperties = usp10.NewProc("ScriptGetFontProperties")
)
// hdc (HDC), psc (void** in/out), sfp (SCRIPT_FONTPROPERTIES* out)
r1, _, err := procScriptGetFontProperties.Call(
uintptr(hdc),
uintptr(psc),
uintptr(sfp),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // HRESULTfunction ScriptGetFontProperties(
hdc: THandle; // HDC
psc: Pointer; // void** in/out
sfp: Pointer // SCRIPT_FONTPROPERTIES* out
): Integer; stdcall;
external 'USP10.dll' name 'ScriptGetFontProperties';result := DllCall("USP10\ScriptGetFontProperties"
, "Ptr", hdc ; HDC
, "Ptr", psc ; void** in/out
, "Ptr", sfp ; SCRIPT_FONTPROPERTIES* out
, "Int") ; return: HRESULT●ScriptGetFontProperties(hdc, psc, sfp) = DLL("USP10.dll", "int ScriptGetFontProperties(void*, void*, void*)")
# 呼び出し: ScriptGetFontProperties(hdc, psc, sfp)
# hdc : HDC -> "void*"
# psc : void** in/out -> "void*"
# sfp : SCRIPT_FONTPROPERTIES* out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。