Mercurial > hg > orthanc-stone
changeset 2226:639b4960bb51
merge
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Fri, 25 Apr 2025 12:52:46 +0200 |
parents | a943ce01ce0a (diff) bdb28e2d2767 (current diff) |
children | 71e573e4dcc1 |
files | |
diffstat | 4 files changed, 36 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- 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,
--- 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,
--- 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); + } }
--- 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); }; }