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

EXTLOGFONTW

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

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

フィールド

フィールドサイズx64x86説明
elfLogFontLOGFONTW92+0+0フォントの基本属性を表すLOGFONTW構造体。
elfFullNameWCHAR128+92+92フォントの完全名を表すワイド文字列。
elfStyleWCHAR64+220+220フォントのスタイル名を表すワイド文字列。
elfVersionDWORD4+284+284この構造体のバージョン番号。
elfStyleSizeDWORD4+288+288フォントが調整されたポイントサイズ。
elfMatchDWORD4+292+292フォントを一意に識別する照合値。
elfReservedDWORD4+296+296予約フィールド。0でなければならない。
elfVendorIdBYTE4+300+300フォントベンダーを識別する4文字のベンダーID。
elfCultureDWORD4+304+304フォントのカルチャ(言語)情報。現在は0のみ。
elfPanosePANOSE10+308+308フォントのPANOSE分類情報を表すPANOSE構造体。

各言語での定義

#include <windows.h>

// LOGFONTW  (x64 92 / x86 92 バイト)
typedef struct LOGFONTW {
    INT lfHeight;
    INT lfWidth;
    INT lfEscapement;
    INT lfOrientation;
    INT lfWeight;
    BYTE lfItalic;
    BYTE lfUnderline;
    BYTE lfStrikeOut;
    FONT_CHARSET lfCharSet;
    FONT_OUTPUT_PRECISION lfOutPrecision;
    FONT_CLIP_PRECISION lfClipPrecision;
    FONT_QUALITY lfQuality;
    BYTE lfPitchAndFamily;
    WCHAR lfFaceName[32];
} LOGFONTW;

// PANOSE  (x64 10 / x86 10 バイト)
typedef struct PANOSE {
    PAN_FAMILY_TYPE bFamilyType;
    PAN_SERIF_STYLE bSerifStyle;
    PAN_WEIGHT bWeight;
    PAN_PROPORTION bProportion;
    PAN_CONTRAST bContrast;
    PAN_STROKE_VARIATION bStrokeVariation;
    PAN_ARM_STYLE bArmStyle;
    PAN_LETT_FORM bLetterform;
    PAN_MIDLINE bMidline;
    PAN_XHEIGHT bXHeight;
} PANOSE;

// EXTLOGFONTW  (x64 320 / x86 320 バイト)
typedef struct EXTLOGFONTW {
    LOGFONTW elfLogFont;
    WCHAR elfFullName[64];
    WCHAR elfStyle[32];
    DWORD elfVersion;
    DWORD elfStyleSize;
    DWORD elfMatch;
    DWORD elfReserved;
    BYTE elfVendorId[4];
    DWORD elfCulture;
    PANOSE elfPanose;
} EXTLOGFONTW;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct LOGFONTW
{
    public int lfHeight;
    public int lfWidth;
    public int lfEscapement;
    public int lfOrientation;
    public int lfWeight;
    public byte lfItalic;
    public byte lfUnderline;
    public byte lfStrikeOut;
    public byte lfCharSet;
    public byte lfOutPrecision;
    public byte lfClipPrecision;
    public byte lfQuality;
    public byte lfPitchAndFamily;
    [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 32)] public string lfFaceName;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct PANOSE
{
    public byte bFamilyType;
    public byte bSerifStyle;
    public byte bWeight;
    public byte bProportion;
    public byte bContrast;
    public byte bStrokeVariation;
    public byte bArmStyle;
    public byte bLetterform;
    public byte bMidline;
    public byte bXHeight;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct EXTLOGFONTW
{
    public LOGFONTW elfLogFont;
    [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 64)] public string elfFullName;
    [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 32)] public string elfStyle;
    public uint elfVersion;
    public uint elfStyleSize;
    public uint elfMatch;
    public uint elfReserved;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)] public byte[] elfVendorId;
    public uint elfCulture;
    public PANOSE elfPanose;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure LOGFONTW
    Public lfHeight As Integer
    Public lfWidth As Integer
    Public lfEscapement As Integer
    Public lfOrientation As Integer
    Public lfWeight As Integer
    Public lfItalic As Byte
    Public lfUnderline As Byte
    Public lfStrikeOut As Byte
    Public lfCharSet As Byte
    Public lfOutPrecision As Byte
    Public lfClipPrecision As Byte
    Public lfQuality As Byte
    Public lfPitchAndFamily As Byte
    <MarshalAs(UnmanagedType.ByValTStr, SizeConst:=32)> Public lfFaceName As String
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure PANOSE
    Public bFamilyType As Byte
    Public bSerifStyle As Byte
    Public bWeight As Byte
    Public bProportion As Byte
    Public bContrast As Byte
    Public bStrokeVariation As Byte
    Public bArmStyle As Byte
    Public bLetterform As Byte
    Public bMidline As Byte
    Public bXHeight As Byte
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure EXTLOGFONTW
    Public elfLogFont As LOGFONTW
    <MarshalAs(UnmanagedType.ByValTStr, SizeConst:=64)> Public elfFullName As String
    <MarshalAs(UnmanagedType.ByValTStr, SizeConst:=32)> Public elfStyle As String
    Public elfVersion As UInteger
    Public elfStyleSize As UInteger
    Public elfMatch As UInteger
    Public elfReserved As UInteger
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=4)> Public elfVendorId() As Byte
    Public elfCulture As UInteger
    Public elfPanose As PANOSE
