ホーム › System.Console › CONSOLE_FONT_INFO
CONSOLE_FONT_INFO
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| nFont | DWORD | 4 | +0 | +0 | コンソールフォントテーブル内のフォントインデックス。 |
| dwFontSize | COORD | 4 | +4 | +4 | フォントの幅と高さをピクセルで表すサイズ(COORD)。 |
各言語での定義
#include <windows.h>
// COORD (x64 4 / x86 4 バイト)
typedef struct COORD {
SHORT X;
SHORT Y;
} COORD;
// CONSOLE_FONT_INFO (x64 8 / x86 8 バイト)
typedef struct CONSOLE_FONT_INFO {
DWORD nFont;
COORD dwFontSize;
} CONSOLE_FONT_INFO;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct COORD
{
public short X;
public short Y;
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct CONSOLE_FONT_INFO
{
public uint nFont;
public COORD dwFontSize;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure COORD
Public X As Short
Public Y As Short
End Structure
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure CONSOLE_FONT_INFO
Public nFont As UInteger
Public dwFontSize As COORD
End Structureimport ctypes
from ctypes import wintypes
class COORD(ctypes.Structure):
_fields_ = [
("X", ctypes.c_short),
("Y", ctypes.c_short),
]
class CONSOLE_FONT_INFO(ctypes.Structure):
_fields_ = [
("nFont", wintypes.DWORD),
("dwFontSize", COORD),
]#[repr(C)]
pub struct COORD {
pub X: i16,
pub Y: i16,
}
#[repr(C)]
pub struct CONSOLE_FONT_INFO {
pub nFont: u32,
pub dwFontSize: COORD,
}import "golang.org/x/sys/windows"
type COORD struct {
X int16
Y int16
}
type CONSOLE_FONT_INFO struct {
nFont uint32
dwFontSize COORD
}type
COORD = record
X: Smallint;
Y: Smallint;
end;
CONSOLE_FONT_INFO = record
nFont: DWORD;
dwFontSize: COORD;
end;const COORD = extern struct {
X: i16,
Y: i16,
};
const CONSOLE_FONT_INFO = extern struct {
nFont: u32,
dwFontSize: COORD,
};type
COORD {.bycopy.} = object
X: int16
Y: int16
CONSOLE_FONT_INFO {.bycopy.} = object
nFont: uint32
dwFontSize: COORDstruct COORD
{
short X;
short Y;
}
struct CONSOLE_FONT_INFO
{
uint nFont;
COORD dwFontSize;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; CONSOLE_FONT_INFO サイズ: 8 バイト(x64)
dim st, 2 ; 4byte整数×2(構造体サイズ 8 / 4 切り上げ)
; nFont : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; dwFontSize : COORD (+4, 4byte) varptr(st)+4 を基点に操作(4byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global COORD
#field short X
#field short Y
#endstruct
#defstruct global CONSOLE_FONT_INFO
#field int nFont
#field COORD dwFontSize
#endstruct
stdim st, CONSOLE_FONT_INFO ; NSTRUCT 変数を確保
st->nFont = 100
mes "nFont=" + st->nFont