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

DWRITE_UNDERLINE

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

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

フィールド

フィールドサイズx64x86説明
widthFLOAT4+0+0下線の幅(線の長さ)をDIP単位で表す値。
thicknessFLOAT4+4+4下線の太さをDIP単位で表す値。
offsetFLOAT4+8+8ベースラインから下線までのオフセット。正の値は下方向を表す。
runHeightFLOAT4+12+12下線が描かれるテキストランの高さをDIP単位で表す値。
readingDirectionDWRITE_READING_DIRECTION4+16+16テキストの読み進み方向を示す列挙値。
flowDirectionDWRITE_FLOW_DIRECTION4+20+20行の流れる方向を示す列挙値。
localeNameLPWSTR8/4+24+24テキストのロケール名を示すNULL終端ワイド文字列。
measuringModeDWRITE_MEASURING_MODE4+32+28テキスト測定モード(自然/GDI互換など)を示す列挙値。

各言語での定義

#include <windows.h>

// DWRITE_UNDERLINE  (x64 40 / x86 32 バイト)
typedef struct DWRITE_UNDERLINE {
    FLOAT width;
    FLOAT thickness;
    FLOAT offset;
    FLOAT runHeight;
    DWRITE_READING_DIRECTION readingDirection;
    DWRITE_FLOW_DIRECTION flowDirection;
    LPWSTR localeName;
    DWRITE_MEASURING_MODE measuringMode;
} DWRITE_UNDERLINE;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct DWRITE_UNDERLINE
{
    public float width;
    public float thickness;
    public float offset;
    public float runHeight;
    public int readingDirection;
    public int flowDirection;
    public IntPtr localeName;
    public int measuringMode;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure DWRITE_UNDERLINE
    Public width As Single
    Public thickness As Single
    Public offset As Single
    Public runHeight As Single
    Public readingDirection As Integer
    Public flowDirection As Integer
    Public localeName As IntPtr
    Public measuringMode As Integer
End Structure
import ctypes
from ctypes import wintypes

class DWRITE_UNDERLINE(ctypes.Structure):
    _fields_ = [
        ("width", ctypes.c_float),
        ("thickness", ctypes.c_float),
        ("offset", ctypes.c_float),
        ("runHeight", ctypes.c_float),
        ("readingDirection", ctypes.c_int),
        ("flowDirection", ctypes.c_int),
        ("localeName", ctypes.c_void_p),
        ("measuringMode", ctypes.c_int),
    ]
#[repr(C)]
pub struct DWRITE_UNDERLINE {
    pub width: f32,
    pub thickness: f32,
    pub offset: f32,
    pub runHeight: f32,
    pub readingDirection: i32,
    pub flowDirection: i32,
    pub localeName: *mut core::ffi::c_void,
    pub measuringMode: i32,
}
import "golang.org/x/sys/windows"

type DWRITE_UNDERLINE struct {
	width float32
	thickness float32
	offset float32
	runHeight float32
	readingDirection int32
	flowDirection int32
	localeName uintptr
	measuringMode int32
}
type
  DWRITE_UNDERLINE = record
    width: Single;
    thickness: Single;
    offset: Single;
    runHeight: Single;
    readingDirection: Integer;
    flowDirection: Integer;
    localeName: Pointer;
    measuringMode: Integer;
  end;
const DWRITE_UNDERLINE = extern struct {
    width: f32,
    thickness: f32,
    offset: f32,
    runHeight: f32,
    readingDirection: i32,
    flowDirection: i32,
    localeName: ?*anyopaque,
    measuringMode: i32,
};
type
  DWRITE_UNDERLINE {.bycopy.} = object
    width: float32
    thickness: float32
    offset: float32
    runHeight: float32
    readingDirection: int32
    flowDirection: int32
    localeName: pointer
    measuringMode: int32
struct DWRITE_UNDERLINE
{
    float width;
    float thickness;
    float offset;
    float runHeight;
    int readingDirection;
    int flowDirection;
    void* localeName;
    int measuringMode;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; DWRITE_UNDERLINE サイズ: 32 バイト(x86)
dim st, 8    ; 4byte整数×8(構造体サイズ 32 / 4 切り上げ)
; width : FLOAT (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; thickness : FLOAT (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; offset : FLOAT (+8, 4byte)  st.2 = 値  /  値 = st.2   (lpoke/lpeek も可)
; runHeight : FLOAT (+12, 4byte)  st.3 = 値  /  値 = st.3   (lpoke/lpeek も可)
; readingDirection : DWRITE_READING_DIRECTION (+16, 4byte)  st.4 = 値  /  値 = st.4   (lpoke/lpeek も可)
; flowDirection : DWRITE_FLOW_DIRECTION (+20, 4byte)  st.5 = 値  /  値 = st.5   (lpoke/lpeek も可)
; localeName : LPWSTR (+24, 4byte)  st.6 = 値  /  値 = st.6   (lpoke/lpeek も可)
; measuringMode : DWRITE_MEASURING_MODE (+28, 4byte)  st.7 = 値  /  値 = st.7   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; DWRITE_UNDERLINE サイズ: 40 バイト(x64)
dim st, 10    ; 4byte整数×10(構造体サイズ 40 / 4 切り上げ)
; width : FLOAT (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; thickness : FLOAT (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; offset : FLOAT (+8, 4byte)  st.2 = 値  /  値 = st.2   (lpoke/lpeek も可)
; runHeight : FLOAT (+12, 4byte)  st.3 = 値  /  値 = st.3   (lpoke/lpeek も可)
; readingDirection : DWRITE_READING_DIRECTION (+16, 4byte)  st.4 = 値  /  値 = st.4   (lpoke/lpeek も可)
; flowDirection : DWRITE_FLOW_DIRECTION (+20, 4byte)  st.5 = 値  /  値 = st.5   (lpoke/lpeek も可)
; localeName : LPWSTR (+24, 8byte)  qpoke st,24,値 / qpeek(st,24)  ※IronHSPのみ。3.7/3.8は lpoke st,24,下位 : lpoke st,28,上位
; measuringMode : DWRITE_MEASURING_MODE (+32, 4byte)  st.8 = 値  /  値 = st.8   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global DWRITE_UNDERLINE
    #field float width
    #field float thickness
    #field float offset
    #field float runHeight
    #field int readingDirection
    #field int flowDirection
    #field intptr localeName
    #field int measuringMode
#endstruct

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