[pango] [win32] Bug 733764 - Support more / free font weights



commit 9f221d657e98d2dff377420a02cd91c6411b9c5a
Author: Behdad Esfahbod <behdad behdad org>
Date:   Fri Jul 25 18:17:51 2014 -0400

    [win32] Bug 733764 - Support more / free font weights

 pango/pangowin32-fontmap.c |   38 ++++----------------------------------
 1 files changed, 4 insertions(+), 34 deletions(-)
---
diff --git a/pango/pangowin32-fontmap.c b/pango/pangowin32-fontmap.c
index 76c91c7..4cd9fa8 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;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]