]> git.mxchange.org Git - simgear.git/commitdiff
canvas::Text: set font resolution to actual texel size.
authorThomas Geymayer <tomgey@gmail.com>
Fri, 14 Jun 2013 21:33:26 +0000 (23:33 +0200)
committerThomas Geymayer <tomgey@gmail.com>
Fri, 14 Jun 2013 21:33:26 +0000 (23:33 +0200)
simgear/canvas/elements/CanvasText.cxx

index 38f116114836e692d3f5d9f1774b26e22389d39f..012f932502e5784124f5d2e6eaa67f651b0de50a 100644 (file)
@@ -34,6 +34,7 @@ namespace canvas
 
       TextOSG(canvas::Text* text);
 
+      void setCharacterSize(float height);
       void setCharacterAspect(float aspect);
       void setFill(const std::string& fill);
       void setBackgroundColor(const std::string& fill);
@@ -56,10 +57,28 @@ namespace canvas
 
   }
 
+  //----------------------------------------------------------------------------
+  void Text::TextOSG::setCharacterSize(float height)
+  {
+    TextBase::setCharacterSize(height);
+
+    unsigned int res = 32;
+    CanvasPtr canvas = _text_element->_canvas.lock();
+    if( canvas )
+    {
+      float factor = canvas->getSizeY() / canvas->getViewHeight();
+      res = height * factor;
+    }
+
+    // TODO different vertical/horizontal resolution?
+    // TODO configurable?
+    setFontResolution(res, res);
+  }
+
   //----------------------------------------------------------------------------
   void Text::TextOSG::setCharacterAspect(float aspect)
   {
-    setCharacterSize(getCharacterHeight(), aspect);
+    TextBase::setCharacterSize(getCharacterHeight(), aspect);
   }
 
   //----------------------------------------------------------------------------