Add a function that measures a text size in CEGUI `guiGetTextSize`
Opened this issue · 4 comments
Is your feature request related to a problem? Please describe.
Currently there is no way to get a text size when dealing with CEGUI.
dxGetTextSize does the job but only when using built-in fonts which are shared between both.
Describe the solution you'd like
guiGetTextSize(string text, mixed font, float width, float height, boolean wordWarp)
width and height arguments control the bounding box of the text. They can't be both passed to the function - one of them has to be provided or else just create a label with those dimensions.
Describe alternatives you've considered
No response
Additional context
No response
Security Policy
- I have read and understood the Security Policy and this issue is not about a cheat or security vulnerability.
I think using guiGetTextSize(string text, mixed font, ...) may not be very helpful, since the text and font are already tied to the GUI element itself.
A more useful approach would be something like guiGetTextSize(guiElement), which directly calculates the size of the text inside that element without having to pass its properties again.
guiGetTextSize(guiElement) doesn't make much sense because why bother creating this function when there is guiGetSize(element gui-element)
guiGetTextSize(string text, mixed font, float width, float height, boolean wordWarp) can be used when wanting to create perfectly sized/positioned gui-labels that only contain the desired text and especially if you use custom gui-fonts.
Isn't guiSetFont used to set font? You can use custom fonts with it, right?
Yes you can use custom fonts with gui-elements, but if the font is too big or too small you cant get the exact text size. It's just better to have a CEGUI version of dxGetTextSize