ホーム › Graphics.DirectWrite › DWRITE_GLYPH_METRICS
DWRITE_GLYPH_METRICS
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| leftSideBearing | INT | 4 | +0 | +0 | グリフ原点から黒部分左端までの距離をデザイン単位で示す。 |
| advanceWidth | DWORD | 4 | +4 | +4 | グリフの送り幅をデザイン単位で示す。 |
| rightSideBearing | INT | 4 | +8 | +8 | グリフ黒部分右端から送り幅右端までの距離をデザイン単位で示す。 |
| topSideBearing | INT | 4 | +12 | +12 | 垂直方向の上端余白をデザイン単位で示す。 |
| advanceHeight | DWORD | 4 | +16 | +16 | 縦書き時のグリフの送り高さをデザイン単位で示す。 |
| bottomSideBearing | INT | 4 | +20 | +20 | 垂直方向の下端余白をデザイン単位で示す。 |
| verticalOriginY | INT | 4 | +24 | +24 | 縦書き時のグリフ原点のY座標をデザイン単位で示す。 |
各言語での定義
#include <windows.h>
// DWRITE_GLYPH_METRICS (x64 28 / x86 28 バイト)
typedef struct DWRITE_GLYPH_METRICS {
INT leftSideBearing;
DWORD advanceWidth;
INT rightSideBearing;
INT topSideBearing;
DWORD advanceHeight;
INT bottomSideBearing;
INT verticalOriginY;
} DWRITE_GLYPH_METRICS;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct DWRITE_GLYPH_METRICS
{
public int leftSideBearing;
public uint advanceWidth;
public int rightSideBearing;
public int topSideBearing;
public uint advanceHeight;
public int bottomSideBearing;
public int verticalOriginY;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure DWRITE_GLYPH_METRICS
Public leftSideBearing As Integer
Public advanceWidth As UInteger
Public rightSideBearing As Integer
Public topSideBearing As Integer
Public advanceHeight As UInteger
Public bottomSideBearing As Integer
Public verticalOriginY As Integer
End Structureimport ctypes
from ctypes import wintypes
class DWRITE_GLYPH_METRICS(ctypes.Structure):
_fields_ = [
("leftSideBearing", ctypes.c_int),
("advanceWidth", wintypes.DWORD),
("rightSideBearing", ctypes.c_int),
("topSideBearing", ctypes.c_int),
("advanceHeight", wintypes.DWORD),
("bottomSideBearing", ctypes.c_int),
("verticalOriginY", ctypes.c_int),
]#[repr(C)]
pub struct DWRITE_GLYPH_METRICS {
pub leftSideBearing: i32,
pub advanceWidth: u32,
pub rightSideBearing: i32,
pub topSideBearing: i32,
pub advanceHeight: u32,
pub bottomSideBearing: i32,
pub verticalOriginY: i32,
}import "golang.org/x/sys/windows"
type DWRITE_GLYPH_METRICS struct {
leftSideBearing int32
advanceWidth uint32
rightSideBearing int32
topSideBearing int32
advanceHeight uint32
bottomSideBearing int32
verticalOriginY int32
}type
DWRITE_GLYPH_METRICS = record
leftSideBearing: Integer;
advanceWidth: DWORD;
rightSideBearing: Integer;
topSideBearing: Integer;
advanceHeight: DWORD;
bottomSideBearing: Integer;
verticalOriginY: Integer;
end;const DWRITE_GLYPH_METRICS = extern struct {
leftSideBearing: i32,
advanceWidth: u32,
rightSideBearing: i32,
topSideBearing: i32,
advanceHeight: u32,
bottomSideBearing: i32,
verticalOriginY: i32,
};type
DWRITE_GLYPH_METRICS {.bycopy.} = object
leftSideBearing: int32
advanceWidth: uint32
rightSideBearing: int32
topSideBearing: int32
advanceHeight: uint32
bottomSideBearing: int32
verticalOriginY: int32struct DWRITE_GLYPH_METRICS
{
int leftSideBearing;
uint advanceWidth;
int rightSideBearing;
int topSideBearing;
uint advanceHeight;
int bottomSideBearing;
int verticalOriginY;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; DWRITE_GLYPH_METRICS サイズ: 28 バイト(x64)
dim st, 7 ; 4byte整数×7(構造体サイズ 28 / 4 切り上げ)
; leftSideBearing : INT (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; advanceWidth : DWORD (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; rightSideBearing : INT (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; topSideBearing : INT (+12, 4byte) st.3 = 値 / 値 = st.3 (lpoke/lpeek も可)
; advanceHeight : DWORD (+16, 4byte) st.4 = 値 / 値 = st.4 (lpoke/lpeek も可)
; bottomSideBearing : INT (+20, 4byte) st.5 = 値 / 値 = st.5 (lpoke/lpeek も可)
; verticalOriginY : INT (+24, 4byte) st.6 = 値 / 値 = st.6 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global DWRITE_GLYPH_METRICS
#field int leftSideBearing
#field int advanceWidth
#field int rightSideBearing
#field int topSideBearing
#field int advanceHeight
#field int bottomSideBearing
#field int verticalOriginY
#endstruct
stdim st, DWRITE_GLYPH_METRICS ; NSTRUCT 変数を確保
st->leftSideBearing = 100
mes "leftSideBearing=" + st->leftSideBearing