mirror of
https://github.com/raysan5/raylib.git
synced 2025-09-15 07:48:15 +00:00
Fix MeasureTextEx() height calculation (#3770)
This commit is contained in:
@@ -1257,7 +1257,7 @@ Vector2 MeasureTextEx(Font font, const char *text, float fontSize, float spacing
|
|||||||
float textWidth = 0.0f;
|
float textWidth = 0.0f;
|
||||||
float tempTextWidth = 0.0f; // Used to count longer text line width
|
float tempTextWidth = 0.0f; // Used to count longer text line width
|
||||||
|
|
||||||
float textHeight = (float)font.baseSize;
|
float textHeight = fontSize;
|
||||||
float scaleFactor = fontSize/(float)font.baseSize;
|
float scaleFactor = fontSize/(float)font.baseSize;
|
||||||
|
|
||||||
int letter = 0; // Current character
|
int letter = 0; // Current character
|
||||||
@@ -1294,7 +1294,7 @@ Vector2 MeasureTextEx(Font font, const char *text, float fontSize, float spacing
|
|||||||
if (tempTextWidth < textWidth) tempTextWidth = textWidth;
|
if (tempTextWidth < textWidth) tempTextWidth = textWidth;
|
||||||
|
|
||||||
textSize.x = tempTextWidth*scaleFactor + (float)((tempByteCounter - 1)*spacing);
|
textSize.x = tempTextWidth*scaleFactor + (float)((tempByteCounter - 1)*spacing);
|
||||||
textSize.y = textHeight*scaleFactor;
|
textSize.y = textHeight;
|
||||||
|
|
||||||
return textSize;
|
return textSize;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user