--- nono/wx/fontmanager.cpp 2026/04/29 17:05:16 1.1.1.3 +++ nono/wx/fontmanager.cpp 2026/04/29 17:05:27 1.1.1.5 @@ -109,7 +109,7 @@ FontManager::AsciiGlyph(uint8 code, uint const std::vector *glyph; // ボールドかどうかでテーブルが別 - if ((attr & TA::Em)) { + if ((attr & TA::Bold)) { glyph = &bold_glyph; } else { glyph = &ascii_glyph; @@ -191,18 +191,29 @@ FontManager::KanjiGlyph(uint16 sjiscode, PANIC("corrupted fontid=%d", (int)fontid); } - int bytes = (((font_width * 2) + 7) / 8) * font_height; - std::vector buf(bytes); + int stride = ((font_width * 2) + 7) / 8; + int bytes = stride * font_height; + std::vector data(bytes); - memcpy(&buf[0], base + code * bytes, bytes); - - if (attr == TA::Em) { - for (int i = 0; i < bytes; i++) { - buf[i] |= buf[i] >> 1; + 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 buf; + return data; } // フォント種別一覧