ホーム › Graphics.Gdi › EXTLOGFONTA
EXTLOGFONTA
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| elfLogFont | LOGFONTA | 60 | +0 | +0 | フォントの基本属性を表すLOGFONTA構造体。 |
| elfFullName | BYTE | 64 | +60 | +60 | フォントの完全名を表すANSI文字列。 |
| elfStyle | BYTE | 32 | +124 | +124 | フォントのスタイル名を表すANSI文字列。 |
| elfVersion | DWORD | 4 | +156 | +156 | この構造体のバージョン番号。 |
| elfStyleSize | DWORD | 4 | +160 | +160 | フォントが調整されたポイントサイズ。 |
| elfMatch | DWORD | 4 | +164 | +164 | フォントを一意に識別する照合値。 |
| elfReserved | DWORD | 4 | +168 | +168 | 予約フィールド。0でなければならない。 |
| elfVendorId | BYTE | 4 | +172 | +172 | フォントベンダーを識別する4文字のベンダーID。 |
| elfCulture | DWORD | 4 | +176 | +176 | フォントのカルチャ(言語)情報。現在は0のみ。 |
| elfPanose | PANOSE | 10 | +180 | +180 | フォントのPANOSE分類情報を表すPANOSE構造体。 |
各言語での定義
#include <windows.h>
// LOGFONTA (x64 60 / x86 60 バイト)
typedef struct LOGFONTA {
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;
CHAR lfFaceName[32];
} LOGFONTA;
// 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;
// EXTLOGFONTA (x64 192 / x86 192 バイト)
typedef struct EXTLOGFONTA {
LOGFONTA elfLogFont;
BYTE elfFullName[64];
BYTE elfStyle[32];
DWORD elfVersion;
DWORD elfStyleSize;
DWORD elfMatch;
DWORD elfReserved;
BYTE elfVendorId[4];
DWORD elfCulture;
PANOSE elfPanose;
} EXTLOGFONTA;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct LOGFONTA
{
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.ByValArray, SizeConst = 32)] public sbyte[] 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 EXTLOGFONTA
{
public LOGFONTA elfLogFont;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 64)] public byte[] elfFullName;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] public byte[] 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 LOGFONTA
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.ByValArray, SizeConst:=32)> Public lfFaceName() As SByte
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 EXTLOGFONTA
Public elfLogFont As LOGFONTA
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=64)> Public elfFullName() As Byte
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=32)> Public elfStyle() As Byte
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 Structureimport ctypes
from ctypes import wintypes
class LOGFONTA(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_byte * 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 EXTLOGFONTA(ctypes.Structure):
_fields_ = [
("elfLogFont", LOGFONTA),
("elfFullName", ctypes.c_ubyte * 64),
("elfStyle", ctypes.c_ubyte * 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 LOGFONTA {
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: [i8; 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 EXTLOGFONTA {
pub elfLogFont: LOGFONTA,
pub elfFullName: [u8; 64],
pub elfStyle: [u8; 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 LOGFONTA 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]int8
}
type PANOSE struct {
bFamilyType byte
bSerifStyle byte
bWeight byte
bProportion byte
bContrast byte
bStrokeVariation byte
bArmStyle byte
bLetterform byte
bMidline byte
bXHeight byte
}
type EXTLOGFONTA struct {
elfLogFont LOGFONTA
elfFullName [64]byte
elfStyle [32]byte
elfVersion uint32
elfStyleSize uint32
elfMatch uint32
elfReserved uint32
elfVendorId [4]byte
elfCulture uint32
elfPanose PANOSE
}type
LOGFONTA = 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 Shortint;
end;
PANOSE = record
bFamilyType: Byte;
bSerifStyle: Byte;
bWeight: Byte;
bProportion: Byte;
bContrast: Byte;
bStrokeVariation: Byte;
bArmStyle: Byte;
bLetterform: Byte;
bMidline: Byte;
bXHeight: Byte;
end;
EXTLOGFONTA = record
elfLogFont: LOGFONTA;
elfFullName: array[0..63] of Byte;
elfStyle: array[0..31] of Byte;
elfVersion: DWORD;
elfStyleSize: DWORD;
elfMatch: DWORD;
elfReserved: DWORD;
elfVendorId: array[0..3] of Byte;
elfCulture: DWORD;
elfPanose: PANOSE;
end;const LOGFONTA = 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]i8,
};
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 EXTLOGFONTA = extern struct {
elfLogFont: LOGFONTA,
elfFullName: [64]u8,
elfStyle: [32]u8,
elfVersion: u32,
elfStyleSize: u32,
elfMatch: u32,
elfReserved: u32,
elfVendorId: [4]u8,
elfCulture: u32,
elfPanose: PANOSE,
};type
LOGFONTA {.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, int8]
PANOSE {.bycopy.} = object
bFamilyType: uint8
bSerifStyle: uint8
bWeight: uint8
bProportion: uint8
bContrast: uint8
bStrokeVariation: uint8
bArmStyle: uint8
bLetterform: uint8
bMidline: uint8
bXHeight: uint8
EXTLOGFONTA {.bycopy.} = object
elfLogFont: LOGFONTA
elfFullName: array[64, uint8]
elfStyle: array[32, uint8]
elfVersion: uint32
elfStyleSize: uint32
elfMatch: uint32
elfReserved: uint32
elfVendorId: array[4, uint8]
elfCulture: uint32
elfPanose: PANOSEstruct LOGFONTA
{
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;
byte[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 EXTLOGFONTA
{
LOGFONTA elfLogFont;
ubyte[64] elfFullName;
ubyte[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 レイアウト)
; EXTLOGFONTA サイズ: 192 バイト(x64)
dim st, 48 ; 4byte整数×48(構造体サイズ 192 / 4 切り上げ)
; elfLogFont : LOGFONTA (+0, 60byte) varptr(st)+0 を基点に操作(60byte:入れ子/配列)
; elfFullName : BYTE (+60, 64byte) varptr(st)+60 を基点に操作(64byte:入れ子/配列)
; elfStyle : BYTE (+124, 32byte) varptr(st)+124 を基点に操作(32byte:入れ子/配列)
; elfVersion : DWORD (+156, 4byte) st.39 = 値 / 値 = st.39 (lpoke/lpeek も可)
; elfStyleSize : DWORD (+160, 4byte) st.40 = 値 / 値 = st.40 (lpoke/lpeek も可)
; elfMatch : DWORD (+164, 4byte) st.41 = 値 / 値 = st.41 (lpoke/lpeek も可)
; elfReserved : DWORD (+168, 4byte) st.42 = 値 / 値 = st.42 (lpoke/lpeek も可)
; elfVendorId : BYTE (+172, 4byte) varptr(st)+172 を基点に操作(4byte:入れ子/配列)
; elfCulture : DWORD (+176, 4byte) st.44 = 値 / 値 = st.44 (lpoke/lpeek も可)
; elfPanose : PANOSE (+180, 10byte) varptr(st)+180 を基点に操作(10byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global LOGFONTA
#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 byte 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 EXTLOGFONTA
#field LOGFONTA elfLogFont
#field byte elfFullName 64
#field byte 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, EXTLOGFONTA ; NSTRUCT 変数を確保
st->elfVersion = 100
mes "elfVersion=" + st->elfVersion