diff OrthancStone/Sources/Scene2D/OpenGLCompositor.cpp @ 1792:373d7f7e796e

ICompositor::ComputeTextBoundingBox()
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 17 May 2021 16:59:03 +0200
parents 9ac2a65d4172
children c5e6379b9cd0
line wrap: on
line diff
--- a/OrthancStone/Sources/Scene2D/OpenGLCompositor.cpp	Mon May 17 16:11:17 2021 +0200
+++ b/OrthancStone/Sources/Scene2D/OpenGLCompositor.cpp	Mon May 17 16:59:03 2021 +0200
@@ -253,4 +253,24 @@
     canvasWidth_ = canvasWidth;
     canvasHeight_ = canvasHeight;
   }
+  
+
+#if ORTHANC_ENABLE_LOCALE == 1
+  TextBoundingBox* OpenGLCompositor::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().GetAlphabet(), utf8);
+    }
+  }
+#endif
 }