--- nono/wx/fontmanager.cpp 2026/04/29 17:05:27 1.1.1.5 +++ 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::Bold)) { - 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); @@ -193,27 +178,7 @@ FontManager::KanjiGlyph(uint16 sjiscode, int stride = ((font_width * 2) + 7) / 8; int bytes = stride * font_height; - std::vector data(bytes); - - if (__predict_true((attr & TA::Bold) == 0)) { - memcpy(&data[0], base + code * bytes, bytes); - } else { - // ボールドなら1ラインずつ取り出して重ね合わせる - const uint8 *s = base + code * bytes; - int i = 0; - for (int y = 0; y < font_height; y++) { - uint64 buf = 0; - for (int x = 0; x < stride; x++) { - buf = (buf << 8) | *s++; - } - buf |= buf >> 1; - for (int x = stride - 1; x >= 0; x--) { - data[i++] = (buf >> (x * 8)) & 0xff; - } - } - } - - return data; + return base + code * bytes; } // フォント種別一覧