Fixed handling of Font implementations that don't handle multiple font resolutions.

This commit is contained in:
Robert Osfield
2011-05-13 19:08:04 +00:00
parent 460f433ca7
commit fe1c75aa8a
10 changed files with 59 additions and 32 deletions

View File

@@ -27,8 +27,6 @@ QFontImplementation::QFontImplementation(const QFont& font) :
_filename(font.toString().toStdString() + ".qfont"),
_font(font)
{
_currentRes.first = 0;
_currentRes.second = 0;
}
QFontImplementation::~QFontImplementation()
@@ -41,22 +39,13 @@ QFontImplementation::getFileName() const
return _filename;
}
void
QFontImplementation::setFontResolution(const osgText::FontResolution& fontSize)
{
if (fontSize == _currentRes)
return;
_currentRes = fontSize;
_font.setPixelSize(fontSize.second);
}
osgText::Glyph*
QFontImplementation::getGlyph(const osgText::FontResolution& fontRes, unsigned int charcode)
{
setFontResolution(fontRes);
unsigned int fontSize = fontRes.second;
_font.setPixelSize(fontSize);
float coord_scale = 1.0f/float(_currentRes.second);
float coord_scale = 1.0f/float(fontSize);
QFontMetrics fontMetrics(_font);
QFontMetricsF fontMetricsF(_font);