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