# HG changeset patch # User Sebastien Jodogne # Date 1745578366 -7200 # Node ID 639b4960bb5175282fdeecd64db1956999402ade # Parent a943ce01ce0abbbe18a725bfad71f1c07967c7b0# Parent bdb28e2d2767240631077d0cb73ab17339f452fa merge diff -r bdb28e2d2767 -r 639b4960bb51 OrthancStone/Sources/Fonts/GlyphAlphabet.cpp --- a/OrthancStone/Sources/Fonts/GlyphAlphabet.cpp Fri Apr 25 12:12:12 2025 +0200 +++ b/OrthancStone/Sources/Fonts/GlyphAlphabet.cpp Fri Apr 25 12:52:46 2025 +0200 @@ -76,6 +76,27 @@ } + void GlyphAlphabet::Register(FontRenderer& renderer, + const std::string& utf8) + { + size_t pos = 0; + while (pos < utf8.size()) + { + uint32_t unicode; + size_t size; + Orthanc::Toolbox::Utf8ToUnicodeCharacter(unicode, size, utf8, pos); + + if (unicode != '\r' && + unicode != '\n') + { + Register(renderer, unicode); + } + + pos += size; + } + } + + #if ORTHANC_ENABLE_LOCALE == 1 bool GlyphAlphabet::GetUnicodeFromCodepage(uint32_t& unicode, unsigned int index, diff -r bdb28e2d2767 -r 639b4960bb51 OrthancStone/Sources/Fonts/GlyphAlphabet.h --- a/OrthancStone/Sources/Fonts/GlyphAlphabet.h Fri Apr 25 12:12:12 2025 +0200 +++ b/OrthancStone/Sources/Fonts/GlyphAlphabet.h Fri Apr 25 12:52:46 2025 +0200 @@ -88,6 +88,9 @@ void Register(FontRenderer& renderer, uint32_t unicode); + void Register(FontRenderer& renderer, + const std::string& utf8); + #if ORTHANC_ENABLE_LOCALE == 1 static bool GetUnicodeFromCodepage(uint32_t& unicode, unsigned int index, diff -r bdb28e2d2767 -r 639b4960bb51 OrthancStone/Sources/Fonts/GlyphBitmapAlphabet.cpp --- a/OrthancStone/Sources/Fonts/GlyphBitmapAlphabet.cpp Fri Apr 25 12:12:12 2025 +0200 +++ b/OrthancStone/Sources/Fonts/GlyphBitmapAlphabet.cpp Fri Apr 25 12:52:46 2025 +0200 @@ -112,4 +112,12 @@ return bitmap.release(); } + + + Orthanc::ImageAccessor* GlyphBitmapAlphabet::RenderText(FontRenderer& font, + const std::string& utf8) + { + alphabet_.Register(font, utf8); + return RenderText(utf8); + } } diff -r bdb28e2d2767 -r 639b4960bb51 OrthancStone/Sources/Fonts/GlyphBitmapAlphabet.h --- a/OrthancStone/Sources/Fonts/GlyphBitmapAlphabet.h Fri Apr 25 12:12:12 2025 +0200 +++ b/OrthancStone/Sources/Fonts/GlyphBitmapAlphabet.h Fri Apr 25 12:52:46 2025 +0200 @@ -53,8 +53,10 @@ void LoadCodepage(FontRenderer& renderer, Orthanc::Encoding codepage); #endif - - + Orthanc::ImageAccessor* RenderText(const std::string& utf8) const; + + Orthanc::ImageAccessor* RenderText(FontRenderer& font, + const std::string& utf8); }; }