summaryrefslogtreecommitdiff
path: root/modules/text_server_fb
diff options
context:
space:
mode:
authorbruvzg <7645683+bruvzg@users.noreply.github.com>2023-03-10 09:10:12 +0200
committerYuri Sizov <yuris@humnom.net>2023-03-13 14:17:42 +0100
commitd83245f2f94410768016899df91ce3134091bb7b (patch)
treebb896d208f4bf649fd180e9e8cdf163d81533ce1 /modules/text_server_fb
parent048c252602aa9e21175b7e125dbcae204e303b1f (diff)
[TextServer] Add invalid font scaling check, restrict Linux/BSD system fonts lookup to TrueType/CFF only.
(cherry picked from commit 8d501a2dc31f3bef6d5a7f6b0d060c8915082011)
Diffstat (limited to 'modules/text_server_fb')
-rw-r--r--modules/text_server_fb/text_server_fb.cpp4
1 files changed, 3 insertions, 1 deletions
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;