ホーム › Graphics.Gdi › GLYPHSET
GLYPHSET
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| cbThis | DWORD | 4 | +0 | +0 | この構造体全体のサイズをバイト単位で表す。 |
| flAccel | DWORD | 4 | +4 | +4 | アクセラレーションフラグ。GS_8BIT_INDICESが設定される場合がある。 |
| cGlyphsSupported | DWORD | 4 | +8 | +8 | サポートされるグリフの総数を表す。 |
| cRanges | DWORD | 4 | +12 | +12 | ranges配列に含まれるWCRANGE範囲の個数を表す。 |
| ranges | WCRANGE | 4 | +16 | +16 | サポートされる文字範囲を表すWCRANGE配列の先頭(可変長)。 |
各言語での定義
#include <windows.h>
// WCRANGE (x64 4 / x86 4 バイト)
typedef struct WCRANGE {
WCHAR wcLow;
WORD cGlyphs;
} WCRANGE;
// GLYPHSET (x64 20 / x86 20 バイト)
typedef struct GLYPHSET {
DWORD cbThis;
DWORD flAccel;
DWORD cGlyphsSupported;
DWORD cRanges;
WCRANGE ranges[1];
} GLYPHSET;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct WCRANGE
{
public char wcLow;
public ushort cGlyphs;
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct GLYPHSET
{
public uint cbThis;
public uint flAccel;
public uint cGlyphsSupported;
public uint cRanges;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 1)] public WCRANGE[] ranges;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure WCRANGE
Public wcLow As Char
Public cGlyphs As UShort
End Structure
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure GLYPHSET
Public cbThis As UInteger
Public flAccel As UInteger
Public cGlyphsSupported As UInteger
Public cRanges As UInteger
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=1)> Public ranges() As WCRANGE
End Structureimport ctypes
from ctypes import wintypes
class WCRANGE(ctypes.Structure):
_fields_ = [
("wcLow", ctypes.c_wchar),
("cGlyphs", ctypes.c_ushort),
]
class GLYPHSET(ctypes.Structure):
_fields_ = [
("cbThis", wintypes.DWORD),
("flAccel", wintypes.DWORD),
("cGlyphsSupported", wintypes.DWORD),
("cRanges", wintypes.DWORD),
("ranges", WCRANGE * 1),
]#[repr(C)]
pub struct WCRANGE {
pub wcLow: u16,
pub cGlyphs: u16,
}
#[repr(C)]
pub struct GLYPHSET {
pub cbThis: u32,
pub flAccel: u32,
pub cGlyphsSupported: u32,
pub cRanges: u32,
pub ranges: [WCRANGE; 1],
}import "golang.org/x/sys/windows"
type WCRANGE struct {
wcLow uint16
cGlyphs uint16
}
type GLYPHSET struct {
cbThis uint32
flAccel uint32
cGlyphsSupported uint32
cRanges uint32
ranges [1]WCRANGE
}type
WCRANGE = record
wcLow: WideChar;
cGlyphs: Word;
end;
GLYPHSET = record
cbThis: DWORD;
flAccel: DWORD;
cGlyphsSupported: DWORD;
cRanges: DWORD;
ranges: array[0..0] of WCRANGE;
end;const WCRANGE = extern struct {
wcLow: u16,
cGlyphs: u16,
};
const GLYPHSET = extern struct {
cbThis: u32,
flAccel: u32,
cGlyphsSupported: u32,
cRanges: u32,
ranges: [1]WCRANGE,
};type
WCRANGE {.bycopy.} = object
wcLow: uint16
cGlyphs: uint16
GLYPHSET {.bycopy.} = object
cbThis: uint32
flAccel: uint32
cGlyphsSupported: uint32
cRanges: uint32
ranges: array[1, WCRANGE]struct WCRANGE
{
wchar wcLow;
ushort cGlyphs;
}
struct GLYPHSET
{
uint cbThis;
uint flAccel;
uint cGlyphsSupported;
uint cRanges;
WCRANGE[1] ranges;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; GLYPHSET サイズ: 20 バイト(x64)
dim st, 5 ; 4byte整数×5(構造体サイズ 20 / 4 切り上げ)
; cbThis : 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 も可)
; cRanges : DWORD (+12, 4byte) st.3 = 値 / 値 = st.3 (lpoke/lpeek も可)
; ranges : WCRANGE (+16, 4byte) varptr(st)+16 を基点に操作(4byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global WCRANGE
#field short wcLow
#field short cGlyphs
#endstruct
#defstruct global GLYPHSET
#field int cbThis
#field int flAccel
#field int cGlyphsSupported
#field int cRanges
#field WCRANGE ranges 1
#endstruct
stdim st, GLYPHSET ; NSTRUCT 変数を確保
st->cbThis = 100
mes "cbThis=" + st->cbThis