From d0994f4298641d65700b1bbc90b4ba6effa58320 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Wed, 8 Mar 2017 19:53:04 +0300 Subject: Add assert in fonts loading if font size < 4. --- src/gui/fonts/font.cpp | 10 +++++++++- src/gui/fonts/font.h | 2 +- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/gui/fonts/font.cpp b/src/gui/fonts/font.cpp index 488a2212b..c8f1a3561 100644 --- a/src/gui/fonts/font.cpp +++ b/src/gui/fonts/font.cpp @@ -99,7 +99,7 @@ extern char *strBuf; static int fontCounter; Font::Font(std::string filename, - const int size, + int size, const int style) : mFont(nullptr), mCreateCounter(0), @@ -116,6 +116,14 @@ Font::Font(std::string filename, } } + if (size < 4) + { + reportAlways("Error: requested load font %s with size %d", + filename.c_str(), + size); + size = 4; + } + if (!fontCounter) { strBuf = new char[65535]; diff --git a/src/gui/fonts/font.h b/src/gui/fonts/font.h index a96d29a32..71661b494 100644 --- a/src/gui/fonts/font.h +++ b/src/gui/fonts/font.h @@ -86,7 +86,7 @@ class Font final { public: Font(std::string filename, - const int size, + int size, const int style = 0); A_DELETE_COPY(Font) -- cgit v1.2.3-60-g2f50