Mercurial > hg > orthanc-stone
diff OrthancStone/Sources/Scene2D/CairoCompositor.cpp @ 1792:373d7f7e796e
ICompositor::ComputeTextBoundingBox()
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Mon, 17 May 2021 16:59:03 +0200 |
parents | 9ac2a65d4172 |
children | 3889ae96d2e9 |
line wrap: on
line diff
--- a/OrthancStone/Sources/Scene2D/CairoCompositor.cpp Mon May 17 16:11:17 2021 +0200 +++ b/OrthancStone/Sources/Scene2D/CairoCompositor.cpp Mon May 17 16:59:03 2021 +0200 @@ -190,4 +190,24 @@ return found->second->RenderText(utf8); } } + + +#if ORTHANC_ENABLE_LOCALE == 1 + TextBoundingBox* CairoCompositor::ComputeTextBoundingBox(size_t fontIndex, + const std::string& utf8) + { + Fonts::const_iterator found = fonts_.find(fontIndex); + + if (found == fonts_.end()) + { + throw Orthanc::OrthancException(Orthanc::ErrorCode_ParameterOutOfRange, + "No such font: " + boost::lexical_cast<std::string>(fontIndex)); + } + else + { + assert(found->second != NULL); + return new TextBoundingBox(found->second->GetAlphabet(), utf8); + } + } +#endif }