[pango/pango2: 171/178] fontset: Ignore gravity and variations




commit 08957c21aed90e45ae75d2f8d3bb42eddad5fa08
Author: Matthias Clasen <mclasen redhat com>
Date:   Wed Jun 22 11:20:22 2022 -0400

    fontset: Ignore gravity and variations
    
    Ignore gravity and variations when matching in generic
    families, since the hb families contained in there
    don't have those fields in their descriptions.
    
    This fixes display of Chinese examples in pango-view.

 pango/pango-fontset-cached.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)
---
diff --git a/pango/pango-fontset-cached.c b/pango/pango-fontset-cached.c
index adbc4409f..2692ac24b 100644
--- a/pango/pango-fontset-cached.c
+++ b/pango/pango-fontset-cached.c
@@ -109,16 +109,20 @@ pango_fontset_cached_get_font (PangoFontset *fontset,
       else if (PANGO_IS_GENERIC_FAMILY (item))
         {
           PangoGenericFamily *family = PANGO_GENERIC_FAMILY (item);
+          PangoFontDescription *copy;
           PangoFontFace *face;
 
           /* Here is where we implement delayed picking for generic families.
            * If a face does not cover the character and its family is generic,
            * choose a different face from the same family and create a font to use.
            */
-          face = pango_generic_family_find_face (family,
-                                                 self->description,
-                                                 self->language,
-                                                 wc);
+          copy = pango_font_description_copy_static (self->description);
+          pango_font_description_unset_fields (copy, PANGO_FONT_MASK_VARIATIONS |
+                                                     PANGO_FONT_MASK_GRAVITY |
+                                                     PANGO_FONT_MASK_VARIANT);
+          face = pango_generic_family_find_face (family, copy, self->language, wc);
+          pango_font_description_free (copy);
+
           if (face)
             {
               PangoFont *font;


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