| 673 | } |
| 674 | |
| 675 | bool Window_Message::DrawGlyph(Font& font, const Bitmap& system, char32_t glyph, bool is_exfont) { |
| 676 | if (is_exfont) { |
| 677 | DebugLogText("{}: MSG DrawGlyph Exfont {}", static_cast<uint32_t>(glyph)); |
| 678 | } else { |
| 679 | if (glyph < 128) { |
| 680 | DebugLogText("{}: MSG DrawGlyph ASCII {}", static_cast<char>(glyph)); |
| 681 | } else { |
| 682 | DebugLogText("{}: MSG DrawGlyph UTF32 {#:X}", static_cast<uint32_t>(glyph)); |
| 683 | } |
| 684 | } |
| 685 | |
| 686 | // RPG_RT compatible for half-width (6) and full-width (12) |
| 687 | // generalizes the algo for even bigger glyphs |
| 688 | // FIXME: When using Freetype this can cause slow rendering speeds due to dynamic width |
| 689 | auto get_width = [](int w) { |
| 690 | return (w > 0) ? (w - 1) / 6 + 1 : 0; |
| 691 | }; |
| 692 | |
| 693 | // Wide characters cause an extra wait if the last printed character did not wait. |
| 694 | if (prev_char_printable && !prev_char_waited) { |
| 695 | auto& wide_font = is_exfont ? *Font::exfont : font; |
| 696 | auto rect = wide_font.GetSize(glyph); |
| 697 | auto width = get_width(rect.width); |
| 698 | if (width >= 2) { |
| 699 | prev_char_waited = true; |
| 700 | ++line_char_counter; |
| 701 | SetWait(1); |
| 702 | return false; |
| 703 | } |
| 704 | } |
| 705 | |
| 706 | auto rect = Text::Draw(*contents, contents_x, contents_y, font, system, text_color, glyph, is_exfont); |
| 707 | |
| 708 | int glyph_width = rect.x; |
| 709 | contents_x += glyph_width; |
| 710 | int width = get_width(glyph_width); |
| 711 | SetWaitForCharacter(width); |
| 712 | |
| 713 | return true; |
| 714 | } |
| 715 | |
| 716 | bool Window_Message::DrawGlyph(Font& font, const Bitmap& system, const Font::ShapeRet& shape) { |
| 717 | // RPG_RT compatible for half-width (6) and full-width (12) |
nothing calls this directly
no test coverage detected