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

ScriptGetFontFeatureTags

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

シグネチャ

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

HRESULT ScriptGetFontFeatureTags(
    HDC hdc,   // optional
    void** psc,
    SCRIPT_ANALYSIS* psa,   // optional
    DWORD tagScript,
    DWORD tagLangSys,
    INT cMaxTags,
    DWORD* pFeatureTags,
    INT* pcTags
);

パラメーター

名前方向
hdcHDCinoptional
pscvoid**inout
psaSCRIPT_ANALYSIS*inoptional
tagScriptDWORDin
tagLangSysDWORDin
cMaxTagsINTin
pFeatureTagsDWORD*out
pcTagsINT*out

戻り値の型: HRESULT

各言語での呼び出し定義

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

HRESULT ScriptGetFontFeatureTags(
    HDC hdc,   // optional
    void** psc,
    SCRIPT_ANALYSIS* psa,   // optional
    DWORD tagScript,
    DWORD tagLangSys,
    INT cMaxTags,
    DWORD* pFeatureTags,
    INT* pcTags
);
[DllImport("USP10.dll", ExactSpelling = true)]
static extern int ScriptGetFontFeatureTags(
    IntPtr hdc,   // HDC optional
    IntPtr psc,   // void** in/out
    IntPtr psa,   // SCRIPT_ANALYSIS* optional
    uint tagScript,   // DWORD
    uint tagLangSys,   // DWORD
    int cMaxTags,   // INT
    out uint pFeatureTags,   // DWORD* out
    out int pcTags   // INT* out
);
<DllImport("USP10.dll", ExactSpelling:=True)>
Public Shared Function ScriptGetFontFeatureTags(
    hdc As IntPtr,   ' HDC optional
    psc As IntPtr,   ' void** in/out
    psa As IntPtr,   ' SCRIPT_ANALYSIS* optional
    tagScript As UInteger,   ' DWORD
    tagLangSys As UInteger,   ' DWORD
    cMaxTags As Integer,   ' INT
    <Out> ByRef pFeatureTags 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
' tagScript : DWORD
' tagLangSys : DWORD
' cMaxTags : INT
' pFeatureTags : DWORD* out
' pcTags : INT* out
Declare PtrSafe Function ScriptGetFontFeatureTags Lib "usp10" ( _
    ByVal hdc As LongPtr, _
    ByVal psc As LongPtr, _
    ByVal psa As LongPtr, _
    ByVal tagScript As Long, _
    ByVal tagLangSys As Long, _
    ByVal cMaxTags As Long, _
    ByRef pFeatureTags 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

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

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

var (
	usp10 = windows.NewLazySystemDLL("USP10.dll")
	procScriptGetFontFeatureTags = usp10.NewProc("ScriptGetFontFeatureTags")
)

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