canvas::Text: set font resolution to actual texel size.

This commit is contained in:
Thomas Geymayer 2013-06-14 23:33:26 +02:00
parent e27b6d050c
commit 02babbe340

View 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);
}
//----------------------------------------------------------------------------