Win32 API 日本語リファレンス
ホームGlobalization › ScriptGetFontScriptTags

ScriptGetFontScriptTags

関数
フォントが対応するOpenTypeスクリプトタグを取得する。
DLLUSP10.dll呼出規約winapi対応OSWindows Vista 以降

シグネチャ

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

HRESULT ScriptGetFontScriptTags(
    HDC hdc,   // optional
    void** psc,
    SCRIPT_ANALYSIS* psa,   // optional
    INT cMaxTags,
    DWORD* pScriptTags,
    INT* pcTags
);

パラメーター

名前方向
hdcHDCinoptional
pscvoid**inout
psaSCRIPT_ANALYSIS*inoptional
cMaxTagsINTin
pScriptTagsDWORD*out
pcTagsINT*out

戻り値の型: HRESULT

各言語での呼び出し定義

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

HRESULT ScriptGetFontScriptTags(
    HDC hdc,   // optional
    void** psc,
    SCRIPT_ANALYSIS* psa,   // optional
    INT cMaxTags,
    DWORD* pScriptTags,
    INT* pcTags
);
[DllImport("USP10.dll", ExactSpelling = true)]
static extern int ScriptGetFontScriptTags(
    IntPtr hdc,   // HDC optional
    IntPtr psc,   // void** in/out
    IntPtr psa,   // SCRIPT_ANALYSIS* optional
    int cMaxTags,   // INT
    out uint pScriptTags,   // DWORD* out
    out int pcTags   // INT* out
);
<DllImport("USP10.dll", ExactSpelling:=True)>
Public Shared Function ScriptGetFontScriptTags(
    hdc As IntPtr,   ' HDC optional
    psc As IntPtr,   ' void** in/out
    psa As IntPtr,   ' SCRIPT_ANALYSIS* optional
    cMaxTags As Integer,   ' INT
    <Out> ByRef pScriptTags As UInteger,   ' DWORD* out
    <Out> ByRef pcTags As Integer   ' INT* out
) As Integer
End Function
' hdc : HDC optional
' psc : void** in/out
' psa : SCRIPT_ANALYSIS* optional
' cMaxTags : INT
' pScriptTags : DWORD* out
' pcTags : INT* out
Declare PtrSafe Function ScriptGetFontScriptTags Lib "usp10" ( _
    ByVal hdc As LongPtr, _
    ByVal psc As LongPtr, _
    ByVal psa As LongPtr, _
    ByVal cMaxTags As Long, _
    ByRef pScriptTags As Long, _
    ByRef pcTags As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

ScriptGetFontScriptTags = ctypes.windll.usp10.ScriptGetFontScriptTags
ScriptGetFontScriptTags.restype = ctypes.c_int
ScriptGetFontScriptTags.argtypes = [
    wintypes.HANDLE,  # hdc : HDC optional
    ctypes.c_void_p,  # psc : void** in/out
    ctypes.c_void_p,  # psa : SCRIPT_ANALYSIS* optional
    ctypes.c_int,  # cMaxTags : INT
    ctypes.POINTER(wintypes.DWORD),  # pScriptTags : DWORD* out
    ctypes.POINTER(ctypes.c_int),  # pcTags : INT* out
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('USP10.dll')
ScriptGetFontScriptTags = Fiddle::Function.new(
  lib['ScriptGetFontScriptTags'],
  [
    Fiddle::TYPE_VOIDP,  # hdc : HDC optional
    Fiddle::TYPE_VOIDP,  # psc : void** in/out
    Fiddle::TYPE_VOIDP,  # psa : SCRIPT_ANALYSIS* optional
    Fiddle::TYPE_INT,  # cMaxTags : INT
    Fiddle::TYPE_VOIDP,  # pScriptTags : DWORD* out
    Fiddle::TYPE_VOIDP,  # pcTags : INT* out
  ],
  Fiddle::TYPE_INT)
#[link(name = "usp10")]
extern "system" {
    fn ScriptGetFontScriptTags(
        hdc: *mut core::ffi::c_void,  // HDC optional
        psc: *mut *mut (),  // void** in/out
        psa: *mut SCRIPT_ANALYSIS,  // SCRIPT_ANALYSIS* optional
        cMaxTags: i32,  // INT
        pScriptTags: *mut u32,  // DWORD* out
        pcTags: *mut i32  // INT* out
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("USP10.dll")]
public static extern int ScriptGetFontScriptTags(IntPtr hdc, IntPtr psc, IntPtr psa, int cMaxTags, out uint pScriptTags, out int pcTags);
"@
$api = Add-Type -MemberDefinition $sig -Name 'USP10_ScriptGetFontScriptTags' -Namespace Win32 -PassThru
# $api::ScriptGetFontScriptTags(hdc, psc, psa, cMaxTags, pScriptTags, pcTags)
#uselib "USP10.dll"
#func global ScriptGetFontScriptTags "ScriptGetFontScriptTags" sptr, sptr, sptr, sptr, sptr, sptr
; ScriptGetFontScriptTags hdc, psc, varptr(psa), cMaxTags, varptr(pScriptTags), varptr(pcTags)   ; 戻り値は stat
; hdc : HDC optional -> "sptr"
; psc : void** in/out -> "sptr"
; psa : SCRIPT_ANALYSIS* optional -> "sptr"
; cMaxTags : INT -> "sptr"
; pScriptTags : DWORD* out -> "sptr"
; pcTags : INT* out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "USP10.dll"
#cfunc global ScriptGetFontScriptTags "ScriptGetFontScriptTags" sptr, sptr, var, int, var, var
; res = ScriptGetFontScriptTags(hdc, psc, psa, cMaxTags, pScriptTags, pcTags)
; hdc : HDC optional -> "sptr"
; psc : void** in/out -> "sptr"
; psa : SCRIPT_ANALYSIS* optional -> "var"
; cMaxTags : INT -> "int"
; pScriptTags : DWORD* out -> "var"
; pcTags : INT* out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; HRESULT ScriptGetFontScriptTags(HDC hdc, void** psc, SCRIPT_ANALYSIS* psa, INT cMaxTags, DWORD* pScriptTags, INT* pcTags)
#uselib "USP10.dll"
#cfunc global ScriptGetFontScriptTags "ScriptGetFontScriptTags" intptr, intptr, var, int, var, var
; res = ScriptGetFontScriptTags(hdc, psc, psa, cMaxTags, pScriptTags, pcTags)
; hdc : HDC optional -> "intptr"
; psc : void** in/out -> "intptr"
; psa : SCRIPT_ANALYSIS* optional -> "var"
; cMaxTags : INT -> "int"
; pScriptTags : DWORD* out -> "var"
; pcTags : INT* out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	usp10 = windows.NewLazySystemDLL("USP10.dll")
	procScriptGetFontScriptTags = usp10.NewProc("ScriptGetFontScriptTags")
)

// hdc (HDC optional), psc (void** in/out), psa (SCRIPT_ANALYSIS* optional), cMaxTags (INT), pScriptTags (DWORD* out), pcTags (INT* out)
r1, _, err := procScriptGetFontScriptTags.Call(
	uintptr(hdc),
	uintptr(psc),
	uintptr(psa),
	uintptr(cMaxTags),
	uintptr(pScriptTags),
	uintptr(pcTags),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // HRESULT
function ScriptGetFontScriptTags(
  hdc: THandle;   // HDC optional
  psc: Pointer;   // void** in/out
  psa: Pointer;   // SCRIPT_ANALYSIS* optional
  cMaxTags: Integer;   // INT
  pScriptTags: Pointer;   // DWORD* out
  pcTags: Pointer   // INT* out
): Integer; stdcall;
  external 'USP10.dll' name 'ScriptGetFontScriptTags';
result := DllCall("USP10\ScriptGetFontScriptTags"
    , "Ptr", hdc   ; HDC optional
    , "Ptr", psc   ; void** in/out
    , "Ptr", psa   ; SCRIPT_ANALYSIS* optional
    , "Int", cMaxTags   ; INT
    , "Ptr", pScriptTags   ; DWORD* out
    , "Ptr", pcTags   ; INT* out
    , "Int")   ; return: HRESULT
●ScriptGetFontScriptTags(hdc, psc, psa, cMaxTags, pScriptTags, pcTags) = DLL("USP10.dll", "int ScriptGetFontScriptTags(void*, void*, void*, int, void*, void*)")
# 呼び出し: ScriptGetFontScriptTags(hdc, psc, psa, cMaxTags, pScriptTags, pcTags)
# hdc : HDC optional -> "void*"
# psc : void** in/out -> "void*"
# psa : SCRIPT_ANALYSIS* optional -> "void*"
# cMaxTags : INT -> "int"
# pScriptTags : DWORD* out -> "void*"
# pcTags : INT* out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。