diff options
-rw-r--r-- | configure.ac | 6 | ||||
-rw-r--r-- | pango/pangofc-fontmap.c | 8 |
2 files changed, 14 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac index 34e0eb9b..77c6291c 100644 --- a/configure.ac +++ b/configure.ac @@ -224,6 +224,12 @@ have_fontconfig=false if $have_harfbuzz ; then PKG_CHECK_MODULES(FONTCONFIG, fontconfig >= 2.10.91, have_fontconfig=true, AC_MSG_RESULT([no])) fi +if $have_fontconfig ; then + pango_save_libs=$LIBS + LIBS="$LIBS $FONTCONFIG_LIBS" + AC_CHECK_FUNCS(FcWeightFromOpenType) + LIBS=$pango_save_libs +fi # # Checks for FreeType diff --git a/pango/pangofc-fontmap.c b/pango/pangofc-fontmap.c index 6da934c4..e7034589 100644 --- a/pango/pangofc-fontmap.c +++ b/pango/pangofc-fontmap.c @@ -1375,6 +1375,9 @@ pango_fc_font_map_list_families (PangoFontMap *fontmap, static int pango_fc_convert_weight_to_fc (PangoWeight pango_weight) { +#ifdef HAVE_FCWEIGHTFROMOPENTYPE + return FcWeightFromOpenType (pango_weight); +#else if (pango_weight <= (PANGO_WEIGHT_THIN + PANGO_WEIGHT_ULTRALIGHT) / 2) return FC_WEIGHT_THIN; else if (pango_weight <= (PANGO_WEIGHT_ULTRALIGHT + PANGO_WEIGHT_LIGHT) / 2) @@ -1399,6 +1402,7 @@ pango_fc_convert_weight_to_fc (PangoWeight pango_weight) return FC_WEIGHT_BLACK; else return FC_WEIGHT_EXTRABLACK; +#endif } static int @@ -2061,6 +2065,9 @@ pango_fc_font_map_shutdown (PangoFcFontMap *fcfontmap) static PangoWeight pango_fc_convert_weight_to_pango (int fc_weight) { +#ifdef HAVE_FCWEIGHTFROMOPENTYPE + return FcWeightToOpenType (fc_weight); +#else if (fc_weight <= (FC_WEIGHT_THIN + FC_WEIGHT_EXTRALIGHT) / 2) return PANGO_WEIGHT_THIN; else if (fc_weight <= (FC_WEIGHT_EXTRALIGHT + FC_WEIGHT_LIGHT) / 2) @@ -2085,6 +2092,7 @@ pango_fc_convert_weight_to_pango (int fc_weight) return PANGO_WEIGHT_HEAVY; else return PANGO_WEIGHT_ULTRAHEAVY; +#endif } static PangoStyle |