From 9f221d657e98d2dff377420a02cd91c6411b9c5a Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Fri, 25 Jul 2014 18:17:51 -0400 Subject: [win32] Bug 733764 - Support more / free font weights --- pango/pangowin32-fontmap.c | 38 ++++---------------------------------- 1 file changed, 4 insertions(+), 34 deletions(-) diff --git a/pango/pangowin32-fontmap.c b/pango/pangowin32-fontmap.c index 76c91c7a..4cd9fa87 100644 --- a/pango/pangowin32-fontmap.c +++ b/pango/pangowin32-fontmap.c @@ -1196,26 +1196,11 @@ pango_win32_font_description_from_logfont (const LOGFONT *lfp) variant = PANGO_VARIANT_NORMAL; - /* The PangoWeight values PANGO_WEIGHT_* map exactly do Windows FW_* - * values. Is this on purpose? Quantize the weight to exact - * PANGO_WEIGHT_* values. Is this a good idea? - */ if (lfp->lfWeight == FW_DONTCARE) weight = PANGO_WEIGHT_NORMAL; - else if (lfp->lfWeight <= (FW_ULTRALIGHT + FW_LIGHT) / 2) - weight = PANGO_WEIGHT_ULTRALIGHT; - else if (lfp->lfWeight <= (FW_LIGHT + FW_NORMAL) / 2) - weight = PANGO_WEIGHT_LIGHT; - else if (lfp->lfWeight <= (FW_NORMAL + FW_SEMIBOLD) / 2) - weight = PANGO_WEIGHT_NORMAL; - else if (lfp->lfWeight <= (FW_SEMIBOLD + FW_BOLD) / 2) - weight = PANGO_WEIGHT_SEMIBOLD; - else if (lfp->lfWeight <= (FW_BOLD + FW_ULTRABOLD) / 2) - weight = PANGO_WEIGHT_BOLD; - else if (lfp->lfWeight <= (FW_ULTRABOLD + FW_HEAVY) / 2) - weight = PANGO_WEIGHT_ULTRABOLD; else - weight = PANGO_WEIGHT_HEAVY; + /* The PangoWeight values PANGO_WEIGHT_* map exactly to Windows FW_*. */ + weight = (PangoWeight) lfp->lfWeight; /* XXX No idea how to figure out the stretch */ stretch = PANGO_STRETCH_NORMAL; @@ -1396,26 +1381,11 @@ pango_win32_font_description_from_logfontw (const LOGFONTW *lfp) variant = PANGO_VARIANT_NORMAL; - /* The PangoWeight values PANGO_WEIGHT_* map exactly do Windows FW_* - * values. Is this on purpose? Quantize the weight to exact - * PANGO_WEIGHT_* values. Is this a good idea? - */ if (lfp->lfWeight == FW_DONTCARE) weight = PANGO_WEIGHT_NORMAL; - else if (lfp->lfWeight <= (FW_ULTRALIGHT + FW_LIGHT) / 2) - weight = PANGO_WEIGHT_ULTRALIGHT; - else if (lfp->lfWeight <= (FW_LIGHT + FW_NORMAL) / 2) - weight = PANGO_WEIGHT_LIGHT; - else if (lfp->lfWeight <= (FW_NORMAL + FW_SEMIBOLD) / 2) - weight = PANGO_WEIGHT_NORMAL; - else if (lfp->lfWeight <= (FW_SEMIBOLD + FW_BOLD) / 2) - weight = PANGO_WEIGHT_SEMIBOLD; - else if (lfp->lfWeight <= (FW_BOLD + FW_ULTRABOLD) / 2) - weight = PANGO_WEIGHT_BOLD; - else if (lfp->lfWeight <= (FW_ULTRABOLD + FW_HEAVY) / 2) - weight = PANGO_WEIGHT_ULTRABOLD; else - weight = PANGO_WEIGHT_HEAVY; + /* The PangoWeight values PANGO_WEIGHT_* map exactly to Windows FW_*. */ + weight = (PangoWeight) lfp->lfWeight; /* XXX No idea how to figure out the stretch */ stretch = PANGO_STRETCH_NORMAL; -- cgit v1.2.1