From 43961f477c1be0a3ad7d516e9de40d2dd7eca1f9 Mon Sep 17 00:00:00 2001 From: Khaled Hosny Date: Wed, 23 Oct 2019 10:50:49 +0200 Subject: [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 --- pango/pangocoretext-fontmap.c | 1 + 1 file changed, 1 insertion(+) 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)) -- cgit v1.2.1