From 16193a35b0e98e842091a77f048eb86d3aa777fd Mon Sep 17 00:00:00 2001 From: Ray Date: Thu, 18 Oct 2018 17:48:01 +0200 Subject: [PATCH] Some security checks on font loading --- examples/controls_review/controls_review.c | 5 +---- src/raygui.h | 9 ++++++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/examples/controls_review/controls_review.c b/examples/controls_review/controls_review.c index f958466..339cf35 100644 --- a/examples/controls_review/controls_review.c +++ b/examples/controls_review/controls_review.c @@ -52,12 +52,9 @@ int main() bool dropDown000EditMode = false; bool dropDown001EditMode = false; - - //TODO: Substituir DrawText por DrawTextEx y MeasureText por MeasureTextEx - //---------------------------------------------------------------------------------- - Font font = LoadFontEx("fonts/PixelOperator8.ttf", 8, 0, 0); + Font font = LoadFontEx("fonts/pixelpoiiz10.ttf", 10, 0, 0); GuiFont(font); SetTargetFPS(60); diff --git a/src/raygui.h b/src/raygui.h index 2f6db17..dbb2690 100644 --- a/src/raygui.h +++ b/src/raygui.h @@ -894,9 +894,12 @@ RAYGUIDEF void GuiUnlock(void) { guiState = NORMAL; } // Define custom gui font RAYGUIDEF void GuiFont(Font font) { - guiFont = font; - style[DEFAULT_TEXT_SIZE] = font.baseSize; - style[DEFAULT_TEXT_SPACING] = 1; + if (font.texture.id > 0) + { + guiFont = font; + style[DEFAULT_TEXT_SIZE] = font.baseSize; + style[DEFAULT_TEXT_SPACING] = 1; + } } // Set gui controls alpha global state