Merge pull request #32432 from rodolforg/fix_32154-dynamic_font_crashes

fix #32154 dynamic font crash if no available font size
This commit is contained in:
Rémi Verschelde 2019-09-29 21:25:22 +02:00 committed by GitHub
commit ab28c6b6dd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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;