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

EXTTEXTMETRIC

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

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

フィールド

フィールドサイズx64x86説明
emSizeSHORT2+0+0公称フォントサイズ。
emPointSizeSHORT2+2+2公称ポイントサイズ。
emOrientationSHORT2+4+4文字の向き。
emMasterHeightSHORT2+6+6マスター単位での高さ。
emMinScaleSHORT2+8+8拡縮可能な最小スケール。
emMaxScaleSHORT2+10+10拡縮可能な最大スケール。
emMasterUnitsSHORT2+12+12em当たりのマスター単位数。
emCapHeightSHORT2+14+14大文字の高さ(キャップハイト)。
emXHeightSHORT2+16+16小文字xの高さ(エックスハイト)。
emLowerCaseAscentSHORT2+18+18小文字のアセント値。
emLowerCaseDescentSHORT2+20+20小文字のディセント値。
emSlantSHORT2+22+22文字の傾斜量。
emSuperScriptSHORT2+24+24上付き文字のオフセット。
emSubScriptSHORT2+26+26下付き文字のオフセット。
emSuperScriptSizeSHORT2+28+28上付き文字のサイズ。
emSubScriptSizeSHORT2+30+30下付き文字のサイズ。
emUnderlineOffsetSHORT2+32+32下線のオフセット位置。
emUnderlineWidthSHORT2+34+34下線の太さ。
emDoubleUpperUnderlineOffsetSHORT2+36+36二重下線の上側オフセット。
emDoubleLowerUnderlineOffsetSHORT2+38+38二重下線の下側オフセット。
emDoubleUpperUnderlineWidthSHORT2+40+40二重下線の上側の太さ。
emDoubleLowerUnderlineWidthSHORT2+42+42二重下線の下側の太さ。
emStrikeOutOffsetSHORT2+44+44打ち消し線のオフセット位置。
emStrikeOutWidthSHORT2+46+46打ち消し線の太さ。
emKernPairsWORD2+48+48カーニングペアの数。
emKernTracksWORD2+50+50カーニングトラックの数。

各言語での定義

#include <windows.h>