End Structure
import ctypes
from ctypes import wintypes

class LOGFONTW(ctypes.Structure):
    _fields_ = [
        ("lfHeight", ctypes.c_int),
        ("lfWidth", ctypes.c_int),
        ("lfEscapement", ctypes.c_int),
        ("lfOrientation", ctypes.c_int),
        ("lfWeight", ctypes.c_int),
        ("lfItalic", ctypes.c_ubyte),
        ("lfUnderline", ctypes.c_ubyte),
        ("lfStrikeOut", ctypes.c_ubyte),
        ("lfCharSet", ctypes.c_ubyte),
        ("lfOutPrecision", ctypes.c_ubyte),
        ("lfClipPrecision", ctypes.c_ubyte),
        ("lfQuality", ctypes.c_ubyte),
        ("lfPitchAndFamily", ctypes.c_ubyte),
        ("lfFaceName", ctypes.c_wchar * 32),
    ]

class PANOSE(ctypes.Structure):
    _fields_ = [
        ("bFamilyType", ctypes.c_ubyte),
        ("bSerifStyle", ctypes.c_ubyte),
        ("bWeight", ctypes.c_ubyte),
        ("bProportion", ctypes.c_ubyte),
        ("bContrast", ctypes.c_ubyte),
        ("bStrokeVariation", ctypes.c_ubyte),
        ("bArmStyle", ctypes.c_ubyte),
        ("bLetterform", ctypes.c_ubyte),
        ("bMidline", ctypes.c_ubyte),
        ("bXHeight", ctypes.c_ubyte),
    ]

class EXTLOGFONTW(ctypes.Structure):
    _fields_ = [
        ("elfLogFont", LOGFONTW),
        ("elfFullName", ctypes.c_wchar * 64),
        ("elfStyle", ctypes.c_wchar * 32),
        ("elfVersion", wintypes.DWORD),
        ("elfStyleSize", wintypes.DWORD),
        ("elfMatch", wintypes.DWORD),
        ("elfReserved", wintypes.DWORD),
        ("elfVendorId", ctypes.c_ubyte * 4),
        ("elfCulture", wintypes.DWORD),
        ("elfPanose", PANOSE),
    ]
#[repr(C)]
pub struct LOGFONTW {
    pub lfHeight: i32,
    pub lfWidth: i32,
    pub lfEscapement: i32,
    pub lfOrientation: i32,
    pub lfWeight: i32,
    pub lfItalic: u8,
    pub lfUnderline: u8,
    pub lfStrikeOut: u8,
    pub lfCharSet: u8,
    pub lfOutPrecision: u8,
    pub lfClipPrecision: u8,
    pub lfQuality: u8,
    pub lfPitchAndFamily: u8,
    pub lfFaceName: [u16; 32],
}

#[repr(C)]
pub struct PANOSE {
    pub bFamilyType: u8,
    pub bSerifStyle: u8,
    pub bWeight: u8,
    pub bProportion: u8,
    pub bContrast: u8,
    pub bStrokeVariation: u8,
    pub bArmStyle: u8,
    pub bLetterform: u8,
    pub bMidline: u8,
    pub bXHeight: u8,
}

