[pango/strdup-avoidance: 3/3] itemize: Use pango_font_get_variant




commit da5b42263675acc7e615b8893a3a716646e910db
Author: Matthias Clasen <mclasen redhat com>
Date:   Sat Aug 27 20:52:06 2022 -0400

    itemize: Use pango_font_get_variant
    
    This avoids the unnecessary copy of the fonts
    font description, just to extract the variant.

 pango/itemize.c | 11 ++---------
 1 file changed, 2 insertions(+), 9 deletions(-)
---
diff --git a/pango/itemize.c b/pango/itemize.c
index 728ad7d98..cf9d6a8f0 100644
--- a/pango/itemize.c
+++ b/pango/itemize.c
@@ -1296,17 +1296,10 @@ variant_supported (PangoItem    *item,
 static PangoVariant
 get_font_variant (PangoItem *item)
 {
-  PangoFontDescription *desc;
-  PangoVariant variant = PANGO_VARIANT_NORMAL;
-
   if (item->analysis.font)
-    {
-      desc = pango_font_describe (item->analysis.font);
-      variant = pango_font_description_get_variant (desc);
-      pango_font_description_free (desc);
-    }
+    return pango_font_get_variant (item->analysis.font);
 
-  return variant;
+  return PANGO_VARIANT_NORMAL;
 }
 
 static PangoTextTransform


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