1
0
mirror of https://github.com/godotengine/godot.git synced 2025-12-06 17:25:19 +00:00

[TextServer] Add invalid font scaling check, restrict Linux/BSD system fonts lookup to TrueType/CFF only.

(cherry picked from commit 8d501a2dc3)
This commit is contained in:
bruvzg
2023-03-10 09:10:12 +02:00
committed by Yuri Sizov
parent 048c252602
commit d83245f2f9
3 changed files with 77 additions and 64 deletions

View File

@@ -825,7 +825,9 @@ _FORCE_INLINE_ bool TextServerFallback::_ensure_cache_for_size(FontFallback *p_f
FT_Select_Size(fd->face, best_match);
} else {
FT_Set_Pixel_Sizes(fd->face, 0, Math::round(fd->size.x * fd->oversampling));
fd->scale = ((double)fd->size.x * fd->oversampling) / (double)fd->face->size->metrics.y_ppem;
if (fd->face->size->metrics.y_ppem != 0) {
fd->scale = ((double)fd->size.x * fd->oversampling) / (double)fd->face->size->metrics.y_ppem;
}
}
fd->ascent = (fd->face->size->metrics.ascender / 64.0) / fd->oversampling * fd->scale;