summaryrefslogtreecommitdiff
path: root/pango/pangowin32-fontmap.c
diff options
context:
space:
mode:
authorBehdad Esfahbod <behdad@behdad.org>2014-07-25 18:17:51 -0400
committerBehdad Esfahbod <behdad@behdad.org>2014-07-25 18:17:51 -0400
commit9f221d657e98d2dff377420a02cd91c6411b9c5a (patch)
tree94cb29318bf3fb7a8fcb515f697ef40e064242bb /pango/pangowin32-fontmap.c
parent424008bd763abfa881ea8c6fac669062cbcfa83d (diff)
downloadpango-9f221d657e98d2dff377420a02cd91c6411b9c5a.tar.gz
[win32] Bug 733764 - Support more / free font weights
Diffstat (limited to 'pango/pangowin32-fontmap.c')
-rw-r--r--pango/pangowin32-fontmap.c38
1 files 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;