Win32 API 日本語リファレンス
ホームGraphics.Printing › UFF_FILEHEADER

UFF_FILEHEADER

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

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

フィールド

フィールドサイズx64x86説明
dwSignatureDWORD4+0+0ユニバーサルフォントフォーマット(UFF)を識別するシグネチャ。
dwVersionDWORD4+4+4ファイルフォーマットのバージョン番号。
dwSizeDWORD4+8+8このヘッダーのサイズをバイト単位で示す。
nFontsDWORD4+12+12ファイルに含まれるフォント数。
nGlyphSetsDWORD4+16+16ファイルに含まれるグリフセット数。
nVarDataDWORD4+20+20可変データブロックの数。
offFontDirDWORD4+24+24フォントディレクトリへの先頭からのバイトオフセット。
dwFlagsDWORD4+28+28ファイルの属性を示すフラグ。
dwReservedDWORD16+32+32予約フィールド。0に設定する。

各言語での定義

#include <windows.h>

// UFF_FILEHEADER  (x64 48 / x86 48 バイト)
typedef struct UFF_FILEHEADER {
    DWORD dwSignature;
    DWORD dwVersion;
    DWORD dwSize;
    DWORD nFonts;
    DWORD nGlyphSets;
    DWORD nVarData;
    DWORD offFontDir;
    DWORD dwFlags;
    DWORD dwReserved[4];
} UFF_FILEHEADER;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct UFF_FILEHEADER
{
    public uint dwSignature;
    public uint dwVersion;
    public uint dwSize;
    public uint nFonts;
    public uint nGlyphSets;
    public uint nVarData;
    public uint offFontDir;
    public uint dwFlags;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)] public uint[] dwReserved;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure UFF_FILEHEADER
    Public dwSignature As UInteger
    Public dwVersion As UInteger
    Public dwSize As UInteger
    Public nFonts As UInteger
    Public nGlyphSets As UInteger
    Public nVarData As UInteger
    Public offFontDir As UInteger
    Public dwFlags As UInteger
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=4)> Public dwReserved() As UInteger
End Structure
import ctypes
from ctypes import wintypes

class UFF_FILEHEADER(ctypes.Structure):
    _fields_ = [
        ("dwSignature", wintypes.DWORD),
        ("dwVersion", wintypes.DWORD),
        ("dwSize", wintypes.DWORD),
        ("nFonts", wintypes.DWORD),
        ("nGlyphSets", wintypes.DWORD),
        ("nVarData", wintypes.DWORD),
        ("offFontDir", wintypes.DWORD),
        ("dwFlags", wintypes.DWORD),
        ("dwReserved", wintypes.DWORD * 4),
    ]
#[repr(C)]
pub struct UFF_FILEHEADER {
    pub dwSignature: u32,
    pub dwVersion: u32,
    pub dwSize: u32,
    pub nFonts: u32,
    pub nGlyphSets: u32,
    pub nVarData: u32,
    pub offFontDir: u32,
    pub dwFlags: u32,
    pub dwReserved: [u32; 4],
}
import "golang.org/x/sys/windows"

type UFF_FILEHEADER struct {
	dwSignature uint32
	dwVersion uint32
	dwSize uint32
	nFonts uint32
	nGlyphSets uint32
	nVarData uint32
	offFontDir uint32
	dwFlags uint32
	dwReserved [4]uint32
}
type
  UFF_FILEHEADER = record
    dwSignature: DWORD;
    dwVersion: DWORD;
    dwSize: DWORD;
    nFonts: DWORD;
    nGlyphSets: DWORD;
    nVarData: DWORD;
    offFontDir: DWORD;
    dwFlags: DWORD;
    dwReserved: array[0..3] of DWORD;
  end;
const UFF_FILEHEADER = extern struct {
    dwSignature: u32,
    dwVersion: u32,
    dwSize: u32,
    nFonts: u32,
    nGlyphSets: u32,
    nVarData: u32,
    offFontDir: u32,
    dwFlags: u32,
    dwReserved: [4]u32,
};
type
  UFF_FILEHEADER {.bycopy.} = object
    dwSignature: uint32
    dwVersion: uint32
    dwSize: uint32
    nFonts: uint32
    nGlyphSets: uint32
    nVarData: uint32
    offFontDir: uint32
    dwFlags: uint32
    dwReserved: array[4, uint32]
struct UFF_FILEHEADER
{
    uint dwSignature;
    uint dwVersion;
    uint dwSize;
    uint nFonts;
    uint nGlyphSets;
    uint nVarData;
    uint offFontDir;
    uint dwFlags;
    uint[4] dwReserved;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; UFF_FILEHEADER サイズ: 48 バイト(x64)
dim st, 12    ; 4byte整数×12(構造体サイズ 48 / 4 切り上げ)
; dwSignature : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; dwVersion : DWORD (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; dwSize : DWORD (+8, 4byte)  st.2 = 値  /  値 = st.2   (lpoke/lpeek も可)
; nFonts : DWORD (+12, 4byte)  st.3 = 値  /  値 = st.3   (lpoke/lpeek も可)
; nGlyphSets : DWORD (+16, 4byte)  st.4 = 値  /  値 = st.4   (lpoke/lpeek も可)
; nVarData : DWORD (+20, 4byte)  st.5 = 値  /  値 = st.5   (lpoke/lpeek も可)
; offFontDir : DWORD (+24, 4byte)  st.6 = 値  /  値 = st.6   (lpoke/lpeek も可)
; dwFlags : DWORD (+28, 4byte)  st.7 = 値  /  値 = st.7   (lpoke/lpeek も可)
; dwReserved : DWORD (+32, 16byte)  varptr(st)+32 を基点に操作(16byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global UFF_FILEHEADER
    #field int dwSignature
    #field int dwVersion
    #field int dwSize
    #field int nFonts
    #field int nGlyphSets
    #field int nVarData
    #field int offFontDir
    #field int dwFlags
    #field int dwReserved 4
#endstruct

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