# createFont???()

フォントジェネレータ関数は、収録フォントごとに定義されています。関数パラメータは共通で、以下のようになります。

```cpp
const FontDef& createFontShinonome16(
    uint8_t id,
    uint8_t line_space = 0,
    uint8_t char_space = 0,
    uint32_t u32Opt = 0);
```

上記は東雲フォント16ドット版（常用漢字収録）のジェネレータの例です。

`id`は、ユーザが指定するフォントID。

`line_space`はフォントの行間スペースをピクセル数で指定します。

`char_space`は文字間スペースでピクセルで指定します。文字間スペースはシングル幅のフォントの指定です。ダブル幅のフォントの場合は倍になります。

`u32Opt`は、フォントのオプションを指定します。オプションは`U32_OPT_FONT_TATEBAI`と`U32_OPT_FONT_YOKOBAI`があり、論理和で指定します。

フォントジェネレータの戻り値は`FontDef&`になっています。この戻り値はライブラリ内部のフォント管理テーブルに生成されたオブジェクトへの参照です。既に登録済みのIDであるばあいは、そのIDに対して上書きを行います。登録できなかった場合は`.is_default()`メソッドが`true`になるデフォルトフォントが返されます。

```cpp
if (createFontShinonome16(11).is_default()) {
    // フォント作成のエラー
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://mwm5.twelite.info/0.9-1/references/untitled/twefont/createfont.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
