mirror of
https://gitea.wildfiregames.com/0ad/0ad.git
synced 2026-07-10 15:15:25 +00:00
Add font engine aware of Gui.scale
This commit enhances text rendering by leveraging FreeType and a dynamic font atlas. Previously, GUI scaling relied on bitmap fonts, which led to blurry and distorted text when scaling up. Now, we scale the font size directly using FreeType, resulting in much sharper and more readable text at any GUI scale. Key improvements: - Replaced bitmap font scaling with true font size scaling via FreeType. - Reduced glyph cache dependency on fixed positions, relying on shader scaling instead. - Switched to float-based glyph positioning for more accurate rendering and scaling. These changes ensure clean and consistent text appearance across different GUI scales.
This commit is contained in:
@@ -87,8 +87,8 @@ int GetFps()
|
||||
|
||||
CSize2D GetTextSize(const std::string& fontName, const std::wstring& text)
|
||||
{
|
||||
int width = 0;
|
||||
int height = 0;
|
||||
float width = 0;
|
||||
float height = 0;
|
||||
CStrIntern _fontName(fontName);
|
||||
CFontMetrics fontMetrics(_fontName);
|
||||
fontMetrics.CalculateStringSize(text.c_str(), width, height);
|
||||
|
||||
Reference in New Issue
Block a user