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

ScriptTextOut

関数
整形済みグリフ列をデバイスコンテキストに描画する。
DLLUSP10.dll呼出規約winapi対応OSWindows 2000 以降

シグネチャ

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

HRESULT ScriptTextOut(
    HDC hdc,
    void** psc,
    INT x,
    INT y,
    DWORD fuOptions,
    const RECT* lprc,   // optional
    const SCRIPT_ANALYSIS* psa,
    LPCWSTR pwcReserved,   // optional
    INT iReserved,   // optional
    const WORD* pwGlyphs,
    INT cGlyphs,
    const INT* piAdvance,
    const INT* piJustify,   // optional
    const GOFFSET* pGoffset
);

パラメーター

名前方向
hdcHDCin
pscvoid**inout
xINTin
yINTin
fuOptionsDWORDin
lprcRECT*inoptional
psaSCRIPT_ANALYSIS*in
pwcReservedLPCWSTRoptional
iReservedINToptional
pwGlyphsWORD*in
cGlyphsINTin
piAdvanceINT*in
piJustifyINT*inoptional
pGoffsetGOFFSET*in

戻り値の型: HRESULT

各言語での呼び出し定義

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

HRESULT ScriptTextOut(
    HDC hdc,
    void** psc,
    INT x,
    INT y,
    DWORD fuOptions,
    const RECT* lprc,   // optional
    const SCRIPT_ANALYSIS* psa,
    LPCWSTR pwcReserved,   // optional
    INT iReserved,   // optional
    const WORD* pwGlyphs,
    INT cGlyphs,
    const INT* piAdvance,
    const INT* piJustify,   // optional
    const GOFFSET* pGoffset
);
[DllImport("USP10.dll", ExactSpelling = true)]
static extern int ScriptTextOut(
    IntPtr hdc,   // HDC
    IntPtr psc,   // void** in/out
    int x,   // INT
    int y,   // INT
    uint fuOptions,   // DWORD
    IntPtr lprc,   // RECT* optional
    IntPtr psa,   // SCRIPT_ANALYSIS*
    [MarshalAs(UnmanagedType.LPWStr)] string pwcReserved,   // LPCWSTR optional
    int iReserved,   // INT optional
    ref ushort pwGlyphs,   // WORD*
    int cGlyphs,   // INT
    ref int piAdvance,   // INT*
    IntPtr piJustify,   // INT* optional
    IntPtr pGoffset   // GOFFSET*
);
<DllImport("USP10.dll", ExactSpelling:=True)>
Public Shared Function ScriptTextOut(
    hdc As IntPtr,   ' HDC
    psc As IntPtr,   ' void** in/out
    x As Integer,   ' INT
    y As Integer,   ' INT
    fuOptions As UInteger,   ' DWORD
    lprc As IntPtr,   ' RECT* optional
    psa As IntPtr,   ' SCRIPT_ANALYSIS*
    <MarshalAs(UnmanagedType.LPWStr)> pwcReserved As String,   ' LPCWSTR optional
    iReserved As Integer,   ' INT optional
    ByRef pwGlyphs As UShort,   ' WORD*
    cGlyphs As Integer,   ' INT
    ByRef piAdvance As Integer,   ' INT*
    piJustify As IntPtr,   ' INT* optional
    pGoffset As IntPtr   ' GOFFSET*
) As Integer
End Function
' hdc : HDC
' psc : void** in/out
' x : INT
' y : INT
' fuOptions : DWORD
' lprc : RECT* optional
' psa : SCRIPT_ANALYSIS*
' pwcReserved : LPCWSTR optional
' iReserved : INT optional
' pwGlyphs : WORD*
' cGlyphs : INT
' piAdvance : INT*
' piJustify : INT* optional
' pGoffset : GOFFSET*
Declare PtrSafe Function ScriptTextOut Lib "usp10" ( _
    ByVal hdc As LongPtr, _
    ByVal psc As LongPtr, _
    ByVal x As Long, _
    ByVal y As Long, _
    ByVal fuOptions As Long, _
    ByVal lprc As LongPtr, _
    ByVal psa As LongPtr, _
    ByVal pwcReserved As LongPtr, _
    ByVal iReserved As Long, _
    ByRef pwGlyphs As Integer, _
    ByVal cGlyphs As Long, _
    ByRef piAdvance As Long, _
    ByVal piJustify As LongPtr, _
    ByVal pGoffset As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

ScriptTextOut = ctypes.windll.usp10.ScriptTextOut
ScriptTextOut.restype = ctypes.c_int
ScriptTextOut.argtypes = [
    wintypes.HANDLE,  # hdc : HDC
    ctypes.c_void_p,  # psc : void** in/out
    ctypes.c_int,  # x : INT
    ctypes.c_int,  # y : INT
    wintypes.DWORD,  # fuOptions : DWORD
    ctypes.c_void_p,  # lprc : RECT* optional
    ctypes.c_void_p,  # psa : SCRIPT_ANALYSIS*
    wintypes.LPCWSTR,  # pwcReserved : LPCWSTR optional
    ctypes.c_int,  # iReserved : INT optional
    ctypes.POINTER(ctypes.c_ushort),  # pwGlyphs : WORD*
    ctypes.c_int,  # cGlyphs : INT
    ctypes.POINTER(ctypes.c_int),  # piAdvance : INT*
    ctypes.POINTER(ctypes.c_int),  # piJustify : INT* optional
    ctypes.c_void_p,  # pGoffset : GOFFSET*
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('USP10.dll')
ScriptTextOut = Fiddle::Function.new(
  lib['ScriptTextOut'],
  [
    Fiddle::TYPE_VOIDP,  # hdc : HDC
    Fiddle::TYPE_VOIDP,  # psc : void** in/out
    Fiddle::TYPE_INT,  # x : INT
    Fiddle::TYPE_INT,  # y : INT
    -Fiddle::TYPE_INT,  # fuOptions : DWORD
    Fiddle::TYPE_VOIDP,  # lprc : RECT* optional
    Fiddle::TYPE_VOIDP,  # psa : SCRIPT_ANALYSIS*
    Fiddle::TYPE_VOIDP,  # pwcReserved : LPCWSTR optional
    Fiddle::TYPE_INT,  # iReserved : INT optional
    Fiddle::TYPE_VOIDP,  # pwGlyphs : WORD*
    Fiddle::TYPE_INT,  # cGlyphs : INT
    Fiddle::TYPE_VOIDP,  # piAdvance : INT*
    Fiddle::TYPE_VOIDP,  # piJustify : INT* optional
    Fiddle::TYPE_VOIDP,  # pGoffset : GOFFSET*
  ],
  Fiddle::TYPE_INT)
#[link(name = "usp10")]
extern "system" {
    fn ScriptTextOut(
        hdc: *mut core::ffi::c_void,  // HDC
        psc: *mut *mut (),  // void** in/out
        x: i32,  // INT
        y: i32,  // INT
        fuOptions: u32,  // DWORD
        lprc: *const RECT,  // RECT* optional
        psa: *const SCRIPT_ANALYSIS,  // SCRIPT_ANALYSIS*
        pwcReserved: *const u16,  // LPCWSTR optional
        iReserved: i32,  // INT optional
        pwGlyphs: *const u16,  // WORD*
        cGlyphs: i32,  // INT
        piAdvance: *const i32,  // INT*
        piJustify: *const i32,  // INT* optional
        pGoffset: *const GOFFSET  // GOFFSET*
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("USP10.dll")]
public static extern int ScriptTextOut(IntPtr hdc, IntPtr psc, int x, int y, uint fuOptions, IntPtr lprc, IntPtr psa, [MarshalAs(UnmanagedType.LPWStr)] string pwcReserved, int iReserved, ref ushort pwGlyphs, int cGlyphs, ref int piAdvance, IntPtr piJustify, IntPtr pGoffset);
"@
$api = Add-Type -MemberDefinition $sig -Name 'USP10_ScriptTextOut' -Namespace Win32 -PassThru
# $api::ScriptTextOut(hdc, psc, x, y, fuOptions, lprc, psa, pwcReserved, iReserved, pwGlyphs, cGlyphs, piAdvance, piJustify, pGoffset)
#uselib "USP10.dll"
#func global ScriptTextOut "ScriptTextOut" sptr, sptr, sptr, sptr, sptr, sptr, sptr, sptr, sptr, sptr, sptr, sptr, sptr, sptr
; ScriptTextOut hdc, psc, x, y, fuOptions, varptr(lprc), varptr(psa), pwcReserved, iReserved, varptr(pwGlyphs), cGlyphs, varptr(piAdvance), varptr(piJustify), varptr(pGoffset)   ; 戻り値は stat
; hdc : HDC -> "sptr"
; psc : void** in/out -> "sptr"
; x : INT -> "sptr"
; y : INT -> "sptr"
; fuOptions : DWORD -> "sptr"
; lprc : RECT* optional -> "sptr"
; psa : SCRIPT_ANALYSIS* -> "sptr"
; pwcReserved : LPCWSTR optional -> "sptr"
; iReserved : INT optional -> "sptr"
; pwGlyphs : WORD* -> "sptr"
; cGlyphs : INT -> "sptr"
; piAdvance : INT* -> "sptr"
; piJustify : INT* optional -> "sptr"
; pGoffset : GOFFSET* -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "USP10.dll"
#cfunc global ScriptTextOut "ScriptTextOut" sptr, sptr, int, int, int, var, var, wstr, int, var, int, var, var, var
; res = ScriptTextOut(hdc, psc, x, y, fuOptions, lprc, psa, pwcReserved, iReserved, pwGlyphs, cGlyphs, piAdvance, piJustify, pGoffset)
; hdc : HDC -> "sptr"
; psc : void** in/out -> "sptr"
; x : INT -> "int"
; y : INT -> "int"
; fuOptions : DWORD -> "int"
; lprc : RECT* optional -> "var"
; psa : SCRIPT_ANALYSIS* -> "var"
; pwcReserved : LPCWSTR optional -> "wstr"
; iReserved : INT optional -> "int"
; pwGlyphs : WORD* -> "var"
; cGlyphs : INT -> "int"
; piAdvance : INT* -> "var"
; piJustify : INT* optional -> "var"
; pGoffset : GOFFSET* -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; HRESULT ScriptTextOut(HDC hdc, void** psc, INT x, INT y, DWORD fuOptions, RECT* lprc, SCRIPT_ANALYSIS* psa, LPCWSTR pwcReserved, INT iReserved, WORD* pwGlyphs, INT cGlyphs, INT* piAdvance, INT* piJustify, GOFFSET* pGoffset)
#uselib "USP10.dll"
#cfunc global ScriptTextOut "ScriptTextOut" intptr, intptr, int, int, int, var, var, wstr, int, var, int, var, var, var
; res = ScriptTextOut(hdc, psc, x, y, fuOptions, lprc, psa, pwcReserved, iReserved, pwGlyphs, cGlyphs, piAdvance, piJustify, pGoffset)
; hdc : HDC -> "intptr"
; psc : void** in/out -> "intptr"
; x : INT -> "int"
; y : INT -> "int"
; fuOptions : DWORD -> "int"
; lprc : RECT* optional -> "var"
; psa : SCRIPT_ANALYSIS* -> "var"
; pwcReserved : LPCWSTR optional -> "wstr"
; iReserved : INT optional -> "int"
; pwGlyphs : WORD* -> "var"
; cGlyphs : INT -> "int"
; piAdvance : INT* -> "var"
; piJustify : INT* optional -> "var"
; pGoffset : GOFFSET* -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	usp10 = windows.NewLazySystemDLL("USP10.dll")
	procScriptTextOut = usp10.NewProc("ScriptTextOut")
)

// hdc (HDC), psc (void** in/out), x (INT), y (INT), fuOptions (DWORD), lprc (RECT* optional), psa (SCRIPT_ANALYSIS*), pwcReserved (LPCWSTR optional), iReserved (INT optional), pwGlyphs (WORD*), cGlyphs (INT), piAdvance (INT*), piJustify (INT* optional), pGoffset (GOFFSET*)
r1, _, err := procScriptTextOut.Call(
	uintptr(hdc),
	uintptr(psc),
	uintptr(x),
	uintptr(y),
	uintptr(fuOptions),
	uintptr(lprc),
	uintptr(psa),
	uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(pwcReserved))),
	uintptr(iReserved),
	uintptr(pwGlyphs),
	uintptr(cGlyphs),
	uintptr(piAdvance),
	uintptr(piJustify),
	uintptr(pGoffset),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // HRESULT
function ScriptTextOut(
  hdc: THandle;   // HDC
  psc: Pointer;   // void** in/out
  x: Integer;   // INT
  y: Integer;   // INT
  fuOptions: DWORD;   // DWORD
  lprc: Pointer;   // RECT* optional
  psa: Pointer;   // SCRIPT_ANALYSIS*
  pwcReserved: PWideChar;   // LPCWSTR optional
  iReserved: Integer;   // INT optional
  pwGlyphs: Pointer;   // WORD*
  cGlyphs: Integer;   // INT
  piAdvance: Pointer;   // INT*
  piJustify: Pointer;   // INT* optional
  pGoffset: Pointer   // GOFFSET*
): Integer; stdcall;
  external 'USP10.dll' name 'ScriptTextOut';
result := DllCall("USP10\ScriptTextOut"
    , "Ptr", hdc   ; HDC
    , "Ptr", psc   ; void** in/out
    , "Int", x   ; INT
    , "Int", y   ; INT
    , "UInt", fuOptions   ; DWORD
    , "Ptr", lprc   ; RECT* optional
    , "Ptr", psa   ; SCRIPT_ANALYSIS*
    , "WStr", pwcReserved   ; LPCWSTR optional
    , "Int", iReserved   ; INT optional
    , "Ptr", pwGlyphs   ; WORD*
    , "Int", cGlyphs   ; INT
    , "Ptr", piAdvance   ; INT*
    , "Ptr", piJustify   ; INT* optional
    , "Ptr", pGoffset   ; GOFFSET*
    , "Int")   ; return: HRESULT
●ScriptTextOut(hdc, psc, x, y, fuOptions, lprc, psa, pwcReserved, iReserved, pwGlyphs, cGlyphs, piAdvance, piJustify, pGoffset) = DLL("USP10.dll", "int ScriptTextOut(void*, void*, int, int, dword, void*, void*, char*, int, void*, int, void*, void*, void*)")
# 呼び出し: ScriptTextOut(hdc, psc, x, y, fuOptions, lprc, psa, pwcReserved, iReserved, pwGlyphs, cGlyphs, piAdvance, piJustify, pGoffset)
# hdc : HDC -> "void*"
# psc : void** in/out -> "void*"
# x : INT -> "int"
# y : INT -> "int"
# fuOptions : DWORD -> "dword"
# lprc : RECT* optional -> "void*"
# psa : SCRIPT_ANALYSIS* -> "void*"
# pwcReserved : LPCWSTR optional -> "char*"
# iReserved : INT optional -> "int"
# pwGlyphs : WORD* -> "void*"
# cGlyphs : INT -> "int"
# piAdvance : INT* -> "void*"
# piJustify : INT* optional -> "void*"
# pGoffset : GOFFSET* -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。