#[repr(C)]
pub struct EXTLOGFONTW {
    pub elfLogFont: LOGFONTW,
    pub elfFullName: [u16; 64],
    pub elfStyle: [u16; 32],
    pub elfVersion: u32,
    pub elfStyleSize: u32,
    pub elfMatch: u32,
    pub elfReserved: u32,
    pub elfVendorId: [u8; 4],
    pub elfCulture: u32,
    pub elfPanose: PANOSE,
}
import "golang.org/x/sys/windows"

type LOGFONTW struct {
	lfHeight int32
	lfWidth int32
	lfEscapement int32
	lfOrientation int32
	lfWeight int32
	lfItalic byte
	lfUnderline byte
	lfStrikeOut byte
	lfCharSet byte
	lfOutPrecision byte
	lfClipPrecision byte
	lfQuality byte
	lfPitchAndFamily byte
	lfFaceName [32]uint16
}

type PANOSE struct {
	bFamilyType byte
	bSerifStyle byte
	bWeight byte
	bProportion byte
	bContrast byte
	bStrokeVariation byte
	bArmStyle byte
	bLetterform byte
	bMidline byte
	bXHeight byte
}

type EXTLOGFONTW struct {
	elfLogFont LOGFONTW
	elfFullName [64]uint16
	elfStyle [32]uint16
	elfVersion uint32
	elfStyleSize uint32
	elfMatch uint32
	elfReserved uint32
	elfVendorId [4]byte
	elfCulture uint32
	elfPanose PANOSE
}
type
  LOGFONTW = record
    lfHeight: Integer;
    lfWidth: Integer;
    lfEscapement: Integer;
    lfOrientation: Integer;
    lfWeight: Integer;
    lfItalic: Byte;
    lfUnderline: Byte;
    lfStrikeOut: Byte;
    lfCharSet: Byte;
    lfOutPrecision: Byte;
    lfClipPrecision: Byte;
    lfQuality: Byte;
    lfPitchAndFamily: Byte;
    lfFaceName: array[0..31] of WideChar;
  end;

  PANOSE = record
    bFamilyType: Byte;
    bSerifStyle: Byte;
    bWeight: Byte;
    bProportion: Byte;
    bContrast: Byte;
    bStrokeVariation: Byte;
    bArmStyle: Byte;
    bLetterform: Byte;
    bMidline: Byte;
    bXHeight: Byte;
  end;

  EXTLOGFONTW = record
    elfLogFont: LOGFONTW;
    elfFullName: array[0..63] of WideChar;
    elfStyle: array[0..31] of WideChar;
    elfVersion: DWORD;
    elfStyleSize: DWORD;
    elfMatch: DWORD;
    elfReserved: DWORD;
    elfVendorId: array[0..3] of Byte;
    elfCulture: DWORD;
    elfPanose: PANOSE;
  end;
const LOGFONTW = extern struct {
    lfHeight: i32,
    lfWidth: i32,
    lfEscapement: i32,
    lfOrientation: i32,
    lfWeight: i32,
    lfItalic: u8,
    lfUnderline: u8,
    lfStrikeOut: u8,
    lfCharSet: u8,
    lfOutPrecision: u8,
    lfClipPrecision: u8,
    lfQuality: u8,
    lfPitchAndFamily: u8,
    lfFaceName: [32]u16,
};

const PANOSE = extern struct {
    bFamilyType: u8,
    bSerifStyle: u8,
    bWeight: u8,
    bProportion: u8,
    bContrast: u8,
    bStrokeVariation: u8,
    bArmStyle: u8,
    bLetterform: u8,
    bMidline: u8,
    bXHeight: u8,
};

const EXTLOGFONTW = extern struct {
    elfLogFont: LOGFONTW,
    elfFullName: [64]u16,
    elfStyle: [32]u16,
    elfVersion: u32,
    elfStyleSize: u32,
    elfMatch: u32,
    elfReserved: u32,
    elfVendorId: [4]u8,
    elfCulture: u32,
    elfPanose: PANOSE,
};
type
  LOGFONTW {.bycopy.} = object
    lfHeight: int32
    lfWidth: int32
    lfEscapement: int32
    lfOrientation: int32
    lfWeight: int32
    lfItalic: uint8
    lfUnderline: uint8
    lfStrikeOut: uint8
    lfCharSet: uint8
    lfOutPrecision: uint8
    lfClipPrecision: uint8
    lfQuality: uint8
    lfPitchAndFamily: uint8
    lfFaceName: array[32, uint16]

  PANOSE {.bycopy.} = object
    bFamilyType: uint8
    bSerifStyle: uint8
    bWeight: uint8
    bProportion: uint8
    bContrast: uint8
    bStrokeVariation: uint8
    bArmStyle: uint8
    bLetterform: uint8
    bMidline: uint8
    bXHeight: uint8

  EXTLOGFONTW {.bycopy.} = object
    elfLogFont: LOGFONTW
    elfFullName: array[64, uint16]
    elfStyle: array[32, uint16]
    elfVersion: uint32
    elfStyleSize: uint32
    elfMatch: uint32
    elfReserved: uint32
    elfVendorId: array[4, uint8]
    elfCulture: uint32
    elfPanose: PANOSE
