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