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

DWRITE_LINE_SPACING

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

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

フィールド

フィールドサイズx64x86説明
methodDWRITE_LINE_SPACING_METHOD4+0+0行間の決定に使用される方法。
heightFLOAT4+4+4

行間の間隔。このパラメーターの解釈は、行間の方法に応じて次のように異なります。

  • 行間: 無視されます
  • 均一な行間: 行と行の間の明示的な距離 (DIP 単位)
  • 比例的な行間: 計算された行の高さに適用される倍率。 各行について、行の高さは既定の行間と同様に計算され、その値に倍率が適用されます。
baselineFLOAT4+8+8

行の上端からベースラインまでの距離。 このパラメーターの解釈は、行間の方法に応じて次のように異なります。

  • 既定の行間: 無視されます
  • 均一な行間: 行の上端からベースラインまでの明示的な距離 (DIP 単位)
  • 比例的な行間: 計算されたベースラインに適用される倍率。各行について、 ベースラインまでの距離は既定の行間と同様に計算され、その値に倍率が適用されます。
leadingBeforeFLOAT4+12+12行の前に配分されるレディング全体の割合。指定できる値は 0 から 1.0 の間です。残りのレディングは 行の後に配分されます。既定および均一な行間の方法では無視されます。 行の前後に配分できるレディングは、height パラメーターと baseline パラメーターの値によって決まります。
fontLineGapUsageDWRITE_FONT_LINE_GAP_USAGE4+16+16DWRITE_FONT_METRICS::lineGap の値を行メトリックに含めるかどうかを指定します。

公式ドキュメント

テキストの行と行の間の垂直方向の間隔を設定します。

出典・ライセンス: 上記「公式ドキュメント」の内容は Microsoft の Win32 API ドキュメント(MicrosoftDocs/sdk-api)を日本語に翻訳・改変したものです。© Microsoft Corporation. CC BY 4.0 で提供。
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)

各言語での定義

#include <windows.h>

// DWRITE_LINE_SPACING  (x64 20 / x86 20 バイト)
typedef struct DWRITE_LINE_SPACING {
    DWRITE_LINE_SPACING_METHOD method;
    FLOAT height;
    FLOAT baseline;
    FLOAT leadingBefore;
    DWRITE_FONT_LINE_GAP_USAGE fontLineGapUsage;
} DWRITE_LINE_SPACING;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct DWRITE_LINE_SPACING
{
    public int method;
    public float height;
    public float baseline;
    public float leadingBefore;
    public int fontLineGapUsage;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure DWRITE_LINE_SPACING
    Public method As Integer
    Public height As Single
    Public baseline As Single
    Public leadingBefore As Single
    Public fontLineGapUsage As Integer
End Structure
import ctypes
from ctypes import wintypes

class DWRITE_LINE_SPACING(ctypes.Structure):
    _fields_ = [
        ("method", ctypes.c_int),
        ("height", ctypes.c_float),
        ("baseline", ctypes.c_float),
        ("leadingBefore", ctypes.c_float),
        ("fontLineGapUsage", ctypes.c_int),
    ]
#[repr(C)]
pub struct DWRITE_LINE_SPACING {
    pub method: i32,
    pub height: f32,
    pub baseline: f32,
    pub leadingBefore: f32,
    pub fontLineGapUsage: i32,
}
import "golang.org/x/sys/windows"

type DWRITE_LINE_SPACING struct {
	method int32
	height float32
	baseline float32
	leadingBefore float32
	fontLineGapUsage int32
}
type
  DWRITE_LINE_SPACING = record
    method: Integer;
    height: Single;
    baseline: Single;
    leadingBefore: Single;
    fontLineGapUsage: Integer;
  end;
const DWRITE_LINE_SPACING = extern struct {
    method: i32,
    height: f32,
    baseline: f32,
    leadingBefore: f32,
    fontLineGapUsage: i32,
};
type
  DWRITE_LINE_SPACING {.bycopy.} = object
    method: int32
    height: float32
    baseline: float32
    leadingBefore: float32
    fontLineGapUsage: int32
struct DWRITE_LINE_SPACING
{
    int method;
    float height;
    float baseline;
    float leadingBefore;
    int fontLineGapUsage;
}

HSP用 定義

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

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

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