struct LOGFONTW
{
    int lfHeight;
    int lfWidth;
    int lfEscapement;
    int lfOrientation;
    int lfWeight;
    ubyte lfItalic;
    ubyte lfUnderline;
    ubyte lfStrikeOut;
    ubyte lfCharSet;
    ubyte lfOutPrecision;
    ubyte lfClipPrecision;
    ubyte lfQuality;
    ubyte lfPitchAndFamily;
    wchar[32] lfFaceName;
}

struct PANOSE
{
    ubyte bFamilyType;
    ubyte bSerifStyle;
    ubyte bWeight;
    ubyte bProportion;
    ubyte bContrast;
    ubyte bStrokeVariation;
    ubyte bArmStyle;
    ubyte bLetterform;
    ubyte bMidline;
    ubyte bXHeight;
}

struct EXTLOGFONTW
{
    LOGFONTW elfLogFont;
    wchar[64] elfFullName;
    wchar[32] elfStyle;
    uint elfVersion;
    uint elfStyleSize;
    uint elfMatch;
    uint elfReserved;
    ubyte[4] elfVendorId;
    uint elfCulture;
    PANOSE elfPanose;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; EXTLOGFONTW サイズ: 320 バイト(x64)
dim st, 80    ; 4byte整数×80(構造体サイズ 320 / 4 切り上げ)
; elfLogFont : LOGFONTW (+0, 92byte)  varptr(st)+0 を基点に操作(92byte:入れ子/配列)
; elfFullName : WCHAR (+92, 128byte)  varptr(st)+92 を基点に操作(128byte:入れ子/配列)
; elfStyle : WCHAR (+220, 64byte)  varptr(st)+220 を基点に操作(64byte:入れ子/配列)
; elfVersion : DWORD (+284, 4byte)  st.71 = 値  /  値 = st.71   (lpoke/lpeek も可)
; elfStyleSize : DWORD (+288, 4byte)  st.72 = 値  /  値 = st.72   (lpoke/lpeek も可)
; elfMatch : DWORD (+292, 4byte)  st.73 = 値  /  値 = st.73   (lpoke/lpeek も可)
; elfReserved : DWORD (+296, 4byte)  st.74 = 値  /  値 = st.74   (lpoke/lpeek も可)
; elfVendorId : BYTE (+300, 4byte)  varptr(st)+300 を基点に操作(4byte:入れ子/配列)
; elfCulture : DWORD (+304, 4byte)  st.76 = 値  /  値 = st.76   (lpoke/lpeek も可)
; elfPanose : PANOSE (+308, 10byte)  varptr(st)+308 を基点に操作(10byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global LOGFONTW
    #field int lfHeight
    #field int lfWidth
    #field int lfEscapement
    #field int lfOrientation
    #field int lfWeight
    #field byte lfItalic
    #field byte lfUnderline
    #field byte lfStrikeOut
    #field byte lfCharSet
    #field byte lfOutPrecision
    #field byte lfClipPrecision
    #field byte lfQuality
    #field byte lfPitchAndFamily
    #field wchar lfFaceName 32
#endstruct

#defstruct global PANOSE
    #field byte bFamilyType
    #field byte bSerifStyle
    #field byte bWeight
    #field byte bProportion
    #field byte bContrast
    #field byte bStrokeVariation
    #field byte bArmStyle
    #field byte bLetterform
    #field byte bMidline
    #field byte bXHeight
#endstruct

#defstruct global EXTLOGFONTW
    #field LOGFONTW elfLogFont
    #field wchar elfFullName 64
    #field wchar elfStyle 32
    #field int elfVersion
    #field int elfStyleSize
    #field int elfMatch
    #field int elfReserved
    #field byte elfVendorId 4
    #field int elfCulture
    #field PANOSE elfPanose
#endstruct

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