diff options
author | Gunnar Hjalmarsson <gunnarhj@ubuntu.com> | 2020-11-10 19:30:01 +0100 |
---|---|---|
committer | Gunnar Hjalmarsson <gunnarhj@ubuntu.com> | 2020-11-10 19:30:01 +0100 |
commit | 43b35d4ca5269e60b5b293c2428d6feba86990a4 (patch) | |
tree | 2d551c4cae9bf0a009e3a5dfb5de49002b949ca8 | |
parent | 4115af61d234028c0680929d409adf6c0d8e8211 (diff) |
From upstream: fc_Sort-faces-of-a-family.patch
-rw-r--r-- | debian/patches/fc_Sort-faces-of-a-family.patch | 58 | ||||
-rw-r--r-- | debian/patches/series | 1 |
2 files changed, 59 insertions, 0 deletions
diff --git a/debian/patches/fc_Sort-faces-of-a-family.patch b/debian/patches/fc_Sort-faces-of-a-family.patch new file mode 100644 index 00000000..6464ff35 --- /dev/null +++ b/debian/patches/fc_Sort-faces-of-a-family.patch @@ -0,0 +1,58 @@ +From: Matthias Clasen <mclasen@redhat.com> +Date: Mon, 21 Sep 2020 12:52:42 -0400 +Subject: [PATCH] fc: Sort faces of a family +Origin: https://gitlab.gnome.org/GNOME/pango/-/commit/99f4661a + +Make pango_font_family_list_faces() return faces +sorted by slant and weight. This makes the font +chooser look much less random. +--- + pango/pangofc-fontmap.c | 28 ++++++++++++++++++++++++++++ + 1 file changed, 28 insertions(+) + +diff --git a/pango/pangofc-fontmap.c b/pango/pangofc-fontmap.c +index eed0960a..341b2d6c 100644 +--- a/pango/pangofc-fontmap.c ++++ b/pango/pangofc-fontmap.c +@@ -2726,6 +2726,32 @@ create_face (PangoFcFamily *fcfamily, + return face; + } + ++static int ++compare_face (const void *p1, const void *p2) ++{ ++ const PangoFcFace *f1 = *(const void **)p1; ++ const PangoFcFace *f2 = *(const void **)p2; ++ int w1, w2; ++ int s1, s2; ++ ++ if (FcPatternGetInteger (f1->pattern, FC_WEIGHT, 0, &w1) != FcResultMatch) ++ w1 = FC_WEIGHT_MEDIUM; ++ ++ if (FcPatternGetInteger (f1->pattern, FC_SLANT, 0, &s1) != FcResultMatch) ++ s1 = FC_SLANT_ROMAN; ++ ++ if (FcPatternGetInteger (f2->pattern, FC_WEIGHT, 0, &w2) != FcResultMatch) ++ w2 = FC_WEIGHT_MEDIUM; ++ ++ if (FcPatternGetInteger (f2->pattern, FC_SLANT, 0, &s2) != FcResultMatch) ++ s2 = FC_SLANT_ROMAN; ++ ++ if (s1 != s2) ++ return s1 - s2; /* roman < italic < oblique */ ++ ++ return w1 - w2; /* from light to heavy */ ++} ++ + static void + ensure_faces (PangoFcFamily *fcfamily) + { +@@ -2835,6 +2861,8 @@ ensure_faces (PangoFcFamily *fcfamily) + + faces = g_renew (PangoFcFace *, faces, num); + ++ qsort (faces, num, sizeof (PangoFcFace *), compare_face); ++ + fcfamily->n_faces = num; + fcfamily->faces = faces; + } diff --git a/debian/patches/series b/debian/patches/series index 71a24a68..809aec63 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -1,2 +1,3 @@ Revert-testsuite-Don-t-use-g_test_skip.patch Tolerate-slightly-different-output-for-the-word-breaking-.patch +fc_Sort-faces-of-a-family.patch |