Win32 API 日本語リファレンス
ホームDevices.Display › FD_GLYPHSET

FD_GLYPHSET

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

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

フィールド

フィールドサイズx64x86説明
cjThisDWORD4+0+0この構造体全体のバイトサイズ。
flAccelDWORD4+4+4アクセラレーション(高速化)用のフラグ。
cGlyphsSupportedDWORD4+8+8サポートするグリフの総数。
cRunsDWORD4+12+12文字コード連続区間(WCRUN)の数。
awcrunWCRUN16/8+16+16WCRUN構造体の配列(可変長)。文字コードとグリフの対応を表す。

各言語での定義

#include <windows.h>

// WCRUN  (x64 16 / x86 8 バイト)
typedef struct WCRUN {
    WCHAR wcLow;
    WORD cGlyphs;
    DWORD* phg;
} WCRUN;

// FD_GLYPHSET  (x64 32 / x86 24 バイト)
typedef struct FD_GLYPHSET {
    DWORD cjThis;
    DWORD flAccel;
    DWORD cGlyphsSupported;
    DWORD cRuns;
    WCRUN awcrun[1];
} FD_GLYPHSET;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct WCRUN
{
    public char wcLow;
    public ushort cGlyphs;
    public IntPtr phg;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct FD_GLYPHSET
{
    public uint cjThis;
    public uint flAccel;
    public uint cGlyphsSupported;
    public uint cRuns;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 1)] public WCRUN[] awcrun;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure WCRUN
    Public wcLow As Char
    Public cGlyphs As UShort
    Public phg As IntPtr
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure FD_GLYPHSET
    Public cjThis As UInteger
    Public flAccel As UInteger
    Public cGlyphsSupported As UInteger
    Public cRuns As UInteger
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=1)> Public awcrun() As WCRUN
End Structure
import ctypes
from ctypes import wintypes

class WCRUN(ctypes.Structure):
    _fields_ = [
        ("wcLow", ctypes.c_wchar),
        ("cGlyphs", ctypes.c_ushort),
        ("phg", ctypes.c_void_p),
    ]

class FD_GLYPHSET(ctypes.Structure):
    _fields_ = [
        ("cjThis", wintypes.DWORD),
        ("flAccel", wintypes.DWORD),
        ("cGlyphsSupported", wintypes.DWORD),
        ("cRuns", wintypes.DWORD),
        ("awcrun", WCRUN * 1),
    ]
#[repr(C)]
pub struct WCRUN {
    pub wcLow: u16,
    pub cGlyphs: u16,
    pub phg: *mut core::ffi::c_void,
}

#[repr(C)]
pub struct FD_GLYPHSET {
    pub cjThis: u32,
    pub flAccel: u32,
    pub cGlyphsSupported: u32,
    pub cRuns: u32,
    pub awcrun: [WCRUN; 1],
}
import "golang.org/x/sys/windows"

type WCRUN struct {
	wcLow uint16
	cGlyphs uint16
	phg uintptr
}

type FD_GLYPHSET struct {
	cjThis uint32
	flAccel uint32
	cGlyphsSupported uint32
	cRuns uint32
	awcrun [1]WCRUN
}
type
  WCRUN = record
    wcLow: WideChar;
    cGlyphs: Word;
    phg: Pointer;
  end;

  FD_GLYPHSET = record
    cjThis: DWORD;
    flAccel: DWORD;
    cGlyphsSupported: DWORD;
    cRuns: DWORD;
    awcrun: array[0..0] of WCRUN;
  end;
const WCRUN = extern struct {
    wcLow: u16,
    cGlyphs: u16,
    phg: ?*anyopaque,
};

const FD_GLYPHSET = extern struct {
    cjThis: u32,
    flAccel: u32,
    cGlyphsSupported: u32,
    cRuns: u32,
    awcrun: [1]WCRUN,
};
type
  WCRUN {.bycopy.} = object
    wcLow: uint16
    cGlyphs: uint16
    phg: pointer

  FD_GLYPHSET {.bycopy.} = object
    cjThis: uint32
    flAccel: uint32
    cGlyphsSupported: uint32
    cRuns: uint32
    awcrun: array[1, WCRUN]
struct WCRUN
{
    wchar wcLow;
    ushort cGlyphs;
    void* phg;
}

struct FD_GLYPHSET
{
    uint cjThis;
    uint flAccel;
    uint cGlyphsSupported;
    uint cRuns;
    WCRUN[1] awcrun;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; FD_GLYPHSET サイズ: 24 バイト(x86)
dim st, 6    ; 4byte整数×6(構造体サイズ 24 / 4 切り上げ)
; cjThis : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; flAccel : DWORD (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; cGlyphsSupported : DWORD (+8, 4byte)  st.2 = 値  /  値 = st.2   (lpoke/lpeek も可)
; cRuns : DWORD (+12, 4byte)  st.3 = 値  /  値 = st.3   (lpoke/lpeek も可)
; awcrun : WCRUN (+16, 8byte)  varptr(st)+16 を基点に操作(8byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; FD_GLYPHSET サイズ: 32 バイト(x64)
dim st, 8    ; 4byte整数×8(構造体サイズ 32 / 4 切り上げ)
; cjThis : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; flAccel : DWORD (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; cGlyphsSupported : DWORD (+8, 4byte)  st.2 = 値  /  値 = st.2   (lpoke/lpeek も可)
; cRuns : DWORD (+12, 4byte)  st.3 = 値  /  値 = st.3   (lpoke/lpeek も可)
; awcrun : WCRUN (+16, 16byte)  varptr(st)+16 を基点に操作(16byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global WCRUN
    #field short wcLow
    #field short cGlyphs
    #field intptr phg
#endstruct

#defstruct global FD_GLYPHSET
    #field int cjThis
    #field int flAccel
    #field int cGlyphsSupported
    #field int cRuns
    #field WCRUN awcrun 1
#endstruct

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