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

FONTOBJ

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

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

フィールド

フィールドサイズx64x86説明
iUniqDWORD4+0+0フォントの一意識別番号。
iFaceDWORD4+4+4フォントフェイスのインデックス。
cxMaxDWORD4+8+8最大グリフ幅(ピクセル)。
flFontTypeDWORD4+12+12フォント種別フラグ(FO_TYPE_RASTER等)。
iTTUniqUINT_PTR8/4+16+16TrueTypeフォントの一意識別子。
iFileUINT_PTR8/4+24+20フォントファイルの識別子。
sizLogResPpiSIZE8+32+24論理解像度(PPI)を表すサイズ。
ulStyleSizeDWORD4+40+32スタイルサイズ値。
pvConsumervoid*8/4+48+36コンシューマ(GDI側)が利用するポインタ。
pvProducervoid*8/4+56+40プロデューサ(ドライバ側)が利用するポインタ。

各言語での定義

#include <windows.h>

// SIZE  (x64 8 / x86 8 バイト)
typedef struct SIZE {
    INT cx;
    INT cy;
} SIZE;

// FONTOBJ  (x64 64 / x86 44 バイト)
typedef struct FONTOBJ {
    DWORD iUniq;
    DWORD iFace;
    DWORD cxMax;
    DWORD flFontType;
    UINT_PTR iTTUniq;
    UINT_PTR iFile;
    SIZE sizLogResPpi;
    DWORD ulStyleSize;
    void* pvConsumer;
    void* pvProducer;
} FONTOBJ;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct SIZE
{
    public int cx;
    public int cy;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct FONTOBJ
{
    public uint iUniq;
    public uint iFace;
    public uint cxMax;
    public uint flFontType;
    public UIntPtr iTTUniq;
    public UIntPtr iFile;
    public SIZE sizLogResPpi;
    public uint ulStyleSize;
    public IntPtr pvConsumer;
    public IntPtr pvProducer;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure SIZE
    Public cx As Integer
    Public cy As Integer
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure FONTOBJ
    Public iUniq As UInteger
    Public iFace As UInteger
    Public cxMax As UInteger
    Public flFontType As UInteger
    Public iTTUniq As UIntPtr
    Public iFile As UIntPtr
    Public sizLogResPpi As SIZE
    Public ulStyleSize As UInteger
    Public pvConsumer As IntPtr
    Public pvProducer As IntPtr
End Structure
import ctypes
from ctypes import wintypes

class SIZE(ctypes.Structure):
    _fields_ = [
        ("cx", ctypes.c_int),
        ("cy", ctypes.c_int),
    ]

class FONTOBJ(ctypes.Structure):
    _fields_ = [
        ("iUniq", wintypes.DWORD),
        ("iFace", wintypes.DWORD),
        ("cxMax", wintypes.DWORD),
        ("flFontType", wintypes.DWORD),
        ("iTTUniq", ctypes.c_size_t),
        ("iFile", ctypes.c_size_t),
        ("sizLogResPpi", SIZE),
        ("ulStyleSize", wintypes.DWORD),
        ("pvConsumer", ctypes.c_void_p),
        ("pvProducer", ctypes.c_void_p),
    ]
#[repr(C)]
pub struct SIZE {
    pub cx: i32,
    pub cy: i32,
}

#[repr(C)]
pub struct FONTOBJ {
    pub iUniq: u32,
    pub iFace: u32,
    pub cxMax: u32,
    pub flFontType: u32,
    pub iTTUniq: usize,
    pub iFile: usize,
    pub sizLogResPpi: SIZE,
    pub ulStyleSize: u32,
    pub pvConsumer: *mut core::ffi::c_void,
    pub pvProducer: *mut core::ffi::c_void,
}
import "golang.org/x/sys/windows"

type SIZE struct {
	cx int32
	cy int32
}

type FONTOBJ struct {
	iUniq uint32
	iFace uint32
	cxMax uint32
	flFontType uint32
	iTTUniq uintptr
	iFile uintptr
	sizLogResPpi SIZE
	ulStyleSize uint32
	pvConsumer uintptr
	pvProducer uintptr
}
type
  SIZE = record
    cx: Integer;
    cy: Integer;
  end;

  FONTOBJ = record
    iUniq: DWORD;
    iFace: DWORD;
    cxMax: DWORD;
    flFontType: DWORD;
    iTTUniq: NativeUInt;
    iFile: NativeUInt;
    sizLogResPpi: SIZE;
    ulStyleSize: DWORD;
    pvConsumer: Pointer;
    pvProducer: Pointer;
  end;
const SIZE = extern struct {
    cx: i32,
    cy: i32,
};

const FONTOBJ = extern struct {
    iUniq: u32,
    iFace: u32,
    cxMax: u32,
    flFontType: u32,
    iTTUniq: usize,
    iFile: usize,
    sizLogResPpi: SIZE,
    ulStyleSize: u32,
    pvConsumer: ?*anyopaque,
    pvProducer: ?*anyopaque,
};
type
  SIZE {.bycopy.} = object
    cx: int32
    cy: int32

  FONTOBJ {.bycopy.} = object
    iUniq: uint32
    iFace: uint32
    cxMax: uint32
    flFontType: uint32
    iTTUniq: uint
    iFile: uint
    sizLogResPpi: SIZE
    ulStyleSize: uint32
    pvConsumer: pointer
    pvProducer: pointer
struct SIZE
{
    int cx;
    int cy;
}

struct FONTOBJ
{
    uint iUniq;
    uint iFace;
    uint cxMax;
    uint flFontType;
    size_t iTTUniq;
    size_t iFile;
    SIZE sizLogResPpi;
    uint ulStyleSize;
    void* pvConsumer;
    void* pvProducer;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; FONTOBJ サイズ: 44 バイト(x86)
dim st, 11    ; 4byte整数×11(構造体サイズ 44 / 4 切り上げ)
; iUniq : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; iFace : DWORD (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; cxMax : DWORD (+8, 4byte)  st.2 = 値  /  値 = st.2   (lpoke/lpeek も可)
; flFontType : DWORD (+12, 4byte)  st.3 = 値  /  値 = st.3   (lpoke/lpeek も可)
; iTTUniq : UINT_PTR (+16, 4byte)  st.4 = 値  /  値 = st.4   (lpoke/lpeek も可)
; iFile : UINT_PTR (+20, 4byte)  st.5 = 値  /  値 = st.5   (lpoke/lpeek も可)
; sizLogResPpi : SIZE (+24, 8byte)  varptr(st)+24 を基点に操作(8byte:入れ子/配列)
; ulStyleSize : DWORD (+32, 4byte)  st.8 = 値  /  値 = st.8   (lpoke/lpeek も可)
; pvConsumer : void* (+36, 4byte)  st.9 = 値  /  値 = st.9   (lpoke/lpeek も可)
; pvProducer : void* (+40, 4byte)  st.10 = 値  /  値 = st.10   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; FONTOBJ サイズ: 64 バイト(x64)
dim st, 16    ; 4byte整数×16(構造体サイズ 64 / 4 切り上げ)
; iUniq : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; iFace : DWORD (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; cxMax : DWORD (+8, 4byte)  st.2 = 値  /  値 = st.2   (lpoke/lpeek も可)
; flFontType : DWORD (+12, 4byte)  st.3 = 値  /  値 = st.3   (lpoke/lpeek も可)
; iTTUniq : UINT_PTR (+16, 8byte)  qpoke st,16,値 / qpeek(st,16)  ※IronHSPのみ。3.7/3.8は lpoke st,16,下位 : lpoke st,20,上位
; iFile : UINT_PTR (+24, 8byte)  qpoke st,24,値 / qpeek(st,24)  ※IronHSPのみ。3.7/3.8は lpoke st,24,下位 : lpoke st,28,上位
; sizLogResPpi : SIZE (+32, 8byte)  varptr(st)+32 を基点に操作(8byte:入れ子/配列)
; ulStyleSize : DWORD (+40, 4byte)  st.10 = 値  /  値 = st.10   (lpoke/lpeek も可)
; pvConsumer : void* (+48, 8byte)  qpoke st,48,値 / qpeek(st,48)  ※IronHSPのみ。3.7/3.8は lpoke st,48,下位 : lpoke st,52,上位
; pvProducer : void* (+56, 8byte)  qpoke st,56,値 / qpeek(st,56)  ※IronHSPのみ。3.7/3.8は lpoke st,56,下位 : lpoke st,60,上位
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global SIZE
    #field int cx
    #field int cy
#endstruct

#defstruct global FONTOBJ
    #field int iUniq
    #field int iFace
    #field int cxMax
    #field int flFontType
    #field intptr iTTUniq
    #field intptr iFile
    #field SIZE sizLogResPpi
    #field int ulStyleSize
    #field intptr pvConsumer
    #field intptr pvProducer
#endstruct

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