ホーム › Globalization › ScriptGetFontLanguageTags
ScriptGetFontLanguageTags
関数指定スクリプトでフォントが対応する言語システムタグを取得する。
シグネチャ
// USP10.dll
#include <windows.h>
HRESULT ScriptGetFontLanguageTags(
HDC hdc, // optional
void** psc,
SCRIPT_ANALYSIS* psa, // optional
DWORD tagScript,
INT cMaxTags,
DWORD* pLangsysTags,
INT* pcTags
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| hdc | HDC | inoptional |
| psc | void** | inout |
| psa | SCRIPT_ANALYSIS* | inoptional |
| tagScript | DWORD | in |
| cMaxTags | INT | in |
| pLangsysTags | DWORD* | out |
| pcTags | INT* | out |
戻り値の型: HRESULT
各言語での呼び出し定義
// USP10.dll
#include <windows.h>
HRESULT ScriptGetFontLanguageTags(
HDC hdc, // optional
void** psc,
SCRIPT_ANALYSIS* psa, // optional
DWORD tagScript,
INT cMaxTags,
DWORD* pLangsysTags,
INT* pcTags
);[DllImport("USP10.dll", ExactSpelling = true)]
static extern int ScriptGetFontLanguageTags(
IntPtr hdc, // HDC optional
IntPtr psc, // void** in/out
IntPtr psa, // SCRIPT_ANALYSIS* optional
uint tagScript, // DWORD
int cMaxTags, // INT
out uint pLangsysTags, // DWORD* out
out int pcTags // INT* out
);<DllImport("USP10.dll", ExactSpelling:=True)>
Public Shared Function ScriptGetFontLanguageTags(
hdc As IntPtr, ' HDC optional
psc As IntPtr, ' void** in/out
psa As IntPtr, ' SCRIPT_ANALYSIS* optional
tagScript As UInteger, ' DWORD
cMaxTags As Integer, ' INT
<Out> ByRef pLangsysTags 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
' cMaxTags : INT
' pLangsysTags : DWORD* out
' pcTags : INT* out
Declare PtrSafe Function ScriptGetFontLanguageTags Lib "usp10" ( _
ByVal hdc As LongPtr, _
ByVal psc As LongPtr, _
ByVal psa As LongPtr, _
ByVal tagScript As Long, _
ByVal cMaxTags As Long, _
ByRef pLangsysTags 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
ScriptGetFontLanguageTags = ctypes.windll.usp10.ScriptGetFontLanguageTags
ScriptGetFontLanguageTags.restype = ctypes.c_int
ScriptGetFontLanguageTags.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
ctypes.c_int, # cMaxTags : INT
ctypes.POINTER(wintypes.DWORD), # pLangsysTags : DWORD* out
ctypes.POINTER(ctypes.c_int), # pcTags : INT* out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('USP10.dll')
ScriptGetFontLanguageTags = Fiddle::Function.new(
lib['ScriptGetFontLanguageTags'],
[
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, # cMaxTags : INT
Fiddle::TYPE_VOIDP, # pLangsysTags : DWORD* out
Fiddle::TYPE_VOIDP, # pcTags : INT* out
],
Fiddle::TYPE_INT)#[link(name = "usp10")]
extern "system" {
fn ScriptGetFontLanguageTags(
hdc: *mut core::ffi::c_void, // HDC optional
psc: *mut *mut (), // void** in/out
psa: *mut SCRIPT_ANALYSIS, // SCRIPT_ANALYSIS* optional
tagScript: u32, // DWORD
cMaxTags: i32, // INT
pLangsysTags: *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 ScriptGetFontLanguageTags(IntPtr hdc, IntPtr psc, IntPtr psa, uint tagScript, int cMaxTags, out uint pLangsysTags, out int pcTags);
"@
$api = Add-Type -MemberDefinition $sig -Name 'USP10_ScriptGetFontLanguageTags' -Namespace Win32 -PassThru
# $api::ScriptGetFontLanguageTags(hdc, psc, psa, tagScript, cMaxTags, pLangsysTags, pcTags)#uselib "USP10.dll"
#func global ScriptGetFontLanguageTags "ScriptGetFontLanguageTags" sptr, sptr, sptr, sptr, sptr, sptr, sptr
; ScriptGetFontLanguageTags hdc, psc, varptr(psa), tagScript, cMaxTags, varptr(pLangsysTags), varptr(pcTags) ; 戻り値は stat
; hdc : HDC optional -> "sptr"
; psc : void** in/out -> "sptr"
; psa : SCRIPT_ANALYSIS* optional -> "sptr"
; tagScript : DWORD -> "sptr"
; cMaxTags : INT -> "sptr"
; pLangsysTags : DWORD* out -> "sptr"
; pcTags : INT* out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "USP10.dll" #cfunc global ScriptGetFontLanguageTags "ScriptGetFontLanguageTags" sptr, sptr, var, int, int, var, var ; res = ScriptGetFontLanguageTags(hdc, psc, psa, tagScript, cMaxTags, pLangsysTags, pcTags) ; hdc : HDC optional -> "sptr" ; psc : void** in/out -> "sptr" ; psa : SCRIPT_ANALYSIS* optional -> "var" ; tagScript : DWORD -> "int" ; cMaxTags : INT -> "int" ; pLangsysTags : DWORD* out -> "var" ; pcTags : INT* out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "USP10.dll" #cfunc global ScriptGetFontLanguageTags "ScriptGetFontLanguageTags" sptr, sptr, sptr, int, int, sptr, sptr ; res = ScriptGetFontLanguageTags(hdc, psc, varptr(psa), tagScript, cMaxTags, varptr(pLangsysTags), varptr(pcTags)) ; hdc : HDC optional -> "sptr" ; psc : void** in/out -> "sptr" ; psa : SCRIPT_ANALYSIS* optional -> "sptr" ; tagScript : DWORD -> "int" ; cMaxTags : INT -> "int" ; pLangsysTags : DWORD* out -> "sptr" ; pcTags : INT* out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; HRESULT ScriptGetFontLanguageTags(HDC hdc, void** psc, SCRIPT_ANALYSIS* psa, DWORD tagScript, INT cMaxTags, DWORD* pLangsysTags, INT* pcTags) #uselib "USP10.dll" #cfunc global ScriptGetFontLanguageTags "ScriptGetFontLanguageTags" intptr, intptr, var, int, int, var, var ; res = ScriptGetFontLanguageTags(hdc, psc, psa, tagScript, cMaxTags, pLangsysTags, pcTags) ; hdc : HDC optional -> "intptr" ; psc : void** in/out -> "intptr" ; psa : SCRIPT_ANALYSIS* optional -> "var" ; tagScript : DWORD -> "int" ; cMaxTags : INT -> "int" ; pLangsysTags : DWORD* out -> "var" ; pcTags : INT* out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; HRESULT ScriptGetFontLanguageTags(HDC hdc, void** psc, SCRIPT_ANALYSIS* psa, DWORD tagScript, INT cMaxTags, DWORD* pLangsysTags, INT* pcTags) #uselib "USP10.dll" #cfunc global ScriptGetFontLanguageTags "ScriptGetFontLanguageTags" intptr, intptr, intptr, int, int, intptr, intptr ; res = ScriptGetFontLanguageTags(hdc, psc, varptr(psa), tagScript, cMaxTags, varptr(pLangsysTags), varptr(pcTags)) ; hdc : HDC optional -> "intptr" ; psc : void** in/out -> "intptr" ; psa : SCRIPT_ANALYSIS* optional -> "intptr" ; tagScript : DWORD -> "int" ; cMaxTags : INT -> "int" ; pLangsysTags : DWORD* out -> "intptr" ; pcTags : INT* out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
usp10 = windows.NewLazySystemDLL("USP10.dll")
procScriptGetFontLanguageTags = usp10.NewProc("ScriptGetFontLanguageTags")
)
// hdc (HDC optional), psc (void** in/out), psa (SCRIPT_ANALYSIS* optional), tagScript (DWORD), cMaxTags (INT), pLangsysTags (DWORD* out), pcTags (INT* out)
r1, _, err := procScriptGetFontLanguageTags.Call(
uintptr(hdc),
uintptr(psc),
uintptr(psa),
uintptr(tagScript),
uintptr(cMaxTags),
uintptr(pLangsysTags),
uintptr(pcTags),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // HRESULTfunction ScriptGetFontLanguageTags(
hdc: THandle; // HDC optional
psc: Pointer; // void** in/out
psa: Pointer; // SCRIPT_ANALYSIS* optional
tagScript: DWORD; // DWORD
cMaxTags: Integer; // INT
pLangsysTags: Pointer; // DWORD* out
pcTags: Pointer // INT* out
): Integer; stdcall;
external 'USP10.dll' name 'ScriptGetFontLanguageTags';result := DllCall("USP10\ScriptGetFontLanguageTags"
, "Ptr", hdc ; HDC optional
, "Ptr", psc ; void** in/out
, "Ptr", psa ; SCRIPT_ANALYSIS* optional
, "UInt", tagScript ; DWORD
, "Int", cMaxTags ; INT
, "Ptr", pLangsysTags ; DWORD* out
, "Ptr", pcTags ; INT* out
, "Int") ; return: HRESULT●ScriptGetFontLanguageTags(hdc, psc, psa, tagScript, cMaxTags, pLangsysTags, pcTags) = DLL("USP10.dll", "int ScriptGetFontLanguageTags(void*, void*, void*, dword, int, void*, void*)")
# 呼び出し: ScriptGetFontLanguageTags(hdc, psc, psa, tagScript, cMaxTags, pLangsysTags, pcTags)
# hdc : HDC optional -> "void*"
# psc : void** in/out -> "void*"
# psa : SCRIPT_ANALYSIS* optional -> "void*"
# tagScript : DWORD -> "dword"
# cMaxTags : INT -> "int"
# pLangsysTags : DWORD* out -> "void*"
# pcTags : INT* out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。