Fixed vertical alignment for text wider than the maximum width.

This commit is contained in:
Pieter Hulshoff
2016-05-28 08:55:24 +02:00
parent bead1312f8
commit bf24f6cba2

View File

@@ -66,6 +66,9 @@ void Text::draw()
float imageHeight = 0; float imageHeight = 0;
float imageWidth = 0; float imageWidth = 0;
imageHeight = (float)font->getHeight();
float scale = (float)baseViewInfo.FontSize / (float)imageHeight;
// determine image width // determine image width
for(unsigned int i = 0; i < textData_.size(); ++i) for(unsigned int i = 0; i < textData_.size(); ++i)
{ {
@@ -77,14 +80,14 @@ void Text::draw()
imageWidth += glyph.minX; imageWidth += glyph.minX;
} }
if ((imageWidth + glyph.advance)*scale > baseViewInfo.MaxWidth )
break;
imageWidth += glyph.advance; imageWidth += glyph.advance;
} }
} }
imageHeight = (float)font->getHeight();
float scale = (float)baseViewInfo.FontSize / (float)imageHeight;
float oldWidth = baseViewInfo.Width; float oldWidth = baseViewInfo.Width;
float oldHeight = baseViewInfo.Height; float oldHeight = baseViewInfo.Height;
float oldImageWidth = baseViewInfo.ImageHeight; float oldImageWidth = baseViewInfo.ImageHeight;