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

DWRITE_CARET_METRICS

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

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

フィールド

フィールドサイズx64x86説明
slopeRiseSHORT2+0+0斜体キャレットの傾きの垂直成分(分子)。
slopeRunSHORT2+2+2斜体キャレットの傾きの水平成分(分母)。0で垂直キャレット。
offsetSHORT2+4+4ベースライン交点からのキャレット水平オフセットをデザイン単位で表す値。

各言語での定義

#include <windows.h>

// DWRITE_CARET_METRICS  (x64 6 / x86 6 バイト)
typedef struct DWRITE_CARET_METRICS {
    SHORT slopeRise;
    SHORT slopeRun;
    SHORT offset;
} DWRITE_CARET_METRICS;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct DWRITE_CARET_METRICS
{
    public short slopeRise;
    public short slopeRun;
    public short offset;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure DWRITE_CARET_METRICS
    Public slopeRise As Short
    Public slopeRun As Short
    Public offset As Short
End Structure
import ctypes
from ctypes import wintypes

class DWRITE_CARET_METRICS(ctypes.Structure):
    _fields_ = [
        ("slopeRise", ctypes.c_short),
        ("slopeRun", ctypes.c_short),
        ("offset", ctypes.c_short),
    ]
#[repr(C)]
pub struct DWRITE_CARET_METRICS {
    pub slopeRise: i16,
    pub slopeRun: i16,
    pub offset: i16,
}
import "golang.org/x/sys/windows"

type DWRITE_CARET_METRICS struct {
	slopeRise int16
	slopeRun int16
	offset int16
}
type
  DWRITE_CARET_METRICS = record
    slopeRise: Smallint;
    slopeRun: Smallint;
    offset: Smallint;
  end;
const DWRITE_CARET_METRICS = extern struct {
    slopeRise: i16,
    slopeRun: i16,
    offset: i16,
};
type
  DWRITE_CARET_METRICS {.bycopy.} = object
    slopeRise: int16
    slopeRun: int16
    offset: int16
struct DWRITE_CARET_METRICS
{
    short slopeRise;
    short slopeRun;
    short offset;
}

HSP用 定義

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

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

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