ホーム › Graphics.DirectWrite › DWRITE_GLYPH_RUN
DWRITE_GLYPH_RUN
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| fontFace | IDWriteFontFace* | 8/4 | +0 | +0 | 描画に用いるフォントフェイスを表すIDWriteFontFaceインターフェイスへのポインタ。 |
| fontEmSize | FLOAT | 4 | +8 | +4 | 論理単位(DIP)で表したフォントのemサイズ(文字サイズ)。 |
| glyphCount | DWORD | 4 | +12 | +8 | このグリフランに含まれるグリフの個数。 |
| glyphIndices | WORD* | 8/4 | +16 | +12 | 描画する各グリフのインデックス番号の配列へのポインタ。 |
| glyphAdvances | FLOAT* | 8/4 | +24 | +16 | 各グリフの送り幅(advance)の配列へのポインタ。NULL可。 |
| glyphOffsets | DWRITE_GLYPH_OFFSET* | 8/4 | +32 | +20 | 各グリフのオフセット(垂直・水平のずれ)の配列へのポインタ。NULL可。 |
| isSideways | BOOL | 4 | +40 | +24 | グリフを90度回転させ縦書き状に描画するかを示すブール値。 |
| bidiLevel | DWORD | 4 | +44 | +28 | 双方向(BiDi)埋め込みレベル。偶数は左から右、奇数は右から左を表す。 |
各言語での定義
#include <windows.h>
// DWRITE_GLYPH_RUN (x64 48 / x86 32 バイト)
typedef struct DWRITE_GLYPH_RUN {
IDWriteFontFace* fontFace;
FLOAT fontEmSize;
DWORD glyphCount;
WORD* glyphIndices;
FLOAT* glyphAdvances;
DWRITE_GLYPH_OFFSET* glyphOffsets;
BOOL isSideways;
DWORD bidiLevel;
} DWRITE_GLYPH_RUN;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct DWRITE_GLYPH_RUN
{
public IntPtr fontFace;
public float fontEmSize;
public uint glyphCount;
public IntPtr glyphIndices;
public IntPtr glyphAdvances;
public IntPtr glyphOffsets;
[MarshalAs(UnmanagedType.Bool)] public bool isSideways;
public uint bidiLevel;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure DWRITE_GLYPH_RUN
Public fontFace As IntPtr
Public fontEmSize As Single
Public glyphCount As UInteger
Public glyphIndices As IntPtr
Public glyphAdvances As IntPtr
Public glyphOffsets As IntPtr
<MarshalAs(UnmanagedType.Bool)> Public isSideways As Boolean
Public bidiLevel As UInteger
End Structureimport ctypes
from ctypes import wintypes
class DWRITE_GLYPH_RUN(ctypes.Structure):
_fields_ = [
("fontFace", ctypes.c_void_p),
("fontEmSize", ctypes.c_float),
("glyphCount", wintypes.DWORD),
("glyphIndices", ctypes.c_void_p),
("glyphAdvances", ctypes.c_void_p),
("glyphOffsets", ctypes.c_void_p),
("isSideways", wintypes.BOOL),
("bidiLevel", wintypes.DWORD),
]#[repr(C)]
pub struct DWRITE_GLYPH_RUN {
pub fontFace: *mut core::ffi::c_void,
pub fontEmSize: f32,
pub glyphCount: u32,
pub glyphIndices: *mut core::ffi::c_void,
pub glyphAdvances: *mut core::ffi::c_void,
pub glyphOffsets: *mut core::ffi::c_void,
pub isSideways: i32,
pub bidiLevel: u32,
}import "golang.org/x/sys/windows"
type DWRITE_GLYPH_RUN struct {
fontFace uintptr
fontEmSize float32
glyphCount uint32
glyphIndices uintptr
glyphAdvances uintptr
glyphOffsets uintptr
isSideways int32
bidiLevel uint32
}type
DWRITE_GLYPH_RUN = record
fontFace: Pointer;
fontEmSize: Single;
glyphCount: DWORD;
glyphIndices: Pointer;
glyphAdvances: Pointer;
glyphOffsets: Pointer;
isSideways: BOOL;
bidiLevel: DWORD;
end;const DWRITE_GLYPH_RUN = extern struct {
fontFace: ?*anyopaque,
fontEmSize: f32,
glyphCount: u32,
glyphIndices: ?*anyopaque,
glyphAdvances: ?*anyopaque,
glyphOffsets: ?*anyopaque,
isSideways: i32,
bidiLevel: u32,
};type
DWRITE_GLYPH_RUN {.bycopy.} = object
fontFace: pointer
fontEmSize: float32
glyphCount: uint32
glyphIndices: pointer
glyphAdvances: pointer
glyphOffsets: pointer
isSideways: int32
bidiLevel: uint32struct DWRITE_GLYPH_RUN
{
void* fontFace;
float fontEmSize;
uint glyphCount;
void* glyphIndices;
void* glyphAdvances;
void* glyphOffsets;
int isSideways;
uint bidiLevel;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; DWRITE_GLYPH_RUN サイズ: 32 バイト(x86)
dim st, 8 ; 4byte整数×8(構造体サイズ 32 / 4 切り上げ)
; fontFace : IDWriteFontFace* (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; fontEmSize : FLOAT (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; glyphCount : DWORD (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; glyphIndices : WORD* (+12, 4byte) st.3 = 値 / 値 = st.3 (lpoke/lpeek も可)
; glyphAdvances : FLOAT* (+16, 4byte) st.4 = 値 / 値 = st.4 (lpoke/lpeek も可)
; glyphOffsets : DWRITE_GLYPH_OFFSET* (+20, 4byte) varptr(st)+20 を基点に操作(4byte:入れ子/配列)
; isSideways : BOOL (+24, 4byte) st.6 = 値 / 値 = st.6 (lpoke/lpeek も可)
; bidiLevel : DWORD (+28, 4byte) st.7 = 値 / 値 = st.7 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; DWRITE_GLYPH_RUN サイズ: 48 バイト(x64)
dim st, 12 ; 4byte整数×12(構造体サイズ 48 / 4 切り上げ)
; fontFace : IDWriteFontFace* (+0, 8byte) qpoke st,0,値 / qpeek(st,0) ※IronHSPのみ。3.7/3.8は lpoke st,0,下位 : lpoke st,4,上位
; fontEmSize : FLOAT (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; glyphCount : DWORD (+12, 4byte) st.3 = 値 / 値 = st.3 (lpoke/lpeek も可)
; glyphIndices : WORD* (+16, 8byte) qpoke st,16,値 / qpeek(st,16) ※IronHSPのみ。3.7/3.8は lpoke st,16,下位 : lpoke st,20,上位
; glyphAdvances : FLOAT* (+24, 8byte) qpoke st,24,値 / qpeek(st,24) ※IronHSPのみ。3.7/3.8は lpoke st,24,下位 : lpoke st,28,上位
; glyphOffsets : DWRITE_GLYPH_OFFSET* (+32, 8byte) varptr(st)+32 を基点に操作(8byte:入れ子/配列)
; isSideways : BOOL (+40, 4byte) st.10 = 値 / 値 = st.10 (lpoke/lpeek も可)
; bidiLevel : DWORD (+44, 4byte) st.11 = 値 / 値 = st.11 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global DWRITE_GLYPH_RUN
#field intptr fontFace
#field float fontEmSize
#field int glyphCount
#field intptr glyphIndices
#field intptr glyphAdvances
#field intptr glyphOffsets
#field bool isSideways
#field int bidiLevel
#endstruct
stdim st, DWRITE_GLYPH_RUN ; NSTRUCT 変数を確保
st->fontEmSize = 100
mes "fontEmSize=" + st->fontEmSize