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

DWRITE_INLINE_OBJECT_METRICS

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

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

フィールド

フィールドサイズx64x86説明
widthFLOAT4+0+0インラインオブジェクトの幅をDIP単位で表す値。
heightFLOAT4+4+4インラインオブジェクトの高さをDIP単位で表す値。
baselineFLOAT4+8+8オブジェクト上端からベースラインまでの距離をDIP単位で表す値。
supportsSidewaysBOOL4+12+12縦書き(90度回転)描画に対応するかを示すブール値。

各言語での定義

#include <windows.h>

// DWRITE_INLINE_OBJECT_METRICS  (x64 16 / x86 16 バイト)
typedef struct DWRITE_INLINE_OBJECT_METRICS {
    FLOAT width;
    FLOAT height;
    FLOAT baseline;
    BOOL supportsSideways;
} DWRITE_INLINE_OBJECT_METRICS;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct DWRITE_INLINE_OBJECT_METRICS
{
    public float width;
    public float height;
    public float baseline;
    [MarshalAs(UnmanagedType.Bool)] public bool supportsSideways;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure DWRITE_INLINE_OBJECT_METRICS
    Public width As Single
    Public height As Single
    Public baseline As Single
    <MarshalAs(UnmanagedType.Bool)> Public supportsSideways As Boolean
End Structure
import ctypes
from ctypes import wintypes

class DWRITE_INLINE_OBJECT_METRICS(ctypes.Structure):
    _fields_ = [
        ("width", ctypes.c_float),
        ("height", ctypes.c_float),
        ("baseline", ctypes.c_float),
        ("supportsSideways", wintypes.BOOL),
    ]
#[repr(C)]
pub struct DWRITE_INLINE_OBJECT_METRICS {
    pub width: f32,
    pub height: f32,
    pub baseline: f32,
    pub supportsSideways: i32,
}
import "golang.org/x/sys/windows"

type DWRITE_INLINE_OBJECT_METRICS struct {
	width float32
	height float32
	baseline float32
	supportsSideways int32
}
type
  DWRITE_INLINE_OBJECT_METRICS = record
    width: Single;
    height: Single;
    baseline: Single;
    supportsSideways: BOOL;
  end;
const DWRITE_INLINE_OBJECT_METRICS = extern struct {
    width: f32,
    height: f32,
    baseline: f32,
    supportsSideways: i32,
};
type
  DWRITE_INLINE_OBJECT_METRICS {.bycopy.} = object
    width: float32
    height: float32
    baseline: float32
    supportsSideways: int32
struct DWRITE_INLINE_OBJECT_METRICS
{
    float width;
    float height;
    float baseline;
    int supportsSideways;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; DWRITE_INLINE_OBJECT_METRICS サイズ: 16 バイト(x64)
dim st, 4    ; 4byte整数×4(構造体サイズ 16 / 4 切り上げ)
; width : FLOAT (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; height : FLOAT (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; baseline : FLOAT (+8, 4byte)  st.2 = 値  /  値 = st.2   (lpoke/lpeek も可)
; supportsSideways : BOOL (+12, 4byte)  st.3 = 値  /  値 = st.3   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global DWRITE_INLINE_OBJECT_METRICS
    #field float width
    #field float height
    #field float baseline
    #field bool supportsSideways
#endstruct

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