Win32 API 日本語リファレンス
ホームDevices.Display › EngComputeGlyphSet

EngComputeGlyphSet

関数
指定コードページのグリフセットを計算して取得する。
DLLGDI32.dll呼出規約winapi対応OSWindows 2000 以降

シグネチャ

// GDI32.dll
#include <windows.h>

FD_GLYPHSET* EngComputeGlyphSet(
    INT nCodePage,
    INT nFirstChar,
    INT cChars
);

パラメーター

名前方向説明
nCodePageINTinサポートされるコードページを指定します。
nFirstCharINTinサポートされる最初の ANSI 文字の文字コードを指定します。
cCharsINTinサポートされる ANSI 文字の数を指定します。

戻り値の型: FD_GLYPHSET*

公式ドキュメント

EngComputeGlyphSet 関数は、デバイスでサポートされるグリフセットを計算します。

戻り値

グリフセットの計算に成功した場合、関数は FD_GLYPHSET 構造体へのポインターを返します。エラーが発生した場合、関数は NULL を返します。

解説(Remarks)

ドライバーは、nCodePage で記述されたコードページに含まれるグリフのみを持つフォントのグリフセットを計算するために EngComputeGlyphSet を使用できます。

ドライバーは、EngComputeGlyphSet が返す FD_GLYPHSET 構造体の使用が終わったら、EngFreeMem を呼び出してメモリを解放する必要があります。

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

各言語での呼び出し定義

// GDI32.dll
#include <windows.h>

FD_GLYPHSET* EngComputeGlyphSet(
    INT nCodePage,
    INT nFirstChar,
    INT cChars
);
[DllImport("GDI32.dll", ExactSpelling = true)]
static extern IntPtr EngComputeGlyphSet(
    int nCodePage,   // INT
    int nFirstChar,   // INT
    int cChars   // INT
);
<DllImport("GDI32.dll", ExactSpelling:=True)>
Public Shared Function EngComputeGlyphSet(
    nCodePage As Integer,   ' INT
    nFirstChar As Integer,   ' INT
    cChars As Integer   ' INT
) As IntPtr
End Function
' nCodePage : INT
' nFirstChar : INT
' cChars : INT
Declare PtrSafe Function EngComputeGlyphSet Lib "gdi32" ( _
    ByVal nCodePage As Long, _
    ByVal nFirstChar As Long, _
    ByVal cChars As Long) As LongPtr
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

EngComputeGlyphSet = ctypes.windll.gdi32.EngComputeGlyphSet
EngComputeGlyphSet.restype = ctypes.c_void_p
EngComputeGlyphSet.argtypes = [
    ctypes.c_int,  # nCodePage : INT
    ctypes.c_int,  # nFirstChar : INT
    ctypes.c_int,  # cChars : INT
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('GDI32.dll')
EngComputeGlyphSet = Fiddle::Function.new(
  lib['EngComputeGlyphSet'],
  [
    Fiddle::TYPE_INT,  # nCodePage : INT
    Fiddle::TYPE_INT,  # nFirstChar : INT
    Fiddle::TYPE_INT,  # cChars : INT
  ],
  Fiddle::TYPE_VOIDP)
#[link(name = "gdi32")]
extern "system" {
    fn EngComputeGlyphSet(
        nCodePage: i32,  // INT
        nFirstChar: i32,  // INT
        cChars: i32  // INT
    ) -> *mut FD_GLYPHSET;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("GDI32.dll")]
public static extern IntPtr EngComputeGlyphSet(int nCodePage, int nFirstChar, int cChars);
"@
$api = Add-Type -MemberDefinition $sig -Name 'GDI32_EngComputeGlyphSet' -Namespace Win32 -PassThru
# $api::EngComputeGlyphSet(nCodePage, nFirstChar, cChars)
#uselib "GDI32.dll"
#func global EngComputeGlyphSet "EngComputeGlyphSet" sptr, sptr, sptr
; EngComputeGlyphSet nCodePage, nFirstChar, cChars   ; 戻り値は stat
; nCodePage : INT -> "sptr"
; nFirstChar : INT -> "sptr"
; cChars : INT -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "GDI32.dll"
#cfunc global EngComputeGlyphSet "EngComputeGlyphSet" int, int, int
; res = EngComputeGlyphSet(nCodePage, nFirstChar, cChars)
; nCodePage : INT -> "int"
; nFirstChar : INT -> "int"
; cChars : INT -> "int"
; FD_GLYPHSET* EngComputeGlyphSet(INT nCodePage, INT nFirstChar, INT cChars)
#uselib "GDI32.dll"
#cfunc global EngComputeGlyphSet "EngComputeGlyphSet" int, int, int
; res = EngComputeGlyphSet(nCodePage, nFirstChar, cChars)
; nCodePage : INT -> "int"
; nFirstChar : INT -> "int"
; cChars : INT -> "int"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	gdi32 = windows.NewLazySystemDLL("GDI32.dll")
	procEngComputeGlyphSet = gdi32.NewProc("EngComputeGlyphSet")
)

