ホーム › Devices.Display › GLYPHDATA
GLYPHDATA
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| gdf | GLYPHDEF | 8/4 | +0 | +0 | グリフ定義(GLYPHDEF)。ビットマップまたはアウトライン。 |
| hg | DWORD | 4 | +8 | +4 | グリフハンドル(グリフインデックス)。 |
| fxD | INT | 4 | +12 | +8 | 文字送り幅D(固定小数点)。 |
| fxA | INT | 4 | +16 | +12 | 左サイドベアリングA(固定小数点)。 |
| fxAB | INT | 4 | +20 | +16 | AとBの合計幅(ブラックボックス幅、固定小数点)。 |
| fxInkTop | INT | 4 | +24 | +20 | インク領域の上端(固定小数点)。 |
| fxInkBottom | INT | 4 | +28 | +24 | インク領域の下端(固定小数点)。 |
| rclInk | RECTL | 16 | +32 | +28 | インク(描画)領域の矩形(RECTL)。 |
| ptqD | POINTQF | 16 | +48 | +48 | 送り幅ベクトル(POINTQF、高精度)。 |
各言語での定義
#include <windows.h>
// GLYPHDEF (x64 8 / x86 4 バイト)
typedef struct GLYPHDEF {
GLYPHBITS* pgb;
PATHOBJ* ppo;
} GLYPHDEF;
// RECTL (x64 16 / x86 16 バイト)
typedef struct RECTL {
INT left;
INT top;
INT right;
INT bottom;
} RECTL;
// POINTQF (x64 16 / x86 16 バイト)
typedef struct POINTQF {
LONGLONG x;
LONGLONG y;
} POINTQF;
// GLYPHDATA (x64 64 / x86 64 バイト)
typedef struct GLYPHDATA {
GLYPHDEF gdf;
DWORD hg;
INT fxD;
INT fxA;
INT fxAB;
INT fxInkTop;
INT fxInkBottom;
RECTL rclInk;
POINTQF ptqD;
} GLYPHDATA;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct GLYPHDEF
{
public IntPtr pgb;
public IntPtr ppo;
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct RECTL
{
public int left;
public int top;
public int right;
public int bottom;
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct POINTQF
{
public long x;
public long y;
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct GLYPHDATA
{
public GLYPHDEF gdf;
public uint hg;
public int fxD;
public int fxA;
public int fxAB;
public int fxInkTop;
public int fxInkBottom;
public RECTL rclInk;
public POINTQF ptqD;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure GLYPHDEF
Public pgb As IntPtr
Public ppo As IntPtr
End Structure
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure RECTL
Public left As Integer
Public top As Integer
Public right As Integer
Public bottom As Integer
End Structure
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure POINTQF
Public x As Long
Public y As Long
End Structure
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure GLYPHDATA
Public gdf As GLYPHDEF
Public hg As UInteger
Public fxD As Integer
Public fxA As Integer
Public fxAB As Integer
Public fxInkTop As Integer
Public fxInkBottom As Integer
Public rclInk As RECTL
Public ptqD As POINTQF
End Structureimport ctypes
from ctypes import wintypes
class GLYPHDEF(ctypes.Structure):
_fields_ = [
("pgb", ctypes.c_void_p),
("ppo", ctypes.c_void_p),
]
class RECTL(ctypes.Structure):
_fields_ = [
("left", ctypes.c_int),
("top", ctypes.c_int),
("right", ctypes.c_int),
("bottom", ctypes.c_int),
]
class POINTQF(ctypes.Structure):
_fields_ = [
("x", ctypes.c_longlong),
("y", ctypes.c_longlong),
]
class GLYPHDATA(ctypes.Structure):
_fields_ = [
("gdf", GLYPHDEF),
("hg", wintypes.DWORD),
("fxD", ctypes.c_int),
("fxA", ctypes.c_int),
("fxAB", ctypes.c_int),
("fxInkTop", ctypes.c_int),
("fxInkBottom", ctypes.c_int),
("rclInk", RECTL),
("ptqD", POINTQF),
]#[repr(C)]
pub struct GLYPHDEF {
pub pgb: *mut core::ffi::c_void,
pub ppo: *mut core::ffi::c_void,
}
#[repr(C)]
pub struct RECTL {
pub left: i32,
pub top: i32,
pub right: i32,
pub bottom: i32,
}
#[repr(C)]
pub struct POINTQF {
pub x: i64,
pub y: i64,
}
#[repr(C)]
pub struct GLYPHDATA {
pub gdf: GLYPHDEF,
pub hg: u32,
pub fxD: i32,
pub fxA: i32,
pub fxAB: i32,
pub fxInkTop: i32,
pub fxInkBottom: i32,
pub rclInk: RECTL,
pub ptqD: POINTQF,
}import "golang.org/x/sys/windows"
type GLYPHDEF struct {
pgb uintptr
ppo uintptr
}
type RECTL struct {
left int32
top int32
right int32
bottom int32
}
type POINTQF struct {
x int64
y int64
}
type GLYPHDATA struct {
gdf GLYPHDEF
hg uint32
fxD int32
fxA int32
fxAB int32
fxInkTop int32
fxInkBottom int32
rclInk RECTL
ptqD POINTQF
}type
GLYPHDEF = record
pgb: Pointer;
ppo: Pointer;
end;
RECTL = record
left: Integer;
top: Integer;
right: Integer;
bottom: Integer;
end;
POINTQF = record
x: Int64;
y: Int64;
end;
GLYPHDATA = record
gdf: GLYPHDEF;
hg: DWORD;
fxD: Integer;
fxA: Integer;
fxAB: Integer;
fxInkTop: Integer;
fxInkBottom: Integer;
rclInk: RECTL;
ptqD: POINTQF;
end;const GLYPHDEF = extern struct {
pgb: ?*anyopaque,
ppo: ?*anyopaque,
};
const RECTL = extern struct {
left: i32,
top: i32,
right: i32,
bottom: i32,
};
const POINTQF = extern struct {
x: i64,
y: i64,
};
const GLYPHDATA = extern struct {
gdf: GLYPHDEF,
hg: u32,
fxD: i32,
fxA: i32,
fxAB: i32,
fxInkTop: i32,
fxInkBottom: i32,
rclInk: RECTL,
ptqD: POINTQF,
};type
GLYPHDEF {.bycopy.} = object
pgb: pointer
ppo: pointer
RECTL {.bycopy.} = object
left: int32
top: int32
right: int32
bottom: int32
POINTQF {.bycopy.} = object
x: int64
y: int64
GLYPHDATA {.bycopy.} = object
gdf: GLYPHDEF
hg: uint32
fxD: int32
fxA: int32
fxAB: int32
fxInkTop: int32
fxInkBottom: int32
rclInk: RECTL
ptqD: POINTQFstruct GLYPHDEF
{
void* pgb;
void* ppo;
}
struct RECTL
{
int left;
int top;
int right;
int bottom;
}
struct POINTQF
{
long x;
long y;
}
struct GLYPHDATA
{
GLYPHDEF gdf;
uint hg;
int fxD;
int fxA;
int fxAB;
int fxInkTop;
int fxInkBottom;
RECTL rclInk;
POINTQF ptqD;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; GLYPHDATA サイズ: 64 バイト(x86)
dim st, 16 ; 4byte整数×16(構造体サイズ 64 / 4 切り上げ)
; gdf : GLYPHDEF (+0, 4byte) varptr(st)+0 を基点に操作(4byte:入れ子/配列)
; hg : DWORD (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; fxD : INT (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; fxA : INT (+12, 4byte) st.3 = 値 / 値 = st.3 (lpoke/lpeek も可)
; fxAB : INT (+16, 4byte) st.4 = 値 / 値 = st.4 (lpoke/lpeek も可)
; fxInkTop : INT (+20, 4byte) st.5 = 値 / 値 = st.5 (lpoke/lpeek も可)
; fxInkBottom : INT (+24, 4byte) st.6 = 値 / 値 = st.6 (lpoke/lpeek も可)
; rclInk : RECTL (+28, 16byte) varptr(st)+28 を基点に操作(16byte:入れ子/配列)
; ptqD : POINTQF (+48, 16byte) varptr(st)+48 を基点に操作(16byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; GLYPHDATA サイズ: 64 バイト(x64)
dim st, 16 ; 4byte整数×16(構造体サイズ 64 / 4 切り上げ)
; gdf : GLYPHDEF (+0, 8byte) varptr(st)+0 を基点に操作(8byte:入れ子/配列)
; hg : DWORD (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; fxD : INT (+12, 4byte) st.3 = 値 / 値 = st.3 (lpoke/lpeek も可)
; fxA : INT (+16, 4byte) st.4 = 値 / 値 = st.4 (lpoke/lpeek も可)
; fxAB : INT (+20, 4byte) st.5 = 値 / 値 = st.5 (lpoke/lpeek も可)
; fxInkTop : INT (+24, 4byte) st.6 = 値 / 値 = st.6 (lpoke/lpeek も可)
; fxInkBottom : INT (+28, 4byte) st.7 = 値 / 値 = st.7 (lpoke/lpeek も可)
; rclInk : RECTL (+32, 16byte) varptr(st)+32 を基点に操作(16byte:入れ子/配列)
; ptqD : POINTQF (+48, 16byte) varptr(st)+48 を基点に操作(16byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global RECTL
#field int left
#field int top
#field int right
#field int bottom
#endstruct
#defstruct global POINTQF
#field int64 x
#field int64 y
#endstruct
#defstruct global GLYPHDATA
#field byte gdf 8
#field int hg
#field int fxD
#field int fxA
#field int fxAB
#field int fxInkTop
#field int fxInkBottom
#field RECTL rclInk
#field POINTQF ptqD
#endstruct
stdim st, GLYPHDATA ; NSTRUCT 変数を確保
st->hg = 100
mes "hg=" + st->hg
; ※union フィールドは byte 列で確保(NSTRUCT は union 非対応)。必要に応じ手動でアクセス。