ホーム › Devices.Display › FD_KERNINGPAIR
FD_KERNINGPAIR
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| wcFirst | WCHAR | 2 | +0 | +0 | カーニング対象の1文字目(Unicode)。終端は0。 |
| wcSecond | WCHAR | 2 | +2 | +2 | カーニング対象の2文字目(Unicode)。 |
| fwdKern | SHORT | 2 | +4 | +4 | 2文字間のカーニング量(設計単位、符号付き)。 |
各言語での定義
#include <windows.h>
// FD_KERNINGPAIR (x64 6 / x86 6 バイト)
typedef struct FD_KERNINGPAIR {
WCHAR wcFirst;
WCHAR wcSecond;
SHORT fwdKern;
} FD_KERNINGPAIR;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct FD_KERNINGPAIR
{
public char wcFirst;
public char wcSecond;
public short fwdKern;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure FD_KERNINGPAIR
Public wcFirst As Char
Public wcSecond As Char
Public fwdKern As Short
End Structureimport ctypes
from ctypes import wintypes
class FD_KERNINGPAIR(ctypes.Structure):
_fields_ = [
("wcFirst", ctypes.c_wchar),
("wcSecond", ctypes.c_wchar),
("fwdKern", ctypes.c_short),
]#[repr(C)]
pub struct FD_KERNINGPAIR {
pub wcFirst: u16,
pub wcSecond: u16,
pub fwdKern: i16,
}import "golang.org/x/sys/windows"
type FD_KERNINGPAIR struct {
wcFirst uint16
wcSecond uint16
fwdKern int16
}type
FD_KERNINGPAIR = record
wcFirst: WideChar;
wcSecond: WideChar;
fwdKern: Smallint;
end;const FD_KERNINGPAIR = extern struct {
wcFirst: u16,
wcSecond: u16,
fwdKern: i16,
};type
FD_KERNINGPAIR {.bycopy.} = object
wcFirst: uint16
wcSecond: uint16
fwdKern: int16struct FD_KERNINGPAIR
{
wchar wcFirst;
wchar wcSecond;
short fwdKern;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; FD_KERNINGPAIR サイズ: 6 バイト(x64)
dim st, 2 ; 4byte整数×2(構造体サイズ 6 / 4 切り上げ)
; wcFirst : WCHAR (+0, 2byte) wpoke st,0,値 / 値 = wpeek(st,0)
; wcSecond : WCHAR (+2, 2byte) wpoke st,2,値 / 値 = wpeek(st,2)
; fwdKern : SHORT (+4, 2byte) wpoke st,4,値 / 値 = wpeek(st,4)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global FD_KERNINGPAIR
#field short wcFirst
#field short wcSecond
#field short fwdKern
#endstruct
stdim st, FD_KERNINGPAIR ; NSTRUCT 変数を確保
st->wcFirst = 100
mes "wcFirst=" + st->wcFirst