From d05586ef0fa91a052e4e7811be0a5364c6d3d315 Mon Sep 17 00:00:00 2001 From: Hanaxar <87268284+hanaxar@users.noreply.github.com> Date: Thu, 20 Apr 2023 17:52:14 +0300 Subject: [PATCH] Avoid using hardcoded values in whitechar (#273) Proposed change avoids hardcoded values and creates white rectangle exaclty like in rcore. --- src/raygui.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/raygui.h b/src/raygui.h index d8a2bde..8b6805f 100644 --- a/src/raygui.h +++ b/src/raygui.h @@ -3632,9 +3632,10 @@ void GuiLoadStyleDefault(void) // Setup default raylib font guiFont = GetFontDefault(); - // Setup default raylib font rectangle - Rectangle whiteChar = { 41, 46, 2, 8 }; - SetShapesTexture(guiFont.texture, whiteChar); + // NOTE: Default raylib font character 95 is a white square + Rectangle whiteChar = guiFont.recs[95]; + // NOTE: We set up a 1px padding on char rectangle to avoid pixel bleeding on MSAA filtering + SetShapesTexture(guiFont.texture, (Rectangle){ whiteChar.x + 1, whiteChar.y + 1, whiteChar.width - 2, whiteChar.height - 2 }); } }