- Home /
Why fontSizeUsedForBestFit is inaccurate while using Canvas Scaler?
I've been trying to develop a custom rich text solution for UGUI, which is possible to display raw images alongside texts. (TextMesh Pro is probably the best choice for that, but I can't use it for my project)
In order to do that, I have to use quads to generate space for raw images. To make space perfectly fit the image, I calculated it with font size and cachedTextGenerator.fontSizeUsedForBestFit while in BestFit mode.
The problem is, I couldn't understand the logic behind fontSizeUsedForBestFit. While using the Canvas Scaler, the value of fontSizeUsedForBestFit can be smaller than Min Size or bigger than Max Size, but it still displays with the correct font size. (I compared it with another text in a different canvas without canvas scaler)
So obviously, the text is displayed correctly, but the space I created for quads is inaccurate or completely wrong.
Does anyone know what caused that difference for fontSizeUsedForBestFit?
Your answer
Follow this Question
Related Questions
Is It Possible to Render the same Data to 2 Different UI Text Objects? 1 Answer
Quick Question on UI Text Alignment 1 Answer
How to display UI Text on GameObject in script? 0 Answers
UI fade with CanvasGroup vs of Image.color.alpha or Text.color.alpha performance 1 Answer
How do I carry over canvas ui text to the next scene 2 Answers