--- nono/wx/fontmanager.cpp 2026/04/29 17:05:16 1.1.1.3 +++ nono/wx/fontmanager.cpp 2026/04/29 17:05:31 1.1.1.6 @@ -64,7 +64,6 @@ FontManager::SetFont(FontId fontid_) // 制御文字領域を外字として使う。 ascii_glyph.resize(256 * font_bytes); - bold_glyph.resize(256 * font_bytes); // CGROM に収録されている文字のうち半角ひらがななど使わないものもあるが // 避けるのも手間なので気にせずデータを作っておく。 @@ -95,26 +94,12 @@ FontManager::SetFont(FontId fontid_) int idx = pchar.code * font_bytes; memcpy(&ascii_glyph[idx], ptr, font_bytes); } - - // 続いてボールドに加工 - for (int i = 0; i < bold_glyph.size(); i++) { - bold_glyph[i] = ascii_glyph[i] | (ascii_glyph[i] >> 1); - } } // ASCII のグリフを返す const uint8 * -FontManager::AsciiGlyph(uint8 code, uint attr) const +FontManager::AsciiGlyph(uint8 code) const { - const std::vector *glyph; - - // ボールドかどうかでテーブルが別 - if ((attr & TA::Em)) { - glyph = &bold_glyph; - } else { - glyph = &ascii_glyph; - } - // 変更可能なグリフ if (__predict_false(code == 0x5c)) { if (glyph_5c) { @@ -130,12 +115,12 @@ FontManager::AsciiGlyph(uint8 code, uint } } - return &((*glyph)[code * font_bytes]); + return &ascii_glyph[code * font_bytes]; } // 漢字のグリフを返す -std::vector -FontManager::KanjiGlyph(uint16 sjiscode, uint attr) const +const uint8 * +FontManager::KanjiGlyph(uint16 sjiscode) const { // Shift_JIS を JIS というかコードポイントに変換 uint sh = (sjiscode >> 8); @@ -191,18 +176,9 @@ FontManager::KanjiGlyph(uint16 sjiscode, PANIC("corrupted fontid=%d", (int)fontid); } - int bytes = (((font_width * 2) + 7) / 8) * font_height; - std::vector buf(bytes); - - memcpy(&buf[0], base + code * bytes, bytes); - - if (attr == TA::Em) { - for (int i = 0; i < bytes; i++) { - buf[i] |= buf[i] >> 1; - } - } - - return buf; + int stride = ((font_width * 2) + 7) / 8; + int bytes = stride * font_height; + return base + code * bytes; } // フォント種別一覧