ホーム › Globalization › ScriptString_pSize
ScriptString_pSize
関数解析済み文字列の表示サイズへのポインタを取得する。
シグネチャ
// USP10.dll
#include <windows.h>
SIZE* ScriptString_pSize(
void* ssa
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| ssa | void* | in | 文字列の SCRIPT_STRING_ANALYSIS 構造体です。 |
戻り値の型: SIZE*
公式ドキュメント
解析済み文字列の SIZE 構造体へのポインターを返します。
戻り値
成功した場合、解析済み文字列のサイズ (幅と高さ) を格納した SIZE 構造体へのポインターを返します。失敗した場合は NULL を返します。
解説(Remarks)
この関数が返すサイズは、ScriptStringAnalyse で SSA_FIT フラグを設定して要求された両端揃え (justification) の効果を適用する前のサイズです。ScriptStringAnalyse の iReqWidth の値と ScriptString_pSize が返すサイズとの差が、両端揃えの効果に相当します。
この関数が返すポインターは、関連付けられた SCRIPT_STRING_ANALYSIS 構造体をアプリケーションが ScriptStringFree に渡すまでの間のみ有効です。
重要 Windows 8 以降: Windows 7 上で実行できるようにするには、Uniscribe を使用するモジュールはライブラリ一覧で gdi32.lib より前に Usp10.lib を指定する必要があります。
出典・ライセンス: 上記「公式ドキュメント」の内容は Microsoft の Win32 API ドキュメント(MicrosoftDocs/sdk-api)を日本語に翻訳・改変したものです。© Microsoft Corporation. CC BY 4.0 で提供。
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)
各言語での呼び出し定義
// USP10.dll
#include <windows.h>
SIZE* ScriptString_pSize(
void* ssa
);[DllImport("USP10.dll", ExactSpelling = true)]
static extern IntPtr ScriptString_pSize(
IntPtr ssa // void*
);<DllImport("USP10.dll", ExactSpelling:=True)>
Public Shared Function ScriptString_pSize(
ssa As IntPtr ' void*
) As IntPtr
End Function' ssa : void*
Declare PtrSafe Function ScriptString_pSize Lib "usp10" ( _
ByVal ssa As LongPtr) As LongPtr
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
ScriptString_pSize = ctypes.windll.usp10.ScriptString_pSize
ScriptString_pSize.restype = ctypes.c_void_p
ScriptString_pSize.argtypes = [
ctypes.POINTER(None), # ssa : void*
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('USP10.dll')
ScriptString_pSize = Fiddle::Function.new(
lib['ScriptString_pSize'],
[
Fiddle::TYPE_VOIDP, # ssa : void*
],
Fiddle::TYPE_VOIDP)#[link(name = "usp10")]
extern "system" {
fn ScriptString_pSize(
ssa: *mut () // void*
) -> *mut SIZE;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("USP10.dll")]
public static extern IntPtr ScriptString_pSize(IntPtr ssa);
"@
$api = Add-Type -MemberDefinition $sig -Name 'USP10_ScriptString_pSize' -Namespace Win32 -PassThru
# $api::ScriptString_pSize(ssa)#uselib "USP10.dll"
#func global ScriptString_pSize "ScriptString_pSize" sptr
; ScriptString_pSize ssa ; 戻り値は stat
; ssa : void* -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "USP10.dll"
#cfunc global ScriptString_pSize "ScriptString_pSize" sptr
; res = ScriptString_pSize(ssa)
; ssa : void* -> "sptr"; SIZE* ScriptString_pSize(void* ssa)
#uselib "USP10.dll"
#cfunc global ScriptString_pSize "ScriptString_pSize" intptr
; res = ScriptString_pSize(ssa)
; ssa : void* -> "intptr"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
usp10 = windows.NewLazySystemDLL("USP10.dll")
procScriptString_pSize = usp10.NewProc("ScriptString_pSize")
)
// ssa (void*)
r1, _, err := procScriptString_pSize.Call(
uintptr(ssa),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // SIZE*function ScriptString_pSize(
ssa: Pointer // void*
): Pointer; stdcall;
external 'USP10.dll' name 'ScriptString_pSize';result := DllCall("USP10\ScriptString_pSize"
, "Ptr", ssa ; void*
, "Ptr") ; return: SIZE*●ScriptString_pSize(ssa) = DLL("USP10.dll", "void* ScriptString_pSize(void*)")
# 呼び出し: ScriptString_pSize(ssa)
# ssa : void* -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。const std = @import("std");
extern "usp10" fn ScriptString_pSize(
ssa: ?*anyopaque // void*
) callconv(std.os.windows.WINAPI) [*c]SIZE;proc ScriptString_pSize(
ssa: pointer # void*
): ptr SIZE {.importc: "ScriptString_pSize", stdcall, dynlib: "USP10.dll".}pragma(lib, "usp10");
extern(Windows)
SIZE* ScriptString_pSize(
void* ssa // void*
);ccall((:ScriptString_pSize, "USP10.dll"), stdcall, Ptr{SIZE},
(Ptr{Cvoid},),
ssa)
# ssa : void* -> Ptr{Cvoid}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。local ffi = require("ffi")
ffi.cdef[[
void* ScriptString_pSize(
void* ssa);
]]
local usp10 = ffi.load("usp10")
-- usp10.ScriptString_pSize(ssa)
-- ssa : void*
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('USP10.dll');
const ScriptString_pSize = lib.func('__stdcall', 'ScriptString_pSize', 'void *', ['void *']);
// ScriptString_pSize(ssa)
// ssa : void* -> 'void *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("USP10.dll", {
ScriptString_pSize: { parameters: ["pointer"], result: "pointer" },
});
// lib.symbols.ScriptString_pSize(ssa)
// ssa : void* -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
void* ScriptString_pSize(
void* ssa);
C, "USP10.dll");
// $ffi->ScriptString_pSize(ssa);
// ssa : void*
// 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
// WINAPI(stdcall): x64 では呼出規約が統一されるため問題なし。x86 では __stdcall 対応のラッパが必要な場合あり。import com.sun.jna.*;
import com.sun.jna.ptr.*;
import com.sun.jna.win32.StdCallLibrary;
import com.sun.jna.win32.W32APIOptions;
public interface Usp10 extends StdCallLibrary {
Usp10 INSTANCE = Native.load("usp10", Usp10.class);
Pointer ScriptString_pSize(
Pointer ssa // void*
);
}@[Link("usp10")]
lib LibUSP10
fun ScriptString_pSize = ScriptString_pSize(
ssa : Void* # void*
) : SIZE*
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef ScriptString_pSizeNative = Pointer<Void> Function(Pointer<Void>);
typedef ScriptString_pSizeDart = Pointer<Void> Function(Pointer<Void>);
final ScriptString_pSize = DynamicLibrary.open('USP10.dll')
.lookupFunction<ScriptString_pSizeNative, ScriptString_pSizeDart>('ScriptString_pSize');
// ssa : void* -> Pointer<Void>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function ScriptString_pSize(
ssa: Pointer // void*
): Pointer; stdcall;
external 'USP10.dll' name 'ScriptString_pSize';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "ScriptString_pSize"
c_ScriptString_pSize :: Ptr () -> IO (Ptr ())
-- ssa : void* -> Ptr ()
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let scriptstring_psize =
foreign "ScriptString_pSize"
((ptr void) @-> returning (ptr void))
(* ssa : void* -> (ptr void) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library usp10 (t "USP10.dll"))
(cffi:use-foreign-library usp10)
(cffi:defcfun ("ScriptString_pSize" script-string-p-size :convention :stdcall) :pointer
(ssa :pointer)) ; void*
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $ScriptString_pSize = Win32::API::More->new('USP10',
'LPVOID ScriptString_pSize(LPVOID ssa)');
# my $ret = $ScriptString_pSize->Call($ssa);
# ssa : void* -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。関連項目
公式の関連項目
- f ScriptStringAnalyse — 文字列を解析し描画用の状態オブジェクトを生成する。
- f ScriptStringFree — ScriptStringAnalyseの状態オブジェクトを解放する。
使用する型