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

UNIFM_HDR

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

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

フィールド

フィールドサイズx64x86説明
dwSizeDWORD4+0+0このフォントメトリックヘッダー全体のサイズをバイト単位で示す。
dwVersionDWORD4+4+4ヘッダー構造のバージョン番号。
ulDefaultCodepageDWORD4+8+8フォントの既定コードページ。
lGlyphSetDataRCIDINT4+12+12グリフセットデータのリソースID。
loUnidrvInfoDWORD4+16+16UNIDRVINFOへの先頭からのバイトオフセット。
loIFIMetricsDWORD4+20+20IFIメトリクスへの先頭からのバイトオフセット。
loExtTextMetricDWORD4+24+24拡張テキストメトリクスへの先頭からのバイトオフセット。
loWidthTableDWORD4+28+28文字幅テーブルへの先頭からのバイトオフセット。
loKernPairDWORD4+32+32カーニングペアデータへの先頭からのバイトオフセット。
dwReservedDWORD8+36+36予約フィールド。0に設定する。

各言語での定義

#include <windows.h>

// UNIFM_HDR  (x64 44 / x86 44 バイト)
typedef struct UNIFM_HDR {
    DWORD dwSize;
    DWORD dwVersion;
    DWORD ulDefaultCodepage;
    INT lGlyphSetDataRCID;
    DWORD loUnidrvInfo;
    DWORD loIFIMetrics;
    DWORD loExtTextMetric;
    DWORD loWidthTable;
    DWORD loKernPair;
    DWORD dwReserved[2];
} UNIFM_HDR;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct UNIFM_HDR
{
    public uint dwSize;
    public uint dwVersion;
    public uint ulDefaultCodepage;
    public int lGlyphSetDataRCID;
    public uint loUnidrvInfo;
    public uint loIFIMetrics;
    public uint loExtTextMetric;
    public uint loWidthTable;
    public uint loKernPair;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] public uint[] dwReserved;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure UNIFM_HDR
    Public dwSize As UInteger
    Public dwVersion As UInteger
    Public ulDefaultCodepage As UInteger
    Public lGlyphSetDataRCID As Integer
    Public loUnidrvInfo As UInteger
    Public loIFIMetrics As UInteger
    Public loExtTextMetric As UInteger
    Public loWidthTable As UInteger
    Public loKernPair As UInteger
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=2)> Public dwReserved() As UInteger
End Structure
import ctypes
from ctypes import wintypes

class UNIFM_HDR(ctypes.Structure):
    _fields_ = [
        ("dwSize", wintypes.DWORD),
        ("dwVersion", wintypes.DWORD),
        ("ulDefaultCodepage", wintypes.DWORD),
        ("lGlyphSetDataRCID", ctypes.c_int),
        ("loUnidrvInfo", wintypes.DWORD),
        ("loIFIMetrics", wintypes.DWORD),
        ("loExtTextMetric", wintypes.DWORD),
        ("loWidthTable", wintypes.DWORD),
        ("loKernPair", wintypes.DWORD),
        ("dwReserved", wintypes.DWORD * 2),
    ]
#[repr(C)]
pub struct UNIFM_HDR {
    pub dwSize: u32,
    pub dwVersion: u32,
    pub ulDefaultCodepage: u32,
    pub lGlyphSetDataRCID: i32,
    pub loUnidrvInfo: u32,
    pub loIFIMetrics: u32,
    pub loExtTextMetric: u32,
    pub loWidthTable: u32,
    pub loKernPair: u32,
    pub dwReserved: [u32; 2],
}
import "golang.org/x/sys/windows"

type UNIFM_HDR struct {
	dwSize uint32
	dwVersion uint32
	ulDefaultCodepage uint32
	lGlyphSetDataRCID int32
	loUnidrvInfo uint32
	loIFIMetrics uint32
	loExtTextMetric uint32
	loWidthTable uint32
	loKernPair uint32
	dwReserved [2]uint32
}
type
  UNIFM_HDR = record
    dwSize: DWORD;
    dwVersion: DWORD;
    ulDefaultCodepage: DWORD;
    lGlyphSetDataRCID: Integer;
    loUnidrvInfo: DWORD;
    loIFIMetrics: DWORD;
    loExtTextMetric: DWORD;
    loWidthTable: DWORD;
    loKernPair: DWORD;
    dwReserved: array[0..1] of DWORD;
  end;
const UNIFM_HDR = extern struct {
    dwSize: u32,
    dwVersion: u32,
    ulDefaultCodepage: u32,
    lGlyphSetDataRCID: i32,
    loUnidrvInfo: u32,
    loIFIMetrics: u32,
    loExtTextMetric: u32,
    loWidthTable: u32,
    loKernPair: u32,
    dwReserved: [2]u32,
};
type
  UNIFM_HDR {.bycopy.} = object
    dwSize: uint32
    dwVersion: uint32
    ulDefaultCodepage: uint32
    lGlyphSetDataRCID: int32
    loUnidrvInfo: uint32
    loIFIMetrics: uint32
    loExtTextMetric: uint32
    loWidthTable: uint32
    loKernPair: uint32
    dwReserved: array[2, uint32]
struct UNIFM_HDR
{
    uint dwSize;
    uint dwVersion;
    uint ulDefaultCodepage;
    int lGlyphSetDataRCID;
    uint loUnidrvInfo;
    uint loIFIMetrics;
    uint loExtTextMetric;
    uint loWidthTable;
    uint loKernPair;
    uint[2] dwReserved;
}

HSP用 定義

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

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

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