ホーム › Globalization › ScriptString_pcOutChars
ScriptString_pcOutChars
関数解析済み文字列の出力文字数へのポインタを取得する。
シグネチャ
// USP10.dll
#include <windows.h>
INT* ScriptString_pcOutChars(
void* ssa
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| ssa | void* | in | 文字列に対する SCRIPT_STRING_ANALYSIS 構造体です。 |
戻り値の型: INT*
公式ドキュメント
クリッピング後の文字列の長さへのポインターを返します。
戻り値
成功した場合、クリッピング後の文字列の長さへのポインターを返します。長さは Unicode コードポイントの数です。成功しなかった場合、この関数は NULL を返します。
解説(Remarks)
この関数を使用するには、アプリケーションが ScriptStringAnalyse の最初の呼び出しで SSA_CLIP を指定する必要があります。
この関数が返すポインターは、アプリケーションが関連付けられた 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>
INT* ScriptString_pcOutChars(
void* ssa
);[DllImport("USP10.dll", ExactSpelling = true)]
static extern IntPtr ScriptString_pcOutChars(
IntPtr ssa // void*
);<DllImport("USP10.dll", ExactSpelling:=True)>
Public Shared Function ScriptString_pcOutChars(
ssa As IntPtr ' void*
) As IntPtr
End Function' ssa : void*
Declare PtrSafe Function ScriptString_pcOutChars 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_pcOutChars = ctypes.windll.usp10.ScriptString_pcOutChars
ScriptString_pcOutChars.restype = ctypes.c_void_p
ScriptString_pcOutChars.argtypes = [
ctypes.POINTER(None), # ssa : void*
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('USP10.dll')
ScriptString_pcOutChars = Fiddle::Function.new(
lib['ScriptString_pcOutChars'],
[
Fiddle::TYPE_VOIDP, # ssa : void*
],
Fiddle::TYPE_VOIDP)#[link(name = "usp10")]
extern "system" {
fn ScriptString_pcOutChars(
ssa: *mut () // void*
) -> *mut i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("USP10.dll")]
public static extern IntPtr ScriptString_pcOutChars(IntPtr ssa);
"@
$api = Add-Type -MemberDefinition $sig -Name 'USP10_ScriptString_pcOutChars' -Namespace Win32 -PassThru
# $api::ScriptString_pcOutChars(ssa)#uselib "USP10.dll"
#func global ScriptString_pcOutChars "ScriptString_pcOutChars" sptr
; ScriptString_pcOutChars ssa ; 戻り値は stat
; ssa : void* -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "USP10.dll"
#cfunc global ScriptString_pcOutChars "ScriptString_pcOutChars" sptr
; res = ScriptString_pcOutChars(ssa)
; ssa : void* -> "sptr"; INT* ScriptString_pcOutChars(void* ssa)
#uselib "USP10.dll"
#cfunc global ScriptString_pcOutChars "ScriptString_pcOutChars" intptr
; res = ScriptString_pcOutChars(ssa)
; ssa : void* -> "intptr"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
usp10 = windows.NewLazySystemDLL("USP10.dll")
procScriptString_pcOutChars = usp10.NewProc("ScriptString_pcOutChars")
)
// ssa (void*)
r1, _, err := procScriptString_pcOutChars.Call(
uintptr(ssa),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // INT*function ScriptString_pcOutChars(
ssa: Pointer // void*
): Pointer; stdcall;
external 'USP10.dll' name 'ScriptString_pcOutChars';result := DllCall("USP10\ScriptString_pcOutChars"
, "Ptr", ssa ; void*
, "Ptr") ; return: INT*●ScriptString_pcOutChars(ssa) = DLL("USP10.dll", "void* ScriptString_pcOutChars(void*)")
# 呼び出し: ScriptString_pcOutChars(ssa)
# ssa : void* -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。const std = @import("std");
extern "usp10" fn ScriptString_pcOutChars(
ssa: ?*anyopaque // void*
) callconv(std.os.windows.WINAPI) [*c]i32;proc ScriptString_pcOutChars(
ssa: pointer # void*
): ptr int32 {.importc: "ScriptString_pcOutChars", stdcall, dynlib: "USP10.dll".}pragma(lib, "usp10");
extern(Windows)
int* ScriptString_pcOutChars(
void* ssa // void*
);ccall((:ScriptString_pcOutChars, "USP10.dll"), stdcall, Ptr{Int32},
(Ptr{Cvoid},),
ssa)
# ssa : void* -> Ptr{Cvoid}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。local ffi = require("ffi")
ffi.cdef[[
int32_t* ScriptString_pcOutChars(
void* ssa);
]]
local usp10 = ffi.load("usp10")
-- usp10.ScriptString_pcOutChars(ssa)
-- ssa : void*
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('USP10.dll');
const ScriptString_pcOutChars = lib.func('__stdcall', 'ScriptString_pcOutChars', 'int32_t *', ['void *']);
// ScriptString_pcOutChars(ssa)
// ssa : void* -> 'void *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("USP10.dll", {
ScriptString_pcOutChars: { parameters: ["pointer"], result: "pointer" },
});
// lib.symbols.ScriptString_pcOutChars(ssa)
// ssa : void* -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
int32_t* ScriptString_pcOutChars(
void* ssa);
C, "USP10.dll");
// $ffi->ScriptString_pcOutChars(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_pcOutChars(
Pointer ssa // void*
);
}@[Link("usp10")]
lib LibUSP10
fun ScriptString_pcOutChars = ScriptString_pcOutChars(
ssa : Void* # void*
) : Int32*
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef ScriptString_pcOutCharsNative = Pointer<Int32> Function(Pointer<Void>);
typedef ScriptString_pcOutCharsDart = Pointer<Int32> Function(Pointer<Void>);
final ScriptString_pcOutChars = DynamicLibrary.open('USP10.dll')
.lookupFunction<ScriptString_pcOutCharsNative, ScriptString_pcOutCharsDart>('ScriptString_pcOutChars');
// ssa : void* -> Pointer<Void>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function ScriptString_pcOutChars(
ssa: Pointer // void*
): Pointer; stdcall;
external 'USP10.dll' name 'ScriptString_pcOutChars';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "ScriptString_pcOutChars"
c_ScriptString_pcOutChars :: Ptr () -> IO (Ptr Int32)
-- ssa : void* -> Ptr ()
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let scriptstring_pcoutchars =
foreign "ScriptString_pcOutChars"
((ptr void) @-> returning (ptr int32_t))
(* 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_pcOutChars" script-string-pc-out-chars :convention :stdcall) :pointer
(ssa :pointer)) ; void*
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $ScriptString_pcOutChars = Win32::API::More->new('USP10',
'LPVOID ScriptString_pcOutChars(LPVOID ssa)');
# my $ret = $ScriptString_pcOutChars->Call($ssa);
# ssa : void* -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。関連項目
公式の関連項目
- f ScriptStringAnalyse — 文字列を解析し描画用の状態オブジェクトを生成する。
- f ScriptStringFree — ScriptStringAnalyseの状態オブジェクトを解放する。