Win32 API 日本語リファレンス
ホームStorage.Xps › XPS_GLYPH_INDEX

XPS_GLYPH_INDEX

構造体
サイズx64: 16 バイト / x86: 16 バイト

サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。

フィールド

フィールドサイズx64x86説明
indexINT4+0+0フォント内のグリフインデックス。
advanceWidthFLOAT4+4+4グリフの送り幅を浮動小数点で示す。
horizontalOffsetFLOAT4+8+8グリフの水平方向オフセットを浮動小数点で示す。
verticalOffsetFLOAT4+12+12グリフの垂直方向オフセットを浮動小数点で示す。

各言語での定義

#include <windows.h>

// XPS_GLYPH_INDEX  (x64 16 / x86 16 バイト)
typedef struct XPS_GLYPH_INDEX {
    INT index;
    FLOAT advanceWidth;
    FLOAT horizontalOffset;
    FLOAT verticalOffset;
} XPS_GLYPH_INDEX;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct XPS_GLYPH_INDEX
{
    public int index;
    public float advanceWidth;
    public float horizontalOffset;
    public float verticalOffset;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure XPS_GLYPH_INDEX
    Public index As Integer
    Public advanceWidth As Single
    Public horizontalOffset As Single
    Public verticalOffset As Single
End Structure
import ctypes
from ctypes import wintypes

class XPS_GLYPH_INDEX(ctypes.Structure):
    _fields_ = [
        ("index", ctypes.c_int),
        ("advanceWidth", ctypes.c_float),
        ("horizontalOffset", ctypes.c_float),
        ("verticalOffset", ctypes.c_float),
    ]
#[repr(C)]
pub struct XPS_GLYPH_INDEX {
    pub index: i32,
    pub advanceWidth: f32,
    pub horizontalOffset: f32,
    pub verticalOffset: f32,
}
import "golang.org/x/sys/windows"

type XPS_GLYPH_INDEX struct {
	index int32
	advanceWidth float32
	horizontalOffset float32
	verticalOffset float32
}
type
  XPS_GLYPH_INDEX = record
    index: Integer;
    advanceWidth: Single;
    horizontalOffset: Single;
    verticalOffset: Single;
  end;
const XPS_GLYPH_INDEX = extern struct {
    index: i32,
    advanceWidth: f32,
    horizontalOffset: f32,
    verticalOffset: f32,
};
type
  XPS_GLYPH_INDEX {.bycopy.} = object
    index: int32
    advanceWidth: float32
    horizontalOffset: float32
    verticalOffset: float32
struct XPS_GLYPH_INDEX
{
    int index;
    float advanceWidth;
    float horizontalOffset;
    float verticalOffset;
}

HSP用 定義

HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; XPS_GLYPH_INDEX サイズ: 16 バイト(x64)
dim st, 4    ; 4byte整数×4(構造体サイズ 16 / 4 切り上げ)
; index : INT (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; advanceWidth : FLOAT (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; horizontalOffset : FLOAT (+8, 4byte)  st.2 = 値  /  値 = st.2   (lpoke/lpeek も可)
; verticalOffset : FLOAT (+12, 4byte)  st.3 = 値  /  値 = st.3   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global XPS_GLYPH_INDEX
    #field int index
    #field float advanceWidth
    #field float horizontalOffset
    #field float verticalOffset
#endstruct

stdim st, XPS_GLYPH_INDEX        ; NSTRUCT 変数を確保
st->index = 100
mes "index=" + st->index