OUTLINETEXTMETRICA
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 | ||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| otmSize | DWORD | 4 | +0 | +0 | OUTLINETEXTMETRIC 構造体のサイズ (バイト単位)。 | ||||||||||||||
| otmTextMetrics | TEXTMETRICA | 56 | +4 | +4 | フォントに関する詳細情報を格納した TEXTMETRIC 構造体。 | ||||||||||||||
| otmFiller | BYTE | 1 | +60 | +60 | 構造体をバイト境界に整列させるための値。 | ||||||||||||||
| otmPanoseNumber | PANOSE | 10 | +61 | +61 | このフォントの PANOSE 番号。 | ||||||||||||||
| otmfsSelection | DWORD | 4 | +72 | +72 | フォントパターンの性質。このメンバーには次のビットの組み合わせを指定できます。
| ||||||||||||||
| otmfsType | DWORD | 4 | +76 | +76 | フォントがライセンスされているかどうかを示します。ライセンスされたフォントは、変更したり交換したりしてはなりません。ビット 1 が設定されている場合、そのフォントをドキュメントに埋め込むことはできません。ビット 1 がクリアされている場合は埋め込むことができます。ビット 2 が設定されている場合、埋め込みは読み取り専用です。 | ||||||||||||||
| otmsCharSlopeRise | INT | 4 | +80 | +80 | カーソルの傾き。傾きが垂直の場合、この値は 1 です。アプリケーションは、この値と otmsCharSlopeRun メンバーの値を使用して、主イタリック角 (otmItalicAngle メンバーで指定されます) と同じ傾きを持つ斜体のカーソルを作成できます。 | ||||||||||||||
| otmsCharSlopeRun | INT | 4 | +84 | +84 | カーソルの傾き。傾きが垂直の場合、この値は 0 です。アプリケーションは、この値と otmsCharSlopeRise メンバーの値を使用して、主イタリック角 (otmItalicAngle メンバーで指定されます) と同じ傾きを持つ斜体のカーソルを作成できます。 | ||||||||||||||
| otmItalicAngle | INT | 4 | +88 | +88 | フォントの主イタリック角。垂直方向から反時計回りに 10 分の 1 度単位で表します。標準 (ローマン) フォントの値は 0 です。斜体フォントは通常、負のイタリック角を持ちます (つまり右に傾きます)。 | ||||||||||||||
| otmEMSquare | DWORD | 4 | +92 | +92 | このフォントの em 四角形 (em square) の x 方向または y 方向の大きさを定義する論理単位の数。(em 四角形では、x 方向と y 方向の単位数は常に同じです。) | ||||||||||||||
| otmAscent | INT | 4 | +96 | +96 | このフォントの文字がベースラインより上に伸びる最大距離。これはフォントの活字上 (typographic) のアセントです。 | ||||||||||||||
| otmDescent | INT | 4 | +100 | +100 | このフォントの文字がベースラインより下に伸びる最大距離。これはフォントの活字上 (typographic) のディセントです。 | ||||||||||||||
| otmLineGap | DWORD | 4 | +104 | +104 | 活字上の行間 (行送り)。 | ||||||||||||||
| otmsCapEmHeight | DWORD | 4 | +108 | +108 | サポートされていません。 | ||||||||||||||
| otmsXHeight | DWORD | 4 | +112 | +112 | サポートされていません。 | ||||||||||||||
| otmrcFontBox | RECT | 16 | +116 | +116 | フォントの境界ボックス。 | ||||||||||||||
| otmMacAscent | INT | 4 | +132 | +132 | Macintosh コンピューターにおいて、このフォントの文字がベースラインより上に伸びる最大距離。 | ||||||||||||||
| otmMacDescent | INT | 4 | +136 | +136 | Macintosh コンピューターにおいて、このフォントの文字がベースラインより下に伸びる最大距離。 | ||||||||||||||
| otmMacLineGap | DWORD | 4 | +140 | +140 | Macintosh コンピューター用の行間情報。 | ||||||||||||||
| otmusMinimumPPEM | DWORD | 4 | +144 | +144 | このフォントに推奨される最小サイズ (em 四角形あたりのピクセル数)。 | ||||||||||||||
| otmptSubscriptSize | POINT | 8 | +148 | +148 | このフォントにおける下付き文字の推奨される水平方向および垂直方向のサイズ。 | ||||||||||||||
| otmptSubscriptOffset | POINT | 8 | +156 | +156 | このフォントにおける下付き文字の推奨される水平方向および垂直方向のオフセット。下付き文字のオフセットは、文字の原点から下付き文字の原点までを測定した値です。 | ||||||||||||||
| otmptSuperscriptSize | POINT | 8 | +164 | +164 | このフォントにおける上付き文字の推奨される水平方向および垂直方向のサイズ。 | ||||||||||||||
| otmptSuperscriptOffset | POINT | 8 | +172 | +172 | このフォントにおける上付き文字の推奨される水平方向および垂直方向のオフセット。上付き文字のオフセットは、文字のベースラインから上付き文字のベースラインまでを測定した値です。 | ||||||||||||||
| otmsStrikeoutSize | DWORD | 4 | +180 | +180 | このフォントの取り消し線の太さ。通常、これはフォントの em ダッシュの幅です。 | ||||||||||||||
| otmsStrikeoutPosition | INT | 4 | +184 | +184 | このフォントのベースラインを基準とした取り消し線の位置。正の値はベースラインより上、負の値はベースラインより下を表します。 | ||||||||||||||
| otmsUnderscoreSize | INT | 4 | +188 | +188 | このフォントの下線文字の太さ。 | ||||||||||||||
| otmsUnderscorePosition | INT | 4 | +192 | +192 | このフォントの下線文字の位置。 | ||||||||||||||
| otmpFamilyName | LPSTR | 8/4 | +200 | +196 | 構造体の先頭から、フォントのファミリ名を示す文字列までのオフセット。 | ||||||||||||||
| otmpFaceName | LPSTR | 8/4 | +208 | +200 | 構造体の先頭から、フォントの書体名を示す文字列までのオフセット。(この書体名は、LOGFONT 構造体で指定される名前に対応します。) | ||||||||||||||
| otmpStyleName | LPSTR | 8/4 | +216 | +204 | 構造体の先頭から、フォントのスタイル名を示す文字列までのオフセット。 | ||||||||||||||
| otmpFullName | LPSTR | 8/4 | +224 | +208 | 構造体の先頭から、フォントのフルネームを示す文字列までのオフセット。この名前はフォントごとに一意であり、多くの場合バージョン番号やその他の識別情報を含みます。 |
公式ドキュメント
OUTLINETEXTMETRIC 構造体は、TrueType フォントを説明するメトリック情報を格納します。
解説(Remarks)
OUTLINETEXTMETRIC が返すサイズは論理単位で表されます。つまり、指定されたディスプレイコンテキストの現在のマッピングモードに依存します。
なお、OUTLINETEXTMETRIC は現在のパック設定を使用して定義されています。問題を避けるため、アプリケーションはプラットフォーム既定のパッキングでビルドしてください。たとえば、32 ビット版 Windows では既定で 8 バイトパッキングが使用されます。詳細については、C-Compiler Packing Issues を参照してください。
wingdi.h ヘッダーは、UNICODE プリプロセッサ定数の定義に応じて、この関数の ANSI 版または Unicode 版を自動的に選択するエイリアスとして OUTLINETEXTMETRIC を定義しています。エンコーディング非依存のエイリアスを、エンコーディング非依存でないコードと混在させると、不一致が生じてコンパイルエラーや実行時エラーの原因となることがあります。詳細については、Conventions for Function Prototypes を参照してください。
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)
各言語での定義
#include <windows.h>
// TEXTMETRICA (x64 56 / x86 56 バイト)
typedef struct TEXTMETRICA {
INT tmHeight;
INT tmAscent;
INT tmDescent;
INT tmInternalLeading;
INT tmExternalLeading;
INT tmAveCharWidth;
INT tmMaxCharWidth;
INT tmWeight;
INT tmOverhang;
INT tmDigitizedAspectX;
INT tmDigitizedAspectY;
BYTE tmFirstChar;
BYTE tmLastChar;
BYTE tmDefaultChar;
BYTE tmBreakChar;
BYTE tmItalic;
BYTE tmUnderlined;
BYTE tmStruckOut;
TMPF_FLAGS tmPitchAndFamily;
BYTE tmCharSet;
} TEXTMETRICA;
// 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;
// RECT (x64 16 / x86 16 バイト)
typedef struct RECT {
INT left;
INT top;
INT right;
INT bottom;
} RECT;
// POINT (x64 8 / x86 8 バイト)
typedef struct POINT {
INT x;
INT y;
} POINT;
// OUTLINETEXTMETRICA (x64 232 / x86 212 バイト)
typedef struct OUTLINETEXTMETRICA {
DWORD otmSize;
TEXTMETRICA otmTextMetrics;
BYTE otmFiller;
PANOSE otmPanoseNumber;
DWORD otmfsSelection;
DWORD otmfsType;
INT otmsCharSlopeRise;
INT otmsCharSlopeRun;
INT otmItalicAngle;
DWORD otmEMSquare;
INT otmAscent;
INT otmDescent;
DWORD otmLineGap;
DWORD otmsCapEmHeight;
DWORD otmsXHeight;
RECT otmrcFontBox;
INT otmMacAscent;
INT otmMacDescent;
DWORD otmMacLineGap;
DWORD otmusMinimumPPEM;
POINT otmptSubscriptSize;
POINT otmptSubscriptOffset;
POINT otmptSuperscriptSize;
POINT otmptSuperscriptOffset;
DWORD otmsStrikeoutSize;
INT otmsStrikeoutPosition;
INT otmsUnderscoreSize;
INT otmsUnderscorePosition;
LPSTR otmpFamilyName;
LPSTR otmpFaceName;
LPSTR otmpStyleName;
LPSTR otmpFullName;
} OUTLINETEXTMETRICA;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct TEXTMETRICA
{
public int tmHeight;
public int tmAscent;
public int tmDescent;
public int tmInternalLeading;
public int tmExternalLeading;
public int tmAveCharWidth;
public int tmMaxCharWidth;
public int tmWeight;
public int tmOverhang;
public int tmDigitizedAspectX;
public int tmDigitizedAspectY;
public byte tmFirstChar;
public byte tmLastChar;
public byte tmDefaultChar;
public byte tmBreakChar;
public byte tmItalic;
public byte tmUnderlined;
public byte tmStruckOut;
public byte tmPitchAndFamily;
public byte tmCharSet;
}
[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 RECT
{
public int left;
public int top;
public int right;
public int bottom;
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct POINT
{
public int x;
public int y;
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct OUTLINETEXTMETRICA
{
public uint otmSize;
public TEXTMETRICA otmTextMetrics;
public byte otmFiller;
public PANOSE otmPanoseNumber;
public uint otmfsSelection;
public uint otmfsType;
public int otmsCharSlopeRise;
public int otmsCharSlopeRun;
public int otmItalicAngle;
public uint otmEMSquare;
public int otmAscent;
public int otmDescent;
public uint otmLineGap;
public uint otmsCapEmHeight;
public uint otmsXHeight;
public RECT otmrcFontBox;
public int otmMacAscent;
public int otmMacDescent;
public uint otmMacLineGap;
public uint otmusMinimumPPEM;
public POINT otmptSubscriptSize;
public POINT otmptSubscriptOffset;
public POINT otmptSuperscriptSize;
public POINT otmptSuperscriptOffset;
public uint otmsStrikeoutSize;
public int otmsStrikeoutPosition;
public int otmsUnderscoreSize;
public int otmsUnderscorePosition;
public IntPtr otmpFamilyName;
public IntPtr otmpFaceName;
public IntPtr otmpStyleName;
public IntPtr otmpFullName;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure TEXTMETRICA
Public tmHeight As Integer
Public tmAscent As Integer
Public tmDescent As Integer
Public tmInternalLeading As Integer
Public tmExternalLeading As Integer
Public tmAveCharWidth As Integer
Public tmMaxCharWidth As Integer
Public tmWeight As Integer
Public tmOverhang As Integer
Public tmDigitizedAspectX As Integer
Public tmDigitizedAspectY As Integer
Public tmFirstChar As Byte
Public tmLastChar As Byte
Public tmDefaultChar As Byte
Public tmBreakChar As Byte
Public tmItalic As Byte
Public tmUnderlined As Byte
Public tmStruckOut As Byte
Public tmPitchAndFamily As Byte
Public tmCharSet As Byte
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 RECT
Public left As Integer
Public top As Integer
Public right As Integer
Public bottom As Integer
End Structure
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure POINT
Public x As Integer
Public y As Integer
End Structure
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure OUTLINETEXTMETRICA
Public otmSize As UInteger
Public otmTextMetrics As TEXTMETRICA
Public otmFiller As Byte
Public otmPanoseNumber As PANOSE
Public otmfsSelection As UInteger
Public otmfsType As UInteger
Public otmsCharSlopeRise As Integer
Public otmsCharSlopeRun As Integer
Public otmItalicAngle As Integer
Public otmEMSquare As UInteger
Public otmAscent As Integer
Public otmDescent As Integer
Public otmLineGap As UInteger
Public otmsCapEmHeight As UInteger
Public otmsXHeight As UInteger
Public otmrcFontBox As RECT
Public otmMacAscent As Integer
Public otmMacDescent As Integer
Public otmMacLineGap As UInteger
Public otmusMinimumPPEM As UInteger
Public otmptSubscriptSize As POINT
Public otmptSubscriptOffset As POINT
Public otmptSuperscriptSize As POINT
Public otmptSuperscriptOffset As POINT
Public otmsStrikeoutSize As UInteger
Public otmsStrikeoutPosition As Integer
Public otmsUnderscoreSize As Integer
Public otmsUnderscorePosition As Integer
Public otmpFamilyName As IntPtr
Public otmpFaceName As IntPtr
Public otmpStyleName As IntPtr
Public otmpFullName As IntPtr
End Structureimport ctypes
from ctypes import wintypes
class TEXTMETRICA(ctypes.Structure):
_fields_ = [
("tmHeight", ctypes.c_int),
("tmAscent", ctypes.c_int),
("tmDescent", ctypes.c_int),
("tmInternalLeading", ctypes.c_int),
("tmExternalLeading", ctypes.c_int),
("tmAveCharWidth", ctypes.c_int),
("tmMaxCharWidth", ctypes.c_int),
("tmWeight", ctypes.c_int),
("tmOverhang", ctypes.c_int),
("tmDigitizedAspectX", ctypes.c_int),
("tmDigitizedAspectY", ctypes.c_int),
("tmFirstChar", ctypes.c_ubyte),
("tmLastChar", ctypes.c_ubyte),
("tmDefaultChar", ctypes.c_ubyte),
("tmBreakChar", ctypes.c_ubyte),
("tmItalic", ctypes.c_ubyte),
("tmUnderlined", ctypes.c_ubyte),
("tmStruckOut", ctypes.c_ubyte),
("tmPitchAndFamily", ctypes.c_ubyte),
("tmCharSet", ctypes.c_ubyte),
]
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 RECT(ctypes.Structure):
_fields_ = [
("left", ctypes.c_int),
("top", ctypes.c_int),
("right", ctypes.c_int),
("bottom", ctypes.c_int),
]
class POINT(ctypes.Structure):
_fields_ = [
("x", ctypes.c_int),
("y", ctypes.c_int),
]
class OUTLINETEXTMETRICA(ctypes.Structure):
_fields_ = [
("otmSize", wintypes.DWORD),
("otmTextMetrics", TEXTMETRICA),
("otmFiller", ctypes.c_ubyte),
("otmPanoseNumber", PANOSE),
("otmfsSelection", wintypes.DWORD),
("otmfsType", wintypes.DWORD),
("otmsCharSlopeRise", ctypes.c_int),
("otmsCharSlopeRun", ctypes.c_int),
("otmItalicAngle", ctypes.c_int),
("otmEMSquare", wintypes.DWORD),
("otmAscent", ctypes.c_int),
("otmDescent", ctypes.c_int),
("otmLineGap", wintypes.DWORD),
("otmsCapEmHeight", wintypes.DWORD),
("otmsXHeight", wintypes.DWORD),
("otmrcFontBox", RECT),
("otmMacAscent", ctypes.c_int),
("otmMacDescent", ctypes.c_int),
("otmMacLineGap", wintypes.DWORD),
("otmusMinimumPPEM", wintypes.DWORD),
("otmptSubscriptSize", POINT),
("otmptSubscriptOffset", POINT),
("otmptSuperscriptSize", POINT),
("otmptSuperscriptOffset", POINT),
("otmsStrikeoutSize", wintypes.DWORD),
("otmsStrikeoutPosition", ctypes.c_int),
("otmsUnderscoreSize", ctypes.c_int),
("otmsUnderscorePosition", ctypes.c_int),
("otmpFamilyName", ctypes.c_void_p),
("otmpFaceName", ctypes.c_void_p),
("otmpStyleName", ctypes.c_void_p),
("otmpFullName", ctypes.c_void_p),
]#[repr(C)]
pub struct TEXTMETRICA {
pub tmHeight: i32,
pub tmAscent: i32,
pub tmDescent: i32,
pub tmInternalLeading: i32,
pub tmExternalLeading: i32,
pub tmAveCharWidth: i32,
pub tmMaxCharWidth: i32,
pub tmWeight: i32,
pub tmOverhang: i32,
pub tmDigitizedAspectX: i32,
pub tmDigitizedAspectY: i32,
pub tmFirstChar: u8,
pub tmLastChar: u8,
pub tmDefaultChar: u8,
pub tmBreakChar: u8,
pub tmItalic: u8,
pub tmUnderlined: u8,
pub tmStruckOut: u8,
pub tmPitchAndFamily: u8,
pub tmCharSet: u8,
}
#[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 RECT {
pub left: i32,
pub top: i32,
pub right: i32,
pub bottom: i32,
}
#[repr(C)]
pub struct POINT {
pub x: i32,
pub y: i32,
}
#[repr(C)]
pub struct OUTLINETEXTMETRICA {
pub otmSize: u32,
pub otmTextMetrics: TEXTMETRICA,
pub otmFiller: u8,
pub otmPanoseNumber: PANOSE,
pub otmfsSelection: u32,
pub otmfsType: u32,
pub otmsCharSlopeRise: i32,
pub otmsCharSlopeRun: i32,
pub otmItalicAngle: i32,
pub otmEMSquare: u32,
pub otmAscent: i32,
pub otmDescent: i32,
pub otmLineGap: u32,
pub otmsCapEmHeight: u32,
pub otmsXHeight: u32,
pub otmrcFontBox: RECT,
pub otmMacAscent: i32,
pub otmMacDescent: i32,
pub otmMacLineGap: u32,
pub otmusMinimumPPEM: u32,
pub otmptSubscriptSize: POINT,
pub otmptSubscriptOffset: POINT,
pub otmptSuperscriptSize: POINT,
pub otmptSuperscriptOffset: POINT,
pub otmsStrikeoutSize: u32,
pub otmsStrikeoutPosition: i32,
pub otmsUnderscoreSize: i32,
pub otmsUnderscorePosition: i32,
pub otmpFamilyName: *mut core::ffi::c_void,
pub otmpFaceName: *mut core::ffi::c_void,
pub otmpStyleName: *mut core::ffi::c_void,
pub otmpFullName: *mut core::ffi::c_void,
}import "golang.org/x/sys/windows"
type TEXTMETRICA struct {
tmHeight int32
tmAscent int32
tmDescent int32
tmInternalLeading int32
tmExternalLeading int32
tmAveCharWidth int32
tmMaxCharWidth int32
tmWeight int32
tmOverhang int32
tmDigitizedAspectX int32
tmDigitizedAspectY int32
tmFirstChar byte
tmLastChar byte
tmDefaultChar byte
tmBreakChar byte
tmItalic byte
tmUnderlined byte
tmStruckOut byte
tmPitchAndFamily byte
tmCharSet byte
}
type PANOSE struct {
bFamilyType byte
bSerifStyle byte
bWeight byte
bProportion byte
bContrast byte
bStrokeVariation byte
bArmStyle byte
bLetterform byte
bMidline byte
bXHeight byte
}
type RECT struct {
left int32
top int32
right int32
bottom int32
}
type POINT struct {
x int32
y int32
}
type OUTLINETEXTMETRICA struct {
otmSize uint32
otmTextMetrics TEXTMETRICA
otmFiller byte
otmPanoseNumber PANOSE
otmfsSelection uint32
otmfsType uint32
otmsCharSlopeRise int32
otmsCharSlopeRun int32
otmItalicAngle int32
otmEMSquare uint32
otmAscent int32
otmDescent int32
otmLineGap uint32
otmsCapEmHeight uint32
otmsXHeight uint32
otmrcFontBox RECT
otmMacAscent int32
otmMacDescent int32
otmMacLineGap uint32
otmusMinimumPPEM uint32
otmptSubscriptSize POINT
otmptSubscriptOffset POINT
otmptSuperscriptSize POINT
otmptSuperscriptOffset POINT
otmsStrikeoutSize uint32
otmsStrikeoutPosition int32
otmsUnderscoreSize int32
otmsUnderscorePosition int32
otmpFamilyName uintptr
otmpFaceName uintptr
otmpStyleName uintptr
otmpFullName uintptr
}type
TEXTMETRICA = record
tmHeight: Integer;
tmAscent: Integer;
tmDescent: Integer;
tmInternalLeading: Integer;
tmExternalLeading: Integer;
tmAveCharWidth: Integer;
tmMaxCharWidth: Integer;
tmWeight: Integer;
tmOverhang: Integer;
tmDigitizedAspectX: Integer;
tmDigitizedAspectY: Integer;
tmFirstChar: Byte;
tmLastChar: Byte;
tmDefaultChar: Byte;
tmBreakChar: Byte;
tmItalic: Byte;
tmUnderlined: Byte;
tmStruckOut: Byte;
tmPitchAndFamily: Byte;
tmCharSet: Byte;
end;
PANOSE = record
bFamilyType: Byte;
bSerifStyle: Byte;
bWeight: Byte;
bProportion: Byte;
bContrast: Byte;
bStrokeVariation: Byte;
bArmStyle: Byte;
bLetterform: Byte;
bMidline: Byte;
bXHeight: Byte;
end;
RECT = record
left: Integer;
top: Integer;
right: Integer;
bottom: Integer;
end;
POINT = record
x: Integer;
y: Integer;
end;
OUTLINETEXTMETRICA = record
otmSize: DWORD;
otmTextMetrics: TEXTMETRICA;
otmFiller: Byte;
otmPanoseNumber: PANOSE;
otmfsSelection: DWORD;
otmfsType: DWORD;
otmsCharSlopeRise: Integer;
otmsCharSlopeRun: Integer;
otmItalicAngle: Integer;
otmEMSquare: DWORD;
otmAscent: Integer;
otmDescent: Integer;
otmLineGap: DWORD;
otmsCapEmHeight: DWORD;
otmsXHeight: DWORD;
otmrcFontBox: RECT;
otmMacAscent: Integer;
otmMacDescent: Integer;
otmMacLineGap: DWORD;
otmusMinimumPPEM: DWORD;
otmptSubscriptSize: POINT;
otmptSubscriptOffset: POINT;
otmptSuperscriptSize: POINT;
otmptSuperscriptOffset: POINT;
otmsStrikeoutSize: DWORD;
otmsStrikeoutPosition: Integer;
otmsUnderscoreSize: Integer;
otmsUnderscorePosition: Integer;
otmpFamilyName: Pointer;
otmpFaceName: Pointer;
otmpStyleName: Pointer;
otmpFullName: Pointer;
end;const TEXTMETRICA = extern struct {
tmHeight: i32,
tmAscent: i32,
tmDescent: i32,
tmInternalLeading: i32,
tmExternalLeading: i32,
tmAveCharWidth: i32,
tmMaxCharWidth: i32,
tmWeight: i32,
tmOverhang: i32,
tmDigitizedAspectX: i32,
tmDigitizedAspectY: i32,
tmFirstChar: u8,
tmLastChar: u8,
tmDefaultChar: u8,
tmBreakChar: u8,
tmItalic: u8,
tmUnderlined: u8,
tmStruckOut: u8,
tmPitchAndFamily: u8,
tmCharSet: u8,
};
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 RECT = extern struct {
left: i32,
top: i32,
right: i32,
bottom: i32,
};
const POINT = extern struct {
x: i32,
y: i32,
};
const OUTLINETEXTMETRICA = extern struct {
otmSize: u32,
otmTextMetrics: TEXTMETRICA,
otmFiller: u8,
otmPanoseNumber: PANOSE,
otmfsSelection: u32,
otmfsType: u32,
otmsCharSlopeRise: i32,
otmsCharSlopeRun: i32,
otmItalicAngle: i32,
otmEMSquare: u32,
otmAscent: i32,
otmDescent: i32,
otmLineGap: u32,
otmsCapEmHeight: u32,
otmsXHeight: u32,
otmrcFontBox: RECT,
otmMacAscent: i32,
otmMacDescent: i32,
otmMacLineGap: u32,
otmusMinimumPPEM: u32,
otmptSubscriptSize: POINT,
otmptSubscriptOffset: POINT,
otmptSuperscriptSize: POINT,
otmptSuperscriptOffset: POINT,
otmsStrikeoutSize: u32,
otmsStrikeoutPosition: i32,
otmsUnderscoreSize: i32,
otmsUnderscorePosition: i32,
otmpFamilyName: ?*anyopaque,
otmpFaceName: ?*anyopaque,
otmpStyleName: ?*anyopaque,
otmpFullName: ?*anyopaque,
};type
TEXTMETRICA {.bycopy.} = object
tmHeight: int32
tmAscent: int32
tmDescent: int32
tmInternalLeading: int32
tmExternalLeading: int32
tmAveCharWidth: int32
tmMaxCharWidth: int32
tmWeight: int32
tmOverhang: int32
tmDigitizedAspectX: int32
tmDigitizedAspectY: int32
tmFirstChar: uint8
tmLastChar: uint8
tmDefaultChar: uint8
tmBreakChar: uint8
tmItalic: uint8
tmUnderlined: uint8
tmStruckOut: uint8
tmPitchAndFamily: uint8
tmCharSet: uint8
PANOSE {.bycopy.} = object
bFamilyType: uint8
bSerifStyle: uint8
bWeight: uint8
bProportion: uint8
bContrast: uint8
bStrokeVariation: uint8
bArmStyle: uint8
bLetterform: uint8
bMidline: uint8
bXHeight: uint8
RECT {.bycopy.} = object
left: int32
top: int32
right: int32
bottom: int32
POINT {.bycopy.} = object
x: int32
y: int32
OUTLINETEXTMETRICA {.bycopy.} = object
otmSize: uint32
otmTextMetrics: TEXTMETRICA
otmFiller: uint8
otmPanoseNumber: PANOSE
otmfsSelection: uint32
otmfsType: uint32
otmsCharSlopeRise: int32
otmsCharSlopeRun: int32
otmItalicAngle: int32
otmEMSquare: uint32
otmAscent: int32
otmDescent: int32
otmLineGap: uint32
otmsCapEmHeight: uint32
otmsXHeight: uint32
otmrcFontBox: RECT
otmMacAscent: int32
otmMacDescent: int32
otmMacLineGap: uint32
otmusMinimumPPEM: uint32
otmptSubscriptSize: POINT
otmptSubscriptOffset: POINT
otmptSuperscriptSize: POINT
otmptSuperscriptOffset: POINT
otmsStrikeoutSize: uint32
otmsStrikeoutPosition: int32
otmsUnderscoreSize: int32
otmsUnderscorePosition: int32
otmpFamilyName: pointer
otmpFaceName: pointer
otmpStyleName: pointer
otmpFullName: pointerstruct TEXTMETRICA
{
int tmHeight;
int tmAscent;
int tmDescent;
int tmInternalLeading;
int tmExternalLeading;
int tmAveCharWidth;
int tmMaxCharWidth;
int tmWeight;
int tmOverhang;
int tmDigitizedAspectX;
int tmDigitizedAspectY;
ubyte tmFirstChar;
ubyte tmLastChar;
ubyte tmDefaultChar;
ubyte tmBreakChar;
ubyte tmItalic;
ubyte tmUnderlined;
ubyte tmStruckOut;
ubyte tmPitchAndFamily;
ubyte tmCharSet;
}
struct PANOSE
{
ubyte bFamilyType;
ubyte bSerifStyle;
ubyte bWeight;
ubyte bProportion;
ubyte bContrast;
ubyte bStrokeVariation;
ubyte bArmStyle;
ubyte bLetterform;
ubyte bMidline;
ubyte bXHeight;
}
struct RECT
{
int left;
int top;
int right;
int bottom;
}
struct POINT
{
int x;
int y;
}
struct OUTLINETEXTMETRICA
{
uint otmSize;
TEXTMETRICA otmTextMetrics;
ubyte otmFiller;
PANOSE otmPanoseNumber;
uint otmfsSelection;
uint otmfsType;
int otmsCharSlopeRise;
int otmsCharSlopeRun;
int otmItalicAngle;
uint otmEMSquare;
int otmAscent;
int otmDescent;
uint otmLineGap;
uint otmsCapEmHeight;
uint otmsXHeight;
RECT otmrcFontBox;
int otmMacAscent;
int otmMacDescent;
uint otmMacLineGap;
uint otmusMinimumPPEM;
POINT otmptSubscriptSize;
POINT otmptSubscriptOffset;
POINT otmptSuperscriptSize;
POINT otmptSuperscriptOffset;
uint otmsStrikeoutSize;
int otmsStrikeoutPosition;
int otmsUnderscoreSize;
int otmsUnderscorePosition;
void* otmpFamilyName;
void* otmpFaceName;
void* otmpStyleName;
void* otmpFullName;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; OUTLINETEXTMETRICA サイズ: 212 バイト(x86)
dim st, 53 ; 4byte整数×53(構造体サイズ 212 / 4 切り上げ)
; otmSize : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; otmTextMetrics : TEXTMETRICA (+4, 56byte) varptr(st)+4 を基点に操作(56byte:入れ子/配列)
; otmFiller : BYTE (+60, 1byte) poke st,60,値 / 値 = peek(st,60)
; otmPanoseNumber : PANOSE (+61, 10byte) varptr(st)+61 を基点に操作(10byte:入れ子/配列)
; otmfsSelection : DWORD (+72, 4byte) st.18 = 値 / 値 = st.18 (lpoke/lpeek も可)
; otmfsType : DWORD (+76, 4byte) st.19 = 値 / 値 = st.19 (lpoke/lpeek も可)
; otmsCharSlopeRise : INT (+80, 4byte) st.20 = 値 / 値 = st.20 (lpoke/lpeek も可)
; otmsCharSlopeRun : INT (+84, 4byte) st.21 = 値 / 値 = st.21 (lpoke/lpeek も可)
; otmItalicAngle : INT (+88, 4byte) st.22 = 値 / 値 = st.22 (lpoke/lpeek も可)
; otmEMSquare : DWORD (+92, 4byte) st.23 = 値 / 値 = st.23 (lpoke/lpeek も可)
; otmAscent : INT (+96, 4byte) st.24 = 値 / 値 = st.24 (lpoke/lpeek も可)
; otmDescent : INT (+100, 4byte) st.25 = 値 / 値 = st.25 (lpoke/lpeek も可)
; otmLineGap : DWORD (+104, 4byte) st.26 = 値 / 値 = st.26 (lpoke/lpeek も可)
; otmsCapEmHeight : DWORD (+108, 4byte) st.27 = 値 / 値 = st.27 (lpoke/lpeek も可)
; otmsXHeight : DWORD (+112, 4byte) st.28 = 値 / 値 = st.28 (lpoke/lpeek も可)
; otmrcFontBox : RECT (+116, 16byte) varptr(st)+116 を基点に操作(16byte:入れ子/配列)
; otmMacAscent : INT (+132, 4byte) st.33 = 値 / 値 = st.33 (lpoke/lpeek も可)
; otmMacDescent : INT (+136, 4byte) st.34 = 値 / 値 = st.34 (lpoke/lpeek も可)
; otmMacLineGap : DWORD (+140, 4byte) st.35 = 値 / 値 = st.35 (lpoke/lpeek も可)
; otmusMinimumPPEM : DWORD (+144, 4byte) st.36 = 値 / 値 = st.36 (lpoke/lpeek も可)
; otmptSubscriptSize : POINT (+148, 8byte) varptr(st)+148 を基点に操作(8byte:入れ子/配列)
; otmptSubscriptOffset : POINT (+156, 8byte) varptr(st)+156 を基点に操作(8byte:入れ子/配列)
; otmptSuperscriptSize : POINT (+164, 8byte) varptr(st)+164 を基点に操作(8byte:入れ子/配列)
; otmptSuperscriptOffset : POINT (+172, 8byte) varptr(st)+172 を基点に操作(8byte:入れ子/配列)
; otmsStrikeoutSize : DWORD (+180, 4byte) st.45 = 値 / 値 = st.45 (lpoke/lpeek も可)
; otmsStrikeoutPosition : INT (+184, 4byte) st.46 = 値 / 値 = st.46 (lpoke/lpeek も可)
; otmsUnderscoreSize : INT (+188, 4byte) st.47 = 値 / 値 = st.47 (lpoke/lpeek も可)
; otmsUnderscorePosition : INT (+192, 4byte) st.48 = 値 / 値 = st.48 (lpoke/lpeek も可)
; otmpFamilyName : LPSTR (+196, 4byte) st.49 = 値 / 値 = st.49 (lpoke/lpeek も可)
; otmpFaceName : LPSTR (+200, 4byte) st.50 = 値 / 値 = st.50 (lpoke/lpeek も可)
; otmpStyleName : LPSTR (+204, 4byte) st.51 = 値 / 値 = st.51 (lpoke/lpeek も可)
; otmpFullName : LPSTR (+208, 4byte) st.52 = 値 / 値 = st.52 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; OUTLINETEXTMETRICA サイズ: 232 バイト(x64)
dim st, 58 ; 4byte整数×58(構造体サイズ 232 / 4 切り上げ)
; otmSize : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; otmTextMetrics : TEXTMETRICA (+4, 56byte) varptr(st)+4 を基点に操作(56byte:入れ子/配列)
; otmFiller : BYTE (+60, 1byte) poke st,60,値 / 値 = peek(st,60)
; otmPanoseNumber : PANOSE (+61, 10byte) varptr(st)+61 を基点に操作(10byte:入れ子/配列)
; otmfsSelection : DWORD (+72, 4byte) st.18 = 値 / 値 = st.18 (lpoke/lpeek も可)
; otmfsType : DWORD (+76, 4byte) st.19 = 値 / 値 = st.19 (lpoke/lpeek も可)
; otmsCharSlopeRise : INT (+80, 4byte) st.20 = 値 / 値 = st.20 (lpoke/lpeek も可)
; otmsCharSlopeRun : INT (+84, 4byte) st.21 = 値 / 値 = st.21 (lpoke/lpeek も可)
; otmItalicAngle : INT (+88, 4byte) st.22 = 値 / 値 = st.22 (lpoke/lpeek も可)
; otmEMSquare : DWORD (+92, 4byte) st.23 = 値 / 値 = st.23 (lpoke/lpeek も可)
; otmAscent : INT (+96, 4byte) st.24 = 値 / 値 = st.24 (lpoke/lpeek も可)
; otmDescent : INT (+100, 4byte) st.25 = 値 / 値 = st.25 (lpoke/lpeek も可)
; otmLineGap : DWORD (+104, 4byte) st.26 = 値 / 値 = st.26 (lpoke/lpeek も可)
; otmsCapEmHeight : DWORD (+108, 4byte) st.27 = 値 / 値 = st.27 (lpoke/lpeek も可)
; otmsXHeight : DWORD (+112, 4byte) st.28 = 値 / 値 = st.28 (lpoke/lpeek も可)
; otmrcFontBox : RECT (+116, 16byte) varptr(st)+116 を基点に操作(16byte:入れ子/配列)
; otmMacAscent : INT (+132, 4byte) st.33 = 値 / 値 = st.33 (lpoke/lpeek も可)
; otmMacDescent : INT (+136, 4byte) st.34 = 値 / 値 = st.34 (lpoke/lpeek も可)
; otmMacLineGap : DWORD (+140, 4byte) st.35 = 値 / 値 = st.35 (lpoke/lpeek も可)
; otmusMinimumPPEM : DWORD (+144, 4byte) st.36 = 値 / 値 = st.36 (lpoke/lpeek も可)
; otmptSubscriptSize : POINT (+148, 8byte) varptr(st)+148 を基点に操作(8byte:入れ子/配列)
; otmptSubscriptOffset : POINT (+156, 8byte) varptr(st)+156 を基点に操作(8byte:入れ子/配列)
; otmptSuperscriptSize : POINT (+164, 8byte) varptr(st)+164 を基点に操作(8byte:入れ子/配列)
; otmptSuperscriptOffset : POINT (+172, 8byte) varptr(st)+172 を基点に操作(8byte:入れ子/配列)
; otmsStrikeoutSize : DWORD (+180, 4byte) st.45 = 値 / 値 = st.45 (lpoke/lpeek も可)
; otmsStrikeoutPosition : INT (+184, 4byte) st.46 = 値 / 値 = st.46 (lpoke/lpeek も可)
; otmsUnderscoreSize : INT (+188, 4byte) st.47 = 値 / 値 = st.47 (lpoke/lpeek も可)
; otmsUnderscorePosition : INT (+192, 4byte) st.48 = 値 / 値 = st.48 (lpoke/lpeek も可)
; otmpFamilyName : LPSTR (+200, 8byte) qpoke st,200,値 / qpeek(st,200) ※IronHSPのみ。3.7/3.8は lpoke st,200,下位 : lpoke st,204,上位
; otmpFaceName : LPSTR (+208, 8byte) qpoke st,208,値 / qpeek(st,208) ※IronHSPのみ。3.7/3.8は lpoke st,208,下位 : lpoke st,212,上位
; otmpStyleName : LPSTR (+216, 8byte) qpoke st,216,値 / qpeek(st,216) ※IronHSPのみ。3.7/3.8は lpoke st,216,下位 : lpoke st,220,上位
; otmpFullName : LPSTR (+224, 8byte) qpoke st,224,値 / qpeek(st,224) ※IronHSPのみ。3.7/3.8は lpoke st,224,下位 : lpoke st,228,上位
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global TEXTMETRICA
#field int tmHeight
#field int tmAscent
#field int tmDescent
#field int tmInternalLeading
#field int tmExternalLeading
#field int tmAveCharWidth
#field int tmMaxCharWidth
#field int tmWeight
#field int tmOverhang
#field int tmDigitizedAspectX
#field int tmDigitizedAspectY
#field byte tmFirstChar
#field byte tmLastChar
#field byte tmDefaultChar
#field byte tmBreakChar
#field byte tmItalic
#field byte tmUnderlined
#field byte tmStruckOut
#field byte tmPitchAndFamily
#field byte tmCharSet
#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 RECT
#field int left
#field int top
#field int right
#field int bottom
#endstruct
#defstruct global POINT
#field int x
#field int y
#endstruct
#defstruct global OUTLINETEXTMETRICA
#field int otmSize
#field TEXTMETRICA otmTextMetrics
#field byte otmFiller
#field PANOSE otmPanoseNumber
#field int otmfsSelection
#field int otmfsType
#field int otmsCharSlopeRise
#field int otmsCharSlopeRun
#field int otmItalicAngle
#field int otmEMSquare
#field int otmAscent
#field int otmDescent
#field int otmLineGap
#field int otmsCapEmHeight
#field int otmsXHeight
#field RECT otmrcFontBox
#field int otmMacAscent
#field int otmMacDescent
#field int otmMacLineGap
#field int otmusMinimumPPEM
#field POINT otmptSubscriptSize
#field POINT otmptSubscriptOffset
#field POINT otmptSuperscriptSize
#field POINT otmptSuperscriptOffset
#field int otmsStrikeoutSize
#field int otmsStrikeoutPosition
#field int otmsUnderscoreSize
#field int otmsUnderscorePosition
#field intptr otmpFamilyName
#field intptr otmpFaceName
#field intptr otmpStyleName
#field intptr otmpFullName
#endstruct
stdim st, OUTLINETEXTMETRICA ; NSTRUCT 変数を確保
st->otmSize = 100
mes "otmSize=" + st->otmSize