mirror of
https://gitea.wildfiregames.com/0ad/0ad
synced 2026-06-16 05:13:58 -07:00
Add deprecation warning to GetTextSize API
Adds a runtime warning to `Engine.GetTextSize` indicating that the API is deprecated and will be removed in a future version. This API does not simulate GUI rendering accurately, as it treats markup tags like [color], [font], or [icon] as visible characters. This leads to incorrect size measurements in modern GUI layouts. New recommended alternatives: - Use `Engine.GetGUITextSize(...)` for accurate measurement of raw text blocks, fully simulating GUI rendering. - Use `guiObject.getTextSize()` when working within a specific GUI object, as it accounts for maxWidth, padding (bufferZone), and object constraints. A warning is now emitted at runtime to guide developers toward these updated APIs.
This commit is contained in:
parent
b42a2b9adb
commit
e845da025a
1 changed files with 2 additions and 0 deletions
|
|
@ -25,6 +25,7 @@
|
|||
#include "lib/utf8.h"
|
||||
#include "maths/Size2D.h"
|
||||
#include "maths/MD5.h"
|
||||
#include "ps/CLogger.h"
|
||||
#include "ps/CStrIntern.h"
|
||||
#include "ps/GUID.h"
|
||||
#include "ps/GameSetup/Atlas.h"
|
||||
|
|
@ -87,6 +88,7 @@ int GetFps()
|
|||
|
||||
CSize2D GetTextSize(const std::string& fontName, const std::wstring& text)
|
||||
{
|
||||
LOGWARNING("Engine.GetTextSize is deprecated and will be removed in a future version.Use guiObject.GetPreferedTextSize for accurate text sizing or guiObject.getTextSize for sizing within GUI objects.");
|
||||
float width = 0;
|
||||
float height = 0;
|
||||
CStrIntern _fontName(fontName);
|
||||
|
|
|
|||
Loading…
Reference in a new issue