|
|
1.1 ! root 1: // ! 2: // nono ! 3: // Copyright (C) 2021 nono project ! 4: // Licensed under nono-license.txt ! 5: // ! 6: ! 7: // ! 8: // フォント管理 ! 9: // ! 10: ! 11: #pragma once ! 12: ! 13: #include "wxnono.h" ! 14: #include <array> ! 15: #include <vector> ! 16: ! 17: // フォント種別というかフォントサイズ。 ! 18: // 配列のインデックスとして使うので有効な値を 0 から列挙する。 ! 19: enum FontId { ! 20: None = -1, ! 21: _6x12 = 0, ! 22: _8x16, ! 23: Max, ! 24: }; ! 25: #define FONT_6x12 wxSize(6, 12) ! 26: #define FONT_8x16 wxSize(8, 16) ! 27: ! 28: // フォント管理 ! 29: class FontManager ! 30: { ! 31: public: ! 32: FontManager(); ! 33: ~FontManager(); ! 34: ! 35: // フォントを変更(設定) ! 36: void SetFont(FontId); ! 37: ! 38: // 現在のフォント ID を取得 ! 39: FontId GetFontId() const { return fontid; } ! 40: ! 41: // グリフを切り替える。 ! 42: // 0x5c は false: 円記号 true: バックスラッシュ ! 43: // 0x7c は false: パイプ記号 true: パイプ記号(破線) ! 44: // 0x7e は false: オーバーライン true: チルダ ! 45: void SetGlyph5C(bool value) { glyph_5c = value; } ! 46: void SetGlyph7C(bool value) { glyph_7c = value; } ! 47: void SetGlyph7E(bool value) { glyph_7e = value; } ! 48: ! 49: // ASCII のグリフを返す ! 50: const uint8 *AsciiGlyph(uint8, uint attr) const; ! 51: ! 52: // 漢字のグリフを返す ! 53: std::vector<uint8> KanjiGlyph(uint16, uint attr) const; ! 54: ! 55: int GetFontWidth() const { return font_width; } ! 56: int GetFontHeight() const { return font_height; } ! 57: ! 58: private: ! 59: // フォント種別(指定値) ! 60: // この値を元に各コントロールに指示を出す ! 61: FontId fontid {}; ! 62: ! 63: // フォントの諸元 ! 64: int font_width {}; // 幅 (ピクセル) ! 65: int font_height {}; // 高さ (ピクセル) ! 66: int font_stride {}; // 1行のバイト数 ! 67: int font_bytes {}; // 1フォントのバイト数 ! 68: ! 69: // グリフデータ ! 70: std::vector<uint8> ascii_glyph {}; ! 71: std::vector<uint8> bold_glyph {}; ! 72: ! 73: // 可変のグリフ ! 74: bool glyph_5c {}; ! 75: bool glyph_7c {}; ! 76: bool glyph_7e {}; ! 77: ! 78: // フォント種別一覧 ! 79: static const std::array<wxSize, FontId::Max> fontinfo; ! 80: }; ! 81: ! 82: extern FontManager *gFontManager;
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.