[pango/coretext-gravity] [coretext] make setting font gravity work



commit fcaa1f71c2c665ec08f5e9d46a5a3599e4ffbe38
Author: Khaled Hosny <khaledhosny eglug org>
Date:   Wed Oct 23 10:50:49 2019 +0200

    [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 -q -o a.png --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))


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]