mirror of
https://github.com/FunKey-Project/RetroFE.git
synced 2026-04-18 01:32:50 +02:00
Fixed vertical alignment for text wider than the maximum width.
This commit is contained in:
@@ -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;
|
||||||
|
|||||||
Reference in New Issue
Block a user