From d83245f2f94410768016899df91ce3134091bb7b Mon Sep 17 00:00:00 2001 From: bruvzg <7645683+bruvzg@users.noreply.github.com> Date: Fri, 10 Mar 2023 09:10:12 +0200 Subject: [TextServer] Add invalid font scaling check, restrict Linux/BSD system fonts lookup to TrueType/CFF only. (cherry picked from commit 8d501a2dc31f3bef6d5a7f6b0d060c8915082011) --- modules/text_server_fb/text_server_fb.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'modules/text_server_fb') diff --git a/modules/text_server_fb/text_server_fb.cpp b/modules/text_server_fb/text_server_fb.cpp index 240ae8310a..d67ae6b45b 100644 --- a/modules/text_server_fb/text_server_fb.cpp +++ b/modules/text_server_fb/text_server_fb.cpp @@ -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; -- cgit v1.2.3