summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2019-09-29 21:25:22 +0200
committerGitHub <noreply@github.com>2019-09-29 21:25:22 +0200
commitab28c6b6ddc96ece02eb2e2800722fae68e338b7 (patch)
tree76cec43fc5222bebd28c4554d7f15db96404bdc4
parent3b532aa7ebddd47f8b041190c30b5b473dfbe116 (diff)
parent20b493f7905e0a66b3a80d071f52fa3ecad87793 (diff)
Merge pull request #32432 from rodolforg/fix_32154-dynamic_font_crashes
fix #32154 dynamic font crash if no available font size
-rw-r--r--scene/resources/dynamic_font.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/scene/resources/dynamic_font.cpp b/scene/resources/dynamic_font.cpp
index 5704212831..99a2881d58 100644
--- a/scene/resources/dynamic_font.cpp
+++ b/scene/resources/dynamic_font.cpp
@@ -192,7 +192,7 @@ Error DynamicFontAtSize::_load() {
ERR_FAIL_V_MSG(ERR_FILE_CANT_OPEN, "Error loading font.");
}
- if (FT_HAS_COLOR(face)) {
+ if (FT_HAS_COLOR(face) && face->num_fixed_sizes > 0) {
int best_match = 0;
int diff = ABS(id.size - ((int64_t)face->available_sizes[0].width));
scale_color_font = float(id.size) / face->available_sizes[0].width;