// EXTTEXTMETRIC  (x64 52 / x86 52 バイト)
typedef struct EXTTEXTMETRIC {
    SHORT emSize;
    SHORT emPointSize;
    SHORT emOrientation;
    SHORT emMasterHeight;
    SHORT emMinScale;
    SHORT emMaxScale;
    SHORT emMasterUnits;
    SHORT emCapHeight;
    SHORT emXHeight;
    SHORT emLowerCaseAscent;
    SHORT emLowerCaseDescent;
    SHORT emSlant;
    SHORT emSuperScript;
    SHORT emSubScript;
    SHORT emSuperScriptSize;
    SHORT emSubScriptSize;
    SHORT emUnderlineOffset;
    SHORT emUnderlineWidth;
    SHORT emDoubleUpperUnderlineOffset;
    SHORT emDoubleLowerUnderlineOffset;
    SHORT emDoubleUpperUnderlineWidth;
    SHORT emDoubleLowerUnderlineWidth;
    SHORT emStrikeOutOffset;
    SHORT emStrikeOutWidth;
    WORD emKernPairs;
    WORD emKernTracks;
} EXTTEXTMETRIC;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct EXTTEXTMETRIC
{
    public short emSize;
    public short emPointSize;
    public short emOrientation;
    public short emMasterHeight;
    public short emMinScale;
    public short emMaxScale;
    public short emMasterUnits;
    public short emCapHeight;
    public short emXHeight;
    public short emLowerCaseAscent;
    public short emLowerCaseDescent;
    public short emSlant;
    public short emSuperScript;
    public short emSubScript;
    public short emSuperScriptSize;
    public short emSubScriptSize;
    public short emUnderlineOffset;
    public short emUnderlineWidth;
    public short emDoubleUpperUnderlineOffset;
    public short emDoubleLowerUnderlineOffset;
    public short emDoubleUpperUnderlineWidth;
    public short emDoubleLowerUnderlineWidth;
    public short emStrikeOutOffset;
    public short emStrikeOutWidth;
    public ushort emKernPairs;
    public ushort emKernTracks;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure EXTTEXTMETRIC
    Public emSize As Short
    Public emPointSize As Short
    Public emOrientation As Short
    Public emMasterHeight As Short
    Public emMinScale As Short
    Public emMaxScale As Short
    Public emMasterUnits As Short
    Public emCapHeight As Short
    Public emXHeight As Short
    Public emLowerCaseAscent As Short
    Public emLowerCaseDescent As Short
    Public emSlant As Short
    Public emSuperScript As Short
    Public emSubScript As Short
    Public emSuperScriptSize As Short
    Public emSubScriptSize As Short
    Public emUnderlineOffset As Short
    Public emUnderlineWidth As Short
    Public emDoubleUpperUnderlineOffset As Short
    Public emDoubleLowerUnderlineOffset As Short
    Public emDoubleUpperUnderlineWidth As Short
    Public emDoubleLowerUnderlineWidth As Short
    Public emStrikeOutOffset As Short
    Public emStrikeOutWidth As Short
    Public emKernPairs As UShort
    Public emKernTracks As UShort
End Structure
import ctypes
from ctypes import wintypes

class EXTTEXTMETRIC(ctypes.Structure):
    _fields_ = [
        ("emSize", ctypes.c_short),
        ("emPointSize", ctypes.c_short),
        ("emOrientation", ctypes.c_short),
        ("emMasterHeight", ctypes.c_short),
        ("emMinScale", ctypes.c_short),
        ("emMaxScale", ctypes.c_short),
        ("emMasterUnits", ctypes.c_short),
        ("emCapHeight", ctypes.c_short),
        ("emXHeight", ctypes.c_short),
        ("emLowerCaseAscent", ctypes.c_short),
        ("emLowerCaseDescent", ctypes.c_short),
        ("emSlant", ctypes.c_short),
        ("emSuperScript", ctypes.c_short),
        ("emSubScript", ctypes.c_short),
        ("emSuperScriptSize", ctypes.c_short),
        ("emSubScriptSize", ctypes.c_short),
        ("emUnderlineOffset", ctypes.c_short),
        ("emUnderlineWidth", ctypes.c_short),
        ("emDoubleUpperUnderlineOffset", ctypes.c_short),
        ("emDoubleLowerUnderlineOffset", ctypes.c_short),
        ("emDoubleUpperUnderlineWidth", ctypes.c_short),
        ("emDoubleLowerUnderlineWidth", ctypes.c_short),
        ("emStrikeOutOffset", ctypes.c_short),
        ("emStrikeOutWidth", ctypes.c_short),
        ("emKernPairs", ctypes.c_ushort),
        ("emKernTracks", ctypes.c_ushort),
    ]
#[repr(C)]
pub struct EXTTEXTMETRIC {
    pub emSize: i16,
    pub emPointSize: i16,
    pub emOrientation: i16,
    pub emMasterHeight: i16,
    pub emMinScale: i16,
    pub emMaxScale: i16,
    pub emMasterUnits: i16,
    pub emCapHeight: i16,
    pub emXHeight: i16,
    pub emLowerCaseAscent: i16,
    pub emLowerCaseDescent: i16,
    pub emSlant: i16,
    pub emSuperScript: i16,
    pub emSubScript: i16,
    pub emSuperScriptSize: i16,
    pub emSubScriptSize: i16,
    pub emUnderlineOffset: i16,
    pub emUnderlineWidth: i16,
    pub emDoubleUpperUnderlineOffset: i16,
    pub emDoubleLowerUnderlineOffset: i16,
    pub emDoubleUpperUnderlineWidth: i16,
    pub emDoubleLowerUnderlineWidth: i16,
    pub emStrikeOutOffset: i16,
    pub emStrikeOutWidth: i16,
    pub emKernPairs: u16,
    pub emKernTracks: u16,
}
import "golang.org/x/sys/windows"

type EXTTEXTMETRIC struct {
	emSize int16
	emPointSize int16
	emOrientation int16
	emMasterHeight int16
	emMinScale int16
	emMaxScale int16
	emMasterUnits int16
	emCapHeight int16
	emXHeight int16
	emLowerCaseAscent int16
	emLowerCaseDescent int16
	emSlant int16
	emSuperScript int16
	emSubScript int16
	emSuperScriptSize int16
	emSubScriptSize int16
	emUnderlineOffset int16
	emUnderlineWidth int16
	emDoubleUpperUnderlineOffset int16
	emDoubleLowerUnderlineOffset int16
	emDoubleUpperUnderlineWidth int16
	emDoubleLowerUnderlineWidth int16
	emStrikeOutOffset int16
	emStrikeOutWidth int16
	emKernPairs uint16
	emKernTracks uint16
}
type
  EXTTEXTMETRIC = record
    emSize: Smallint;
    emPointSize: Smallint;
    emOrientation: Smallint;
    emMasterHeight: Smallint;
    emMinScale: Smallint;
    emMaxScale: Smallint;
    emMasterUnits: Smallint;
    emCapHeight: Smallint;
    emXHeight: Smallint;
    emLowerCaseAscent: Smallint;
    emLowerCaseDescent: Smallint;
    emSlant: Smallint;
    emSuperScript: Smallint;
    emSubScript: Smallint;
    emSuperScriptSize: Smallint;
    emSubScriptSize: Smallint;
    emUnderlineOffset: Smallint;
    emUnderlineWidth: Smallint;
    emDoubleUpperUnderlineOffset: Smallint;
    emDoubleLowerUnderlineOffset: Smallint;
    emDoubleUpperUnderlineWidth: Smallint;
    emDoubleLowerUnderlineWidth: Smallint;
    emStrikeOutOffset: Smallint;
    emStrikeOutWidth: Smallint;
    emKernPairs: Word;
    emKernTracks: Word;
  end;
const EXTTEXTMETRIC = extern struct {
    emSize: i16,
    emPointSize: i16,
    emOrientation: i16,
    emMasterHeight: i16,
    emMinScale: i16,
    emMaxScale: i16,
    emMasterUnits: i16,
    emCapHeight: i16,
    emXHeight: i16,
    emLowerCaseAscent: i16,
    emLowerCaseDescent: i16,
    emSlant: i16,
    emSuperScript: i16,
    emSubScript: i16,
    emSuperScriptSize: i16,
    emSubScriptSize: i16,
    emUnderlineOffset: i16,
    emUnderlineWidth: i16,
    emDoubleUpperUnderlineOffset: i16,
    emDoubleLowerUnderlineOffset: i16,
    emDoubleUpperUnderlineWidth: i16,
    emDoubleLowerUnderlineWidth: i16,
    emStrikeOutOffset: i16,
    emStrikeOutWidth: i16,
    emKernPairs: u16,
    emKernTracks: u16,
};
type
  EXTTEXTMETRIC {.bycopy.} = object
    emSize: int16
    emPointSize: int16
    emOrientation: int16
    emMasterHeight: int16
    emMinScale: int16
    emMaxScale: int16
    emMasterUnits: int16
    emCapHeight: int16
    emXHeight: int16
    emLowerCaseAscent: int16
    emLowerCaseDescent: int16
    emSlant: int16
    emSuperScript: int16
    emSubScript: int16
    emSuperScriptSize: int16
    emSubScriptSize: int16
    emUnderlineOffset: int16
    emUnderlineWidth: int16
    emDoubleUpperUnderlineOffset: int16
    emDoubleLowerUnderlineOffset: int16
    emDoubleUpperUnderlineWidth: int16
    emDoubleLowerUnderlineWidth: int16
    emStrikeOutOffset: int16
    emStrikeOutWidth: int16
    emKernPairs: uint16
    emKernTracks: uint16
struct EXTTEXTMETRIC
{
    short emSize;
    short emPointSize;
    short emOrientation;
    short emMasterHeight;
    short emMinScale;
    short emMaxScale;
    short emMasterUnits;
    short emCapHeight;
    short emXHeight;
    short emLowerCaseAscent;
    short emLowerCaseDescent;
    short emSlant;
    short emSuperScript;
    short emSubScript;
    short emSuperScriptSize;
    short emSubScriptSize;
    short emUnderlineOffset;
    short emUnderlineWidth;
    short emDoubleUpperUnderlineOffset;
    short emDoubleLowerUnderlineOffset;
    short emDoubleUpperUnderlineWidth;
    short emDoubleLowerUnderlineWidth;
    short emStrikeOutOffset;
    short emStrikeOutWidth;
    ushort emKernPairs;
    ushort emKernTracks;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; EXTTEXTMETRIC サイズ: 52 バイト(x64)
dim st, 13    ; 4byte整数×13(構造体サイズ 52 / 4 切り上げ)
; emSize : SHORT (+0, 2byte)  wpoke st,0,値  /  値 = wpeek(st,0)
; emPointSize : SHORT (+2, 2byte)  wpoke st,2,値  /  値 = wpeek(st,2)
; emOrientation : SHORT (+4, 2byte)  wpoke st,4,値  /  値 = wpeek(st,4)
; emMasterHeight : SHORT (+6, 2byte)  wpoke st,6,値  /  値 = wpeek(st,6)
; emMinScale : SHORT (+8, 2byte)  wpoke st,8,値  /  値 = wpeek(st,8)
; emMaxScale : SHORT (+10, 2byte)  wpoke st,10,値  /  値 = wpeek(st,10)
; emMasterUnits : SHORT (+12, 2byte)  wpoke st,12,値  /  値 = wpeek(st,12)
; emCapHeight : SHORT (+14, 2byte)  wpoke st,14,値  /  値 = wpeek(st,14)
; emXHeight : SHORT (+16, 2byte)  wpoke st,16,値  /  値 = wpeek(st,16)
; emLowerCaseAscent : SHORT (+18, 2byte)  wpoke st,18,値  /  値 = wpeek(st,18)
; emLowerCaseDescent : SHORT (+20, 2byte)  wpoke st,20,値  /  値 = wpeek(st,20)
; emSlant : SHORT (+22, 2byte)  wpoke st,22,値  /  値 = wpeek(st,22)
; emSuperScript : SHORT (+24, 2byte)  wpoke st,24,値  /  値 = wpeek(st,24)
; emSubScript : SHORT (+26, 2byte)  wpoke st,26,値  /  値 = wpeek(st,26)
; emSuperScriptSize : SHORT (+28, 2byte)  wpoke st,28,値  /  値 = wpeek(st,28)
; emSubScriptSize : SHORT (+30, 2byte)  wpoke st,30,値  /  値 = wpeek(st,30)
; emUnderlineOffset : SHORT (+32, 2byte)  wpoke st,32,値  /  値 = wpeek(st,32)
; emUnderlineWidth : SHORT (+34, 2byte)  wpoke st,34,値  /  値 = wpeek(st,34)
; emDoubleUpperUnderlineOffset : SHORT (+36, 2byte)  wpoke st,36,値  /  値 = wpeek(st,36)
; emDoubleLowerUnderlineOffset : SHORT (+38, 2byte)  wpoke st,38,値  /  値 = wpeek(st,38)
; emDoubleUpperUnderlineWidth : SHORT (+40, 2byte)  wpoke st,40,値  /  値 = wpeek(st,40)
; emDoubleLowerUnderlineWidth : SHORT (+42, 2byte)  wpoke st,42,値  /  値 = wpeek(st,42)
; emStrikeOutOffset : SHORT (+44, 2byte)  wpoke st,44,値  /  値 = wpeek(st,44)
; emStrikeOutWidth : SHORT (+46, 2byte)  wpoke st,46,値  /  値 = wpeek(st,46)
; emKernPairs : WORD (+48, 2byte)  wpoke st,48,値  /  値 = wpeek(st,48)
; emKernTracks : WORD (+50, 2byte)  wpoke st,50,値  /  値 = wpeek(st,50)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global EXTTEXTMETRIC
    #field short emSize
    #field short emPointSize
    #field short emOrientation
    #field short emMasterHeight
    #field short emMinScale
    #field short emMaxScale
    #field short emMasterUnits
    #field short emCapHeight
    #field short emXHeight
    #field short emLowerCaseAscent
    #field short emLowerCaseDescent
    #field short emSlant
    #field short emSuperScript
    #field short emSubScript
    #field short emSuperScriptSize
    #field short emSubScriptSize
    #field short emUnderlineOffset
    #field short emUnderlineWidth
    #field short emDoubleUpperUnderlineOffset
    #field short emDoubleLowerUnderlineOffset
    #field short emDoubleUpperUnderlineWidth
    #field short emDoubleLowerUnderlineWidth
    #field short emStrikeOutOffset
    #field short emStrikeOutWidth
    #field short emKernPairs
    #field short emKernTracks
#endstruct

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