// nCodePage (INT), nFirstChar (INT), cChars (INT)
r1, _, err := procEngComputeGlyphSet.Call(
	uintptr(nCodePage),
	uintptr(nFirstChar),
	uintptr(cChars),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // FD_GLYPHSET*
function EngComputeGlyphSet(
  nCodePage: Integer;   // INT
  nFirstChar: Integer;   // INT
  cChars: Integer   // INT
): Pointer; stdcall;
  external 'GDI32.dll' name 'EngComputeGlyphSet';
result := DllCall("GDI32\EngComputeGlyphSet"
    , "Int", nCodePage   ; INT
    , "Int", nFirstChar   ; INT
    , "Int", cChars   ; INT
    , "Ptr")   ; return: FD_GLYPHSET*
●EngComputeGlyphSet(nCodePage, nFirstChar, cChars) = DLL("GDI32.dll", "void* EngComputeGlyphSet(int, int, int)")
# 呼び出し: EngComputeGlyphSet(nCodePage, nFirstChar, cChars)
# nCodePage : INT -> "int"
# nFirstChar : INT -> "int"
# cChars : INT -> "int"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
const std = @import("std");

extern "gdi32" fn EngComputeGlyphSet(
    nCodePage: i32, // INT
    nFirstChar: i32, // INT
    cChars: i32 // INT
) callconv(std.os.windows.WINAPI) [*c]FD_GLYPHSET;
proc EngComputeGlyphSet(
    nCodePage: int32,  # INT
    nFirstChar: int32,  # INT
    cChars: int32  # INT
): ptr FD_GLYPHSET {.importc: "EngComputeGlyphSet", stdcall, dynlib: "GDI32.dll".}
pragma(lib, "gdi32");
extern(Windows)
FD_GLYPHSET* EngComputeGlyphSet(
    int nCodePage,   // INT
    int nFirstChar,   // INT
    int cChars   // INT
);
ccall((:EngComputeGlyphSet, "GDI32.dll"), stdcall, Ptr{FD_GLYPHSET},
      (Int32, Int32, Int32),
      nCodePage, nFirstChar, cChars)
# nCodePage : INT -> Int32
# nFirstChar : INT -> Int32
# cChars : INT -> Int32
# stdcall は 32bit のみ意味を持つ(x64 では無視)。
local ffi = require("ffi")
ffi.cdef[[
void* EngComputeGlyphSet(
    int32_t nCodePage,
    int32_t nFirstChar,
    int32_t cChars);
]]
local gdi32 = ffi.load("gdi32")
-- gdi32.EngComputeGlyphSet(nCodePage, nFirstChar, cChars)
-- nCodePage : INT
-- nFirstChar : INT
-- cChars : INT
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
const koffi = require('koffi');
const lib = koffi.load('GDI32.dll');
const EngComputeGlyphSet = lib.func('__stdcall', 'EngComputeGlyphSet', 'void *', ['int32_t', 'int32_t', 'int32_t']);
// EngComputeGlyphSet(nCodePage, nFirstChar, cChars)
// nCodePage : INT -> 'int32_t'
// nFirstChar : INT -> 'int32_t'
// cChars : INT -> 'int32_t'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。
const lib = Deno.dlopen("GDI32.dll", {
  EngComputeGlyphSet: { parameters: ["i32", "i32", "i32"], result: "pointer" },
});
// lib.symbols.EngComputeGlyphSet(nCodePage, nFirstChar, cChars)
// nCodePage : INT -> "i32"
// nFirstChar : INT -> "i32"
// cChars : INT -> "i32"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。
<?php
$ffi = FFI::cdef(<<<C
void* EngComputeGlyphSet(
    int32_t nCodePage,
    int32_t nFirstChar,
    int32_t cChars);
C, "GDI32.dll");
// $ffi->EngComputeGlyphSet(nCodePage, nFirstChar, cChars);
// nCodePage : INT
// nFirstChar : INT
// cChars : INT
// 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
// WINAPI(stdcall): x64 では呼出規約が統一されるため問題なし。x86 では __stdcall 対応のラッパが必要な場合あり。
import com.sun.jna.*;
import com.sun.jna.ptr.*;
import com.sun.jna.win32.StdCallLibrary;
import com.sun.jna.win32.W32APIOptions;

public interface Gdi32 extends StdCallLibrary {
    Gdi32 INSTANCE = Native.load("gdi32", Gdi32.class);
    Pointer EngComputeGlyphSet(
        int nCodePage,   // INT
        int nFirstChar,   // INT
        int cChars   // INT
    );
}
@[Link("gdi32")]
lib LibGDI32
  fun EngComputeGlyphSet = EngComputeGlyphSet(
    nCodePage : Int32,   # INT
    nFirstChar : Int32,   # INT
    cChars : Int32   # INT
  ) : FD_GLYPHSET*
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。
import 'dart:ffi';
import 'package:ffi/ffi.dart';

typedef EngComputeGlyphSetNative = Pointer<Void> Function(Int32, Int32, Int32);
typedef EngComputeGlyphSetDart = Pointer<Void> Function(int, int, int);
final EngComputeGlyphSet = DynamicLibrary.open('GDI32.dll')
    .lookupFunction<EngComputeGlyphSetNative, EngComputeGlyphSetDart>('EngComputeGlyphSet');
// nCodePage : INT -> Int32
// nFirstChar : INT -> Int32
// cChars : INT -> Int32
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
function EngComputeGlyphSet(
  nCodePage: Integer;   // INT
  nFirstChar: Integer;   // INT
  cChars: Integer   // INT
): Pointer; stdcall;
  external 'GDI32.dll' name 'EngComputeGlyphSet';
import Foreign
import Foreign.C.Types
import Foreign.C.String

foreign import stdcall safe "EngComputeGlyphSet"
  c_EngComputeGlyphSet :: Int32 -> Int32 -> Int32 -> IO (Ptr ())
-- nCodePage : INT -> Int32
-- nFirstChar : INT -> Int32
-- cChars : INT -> Int32
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
open Ctypes
open Foreign

let engcomputeglyphset =
  foreign "EngComputeGlyphSet"
    (int32_t @-> int32_t @-> int32_t @-> returning (ptr void))
(* nCodePage : INT -> int32_t *)
(* nFirstChar : INT -> int32_t *)
(* cChars : INT -> int32_t *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)
(cffi:define-foreign-library gdi32 (t "GDI32.dll"))
(cffi:use-foreign-library gdi32)

(cffi:defcfun ("EngComputeGlyphSet" eng-compute-glyph-set :convention :stdcall) :pointer
  (n-code-page :int32)   ; INT
  (n-first-char :int32)   ; INT
  (c-chars :int32))   ; INT
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $EngComputeGlyphSet = Win32::API::More->new('GDI32',
    'LPVOID EngComputeGlyphSet(int nCodePage, int nFirstChar, int cChars)');
# my $ret = $EngComputeGlyphSet->Call($nCodePage, $nFirstChar, $cChars);
# nCodePage : INT -> int
# nFirstChar : INT -> int
# cChars : INT -> int
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。

関連項目

使用する型