summaryrefslogtreecommitdiff
path: root/pango/pangowin32-fontmap.c
diff options
context:
space:
mode:
authorTor Lillqvist <tml@iki.fi>2009-03-09 14:21:49 +0200
committerTor Lillqvist <tml@iki.fi>2009-03-09 14:21:49 +0200
commita45933e695a6a60ebae63b30b5a021859cb85305 (patch)
treeacb9ebba5ba1c335837b65de870183604e84e13b /pango/pangowin32-fontmap.c
parentfab7a104d5c6f3182fe9bdc84bfcba5807f87f8a (diff)
downloadpango-a45933e695a6a60ebae63b30b5a021859cb85305.tar.gz
Revert change from 2008-05-28 that mapped words and word pairs that
indicate weight or stretch into the corrersponding Pango font description setting and stripped those word(s) from the family name. Personally I liked the effect this had on the GTK+ font picker, combining all weight and stretch variants of what de facto is one typeface family (for instance DejaVu) under one family name. But Bulia Byak reported that this caused regressions in Inkscape. So OK then.
Diffstat (limited to 'pango/pangowin32-fontmap.c')
-rw-r--r--pango/pangowin32-fontmap.c100
1 files changed, 2 insertions, 98 deletions
diff --git a/pango/pangowin32-fontmap.c b/pango/pangowin32-fontmap.c
index 28e0ebd0..833219a9 100644
--- a/pango/pangowin32-fontmap.c
+++ b/pango/pangowin32-fontmap.c
@@ -1069,63 +1069,9 @@ pango_win32_font_description_from_logfontw (const LOGFONTW *lfp)
gchar *family;
PangoStyle style;
PangoVariant variant;
- PangoWeight weight, name_weight;
+ PangoWeight weight;
PangoStretch stretch;
- static const struct {
- const char *marker;
- int marker_len;
- int remove_len;
- PangoWeight weight;
- } weight_names[] = {
-#define ENTRY(n, s) ENTRY2 (n, sizeof (#n) - 1, s)
-#define ENTRY2(n, l, s) ENTRY3 (n, l, l, s)
-#define ENTRY3(n, marker_len, remove_len, s) { #n, marker_len, remove_len, PANGO_WEIGHT_##s }
- ENTRY (Ultra Light, ULTRALIGHT),
- ENTRY (UltraLight, ULTRALIGHT),
- ENTRY (Light, LIGHT),
- ENTRY (Medium, NORMAL),
- ENTRY (Demi Bold, SEMIBOLD),
- ENTRY (Demi, SEMIBOLD),
- ENTRY (Ultra Bold, ULTRABOLD),
- ENTRY (Extra Bold, ULTRABOLD),
- ENTRY (SemiBold, SEMIBOLD),
- ENTRY (DemiBold, SEMIBOLD),
- ENTRY (UltraBold, ULTRABOLD),
- ENTRY (ExtraBold, ULTRABOLD),
- ENTRY (Bold, BOLD),
- ENTRY (Heavy, HEAVY),
- ENTRY (Black, HEAVY),
-#undef ENTRY
-#undef ENTRY2
-#undef ENTRY3
- };
-
- static const struct {
- const char *marker;
- int marker_len;
- PangoStretch stretch;
- } stretch_names[] = {
-#define ENTRY(n, s) { #n, sizeof (#n) - 1, PANGO_STRETCH_##s }
- ENTRY (Ext Condensed, EXTRA_CONDENSED),
- ENTRY (Extra Condensed, EXTRA_CONDENSED),
- ENTRY (UltraCondensed, ULTRA_CONDENSED),
- ENTRY (ExtraCondensed, EXTRA_CONDENSED),
- ENTRY (Condensed, CONDENSED),
- ENTRY (Cond, CONDENSED),
- ENTRY (Narrow, CONDENSED),
- ENTRY (Ext Expanded, EXTRA_EXPANDED),
- ENTRY (Extra Expanded, EXTRA_EXPANDED),
- ENTRY (Ultra Expanded, ULTRA_EXPANDED),
- ENTRY (ExtraExpanded, EXTRA_EXPANDED),
- ENTRY (UltraExpanded, ULTRA_EXPANDED),
- ENTRY (Expanded, EXPANDED),
-#undef ENTRY
- };
-
- int i;
- char *p;
-
family = get_family_nameW (lfp);
if ((lfp->lfPitchAndFamily & 0xF0) == FF_ROMAN && lfp->lfItalic)
@@ -1158,51 +1104,9 @@ pango_win32_font_description_from_logfontw (const LOGFONTW *lfp)
else
weight = PANGO_WEIGHT_HEAVY;
- name_weight = 0;
-
- p = family;
- while ((p = strchr (p, ' ')) != NULL)
- {
- for (i = 0; i < G_N_ELEMENTS (weight_names); i++)
- {
- if (g_ascii_strncasecmp (p + 1, weight_names[i].marker, weight_names[i].marker_len) == 0 &&
- (p[1 + weight_names[i].marker_len] == '\0' ||
- p[1 + weight_names[i].marker_len] == ' '))
- {
- strcpy (p, p + 1 + weight_names[i].remove_len);
- name_weight = weight_names[i].weight;
- break;
- }
- }
- if (i < G_N_ELEMENTS (weight_names))
- break;
- p++;
- }
-
- if (weight == PANGO_WEIGHT_NORMAL && name_weight > 0)
- weight = name_weight;
-
+ /* XXX No idea how to figure out the stretch */
stretch = PANGO_STRETCH_NORMAL;
- p = family;
- while ((p = strchr (p, ' ')) != NULL)
- {
- for (i = 0; i < G_N_ELEMENTS (stretch_names); i++)
- {
- if (g_ascii_strncasecmp (p + 1, stretch_names[i].marker, stretch_names[i].marker_len) == 0 &&
- (p[1 + stretch_names[i].marker_len] == '\0' ||
- p[1 + stretch_names[i].marker_len] == ' '))
- {
- strcpy (p, p + 1 + stretch_names[i].marker_len);
- stretch = stretch_names[i].stretch;
- break;
- }
- }
- if (i < G_N_ELEMENTS (stretch_names))
- break;
- p++;
- }
-
description = pango_font_description_new ();
pango_font_description_set_family (description, family);
g_free(family);