summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKhaled Hosny <khaledhosny@eglug.org>2019-10-23 10:50:49 +0200
committerKhaled Hosny <khaledhosny@eglug.org>2019-10-23 11:07:28 +0200
commit43961f477c1be0a3ad7d516e9de40d2dd7eca1f9 (patch)
treee409313a60858bef7fdb12365e6ee80cc12d10d1
parentd334ff1f89a51dde4ce96d7acac2c218be7d7ed5 (diff)
downloadpango-43961f477c1be0a3ad7d516e9de40d2dd7eca1f9.tar.gz
[coretext] make setting font gravity work
Setting font gravity to anything other than PANGO_GRAVITY_SOUTH causes no fonts to be matched on Core Text backend because the code for finding best match checks for equal gravity between the requested font and the fonts in the font set, and the later always have PANGO_GRAVITY_SOUTH. Hack around this by copying the gravity from the requested font. Can be tested with: $ pango-view --gravity=east --rotate=-90 utils/test-chinese.txt Currently without this change it gives: (pango-view:2824): Pango-WARNING **: 10:59:18.683: couldn't load font "serif Rotated-Left 12", modified variant/weight/stretch as fallback, expect ugly output. (pango-view:2824): Pango-ERROR **: 10:59:18.683: Could not load fallback font, bailing out. Trace/BPT trap: 5
-rw-r--r--pango/pangocoretext-fontmap.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/pango/pangocoretext-fontmap.c b/pango/pangocoretext-fontmap.c
index 96e13bab..038287a0 100644
--- a/pango/pangocoretext-fontmap.c
+++ b/pango/pangocoretext-fontmap.c
@@ -1188,6 +1188,7 @@ find_best_match (PangoCoreTextFamily *font_family,
for (i = 0; i < font_family->n_faces; i++)
{
new_desc = pango_font_face_describe (font_family->faces[i]);
+ pango_font_description_set_gravity (new_desc, pango_font_description_get_gravity (description));
if (pango_font_description_better_match (description, best_description,
new_desc))