diff options
author | Behdad Esfahbod <behdad@behdad.org> | 2014-07-26 16:27:59 -0400 |
---|---|---|
committer | Behdad Esfahbod <behdad@behdad.org> | 2014-07-26 16:27:59 -0400 |
commit | 40f5c151e911464cb9da569d8ceee88f52fcbfbf (patch) | |
tree | 56d4275d3ea25150b43e7f259a145c3dad84c234 /pango/pangofc-fontmap.c | |
parent | b30a04708823c14fc9fef81294bfb2b87ac5df7a (diff) | |
download | pango-40f5c151e911464cb9da569d8ceee88f52fcbfbf.tar.gz |
[fc] Use FcWeightTo/FromOpenType() if available
This makes the weight mapping a continuous, as ooposed to a step function.
Last piece of Bug 733764 - Support more / free font weights
Diffstat (limited to 'pango/pangofc-fontmap.c')
-rw-r--r-- | pango/pangofc-fontmap.c | 8 |
1 files changed, 8 insertions, 0 deletions
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 |