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