From a7fe90319533cc4fdc79e3bc51355c3e69e341fa Mon Sep 17 00:00:00 2001 From: Tavmjong Bah Date: Thu, 2 Oct 2014 10:20:01 +0200 Subject: Sort styles for GUI. (Regression) (bzr r13341.1.237) --- src/libnrtype/FontFactory.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src') diff --git a/src/libnrtype/FontFactory.cpp b/src/libnrtype/FontFactory.cpp index c2b3c64fe..dd2ecddeb 100644 --- a/src/libnrtype/FontFactory.cpp +++ b/src/libnrtype/FontFactory.cpp @@ -513,6 +513,12 @@ static bool StyleNameCompareInternal(const StyleNames &style1, const StyleNames return( StyleNameValue( style1.CssName ) < StyleNameValue( style2.CssName ) ); } +static gint StyleNameCompareInternalGlib(gconstpointer a, gconstpointer b) +{ + return( StyleNameValue( ((StyleNames *)a)->CssName ) < + StyleNameValue( ((StyleNames *)b)->CssName ) ? -1 : 1 ); +} + static bool ustringPairSort(std::pair const& first, std::pair const& second) { // well, this looks weird. @@ -586,9 +592,12 @@ GList* font_factory::GetUIStyles(PangoFontFamily * in) pango_font_description_free(faceDescr); } g_free(faces); + + ret = g_list_sort( ret, StyleNameCompareInternalGlib ); return ret; } +// Used only by pdfinput/svg-builder.cpp (since rewrite to cache style) void font_factory::GetUIFamiliesAndStyles(FamilyToStylesMap *map) { g_assert(map); -- cgit v1.2.3