Skip to content

Commit

Permalink
Update rtext.c
Browse files Browse the repository at this point in the history
  • Loading branch information
raysan5 committed Oct 29, 2024
1 parent 10c8e4e commit d15e583
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/rtext.c
Original file line number Diff line number Diff line change
Expand Up @@ -1282,7 +1282,8 @@ Vector2 MeasureTextEx(Font font, const char *text, float fontSize, float spacing
{
Vector2 textSize = { 0 };

if ((isGpuReady && (font.texture.id == 0)) || (text == NULL)) return textSize; // Security check
if ((isGpuReady && (font.texture.id == 0)) ||
(text == NULL) || (text[0] == '\0')) return textSize; // Security check

int size = TextLength(text); // Get size in bytes of text
int tempByteCounter = 0; // Used to count longer text line num chars
Expand Down Expand Up @@ -1327,7 +1328,7 @@ Vector2 MeasureTextEx(Font font, const char *text, float fontSize, float spacing

if (tempTextWidth < textWidth) tempTextWidth = textWidth;

if (size > 0) textSize.x = tempTextWidth*scaleFactor + (float)((tempByteCounter - 1)*spacing);
textSize.x = tempTextWidth*scaleFactor + (float)((tempByteCounter - 1)*spacing);
textSize.y = textHeight;

return textSize;
Expand Down

0 comments on commit d15e583

Please sign in to comment.