From: Thomas Geymayer Date: Fri, 14 Jun 2013 21:33:26 +0000 (+0200) Subject: canvas::Text: set font resolution to actual texel size. X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=02babbe340a343259b123ce988bc5a1cd1e23999;p=simgear.git canvas::Text: set font resolution to actual texel size. --- diff --git a/simgear/canvas/elements/CanvasText.cxx b/simgear/canvas/elements/CanvasText.cxx index 38f11611..012f9325 100644 --- a/simgear/canvas/elements/CanvasText.cxx +++ b/simgear/canvas/elements/CanvasText.cxx @@ -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); } //----------------------------------------------------------------------------