summaryrefslogtreecommitdiff
path: root/pango
diff options
context:
space:
mode:
authorBehdad Esfahbod <behdad@src.gnome.org>2006-01-29 03:54:13 +0000
committerBehdad Esfahbod <behdad@src.gnome.org>2006-01-29 03:54:13 +0000
commit3ca03a79715e0002d99f0e7bd320a7b6b644ff21 (patch)
tree41e731be5f92b4615e523922c498375c5163fcc6 /pango
parent73c5761f71af12a6d670a57dd17903c05860d077 (diff)
downloadpango-3ca03a79715e0002d99f0e7bd320a7b6b644ff21.tar.gz
Revert last patch again :(.
Diffstat (limited to 'pango')
-rw-r--r--pango/pangofc-fontmap.c105
1 files changed, 19 insertions, 86 deletions
diff --git a/pango/pangofc-fontmap.c b/pango/pangofc-fontmap.c
index bbe6b831..90c36955 100644
--- a/pango/pangofc-fontmap.c
+++ b/pango/pangofc-fontmap.c
@@ -85,8 +85,6 @@ struct _PangoFcFace
PangoFcFamily *family;
char *style;
-
- guint fake : 1;
};
struct _PangoFcFamily
@@ -1626,9 +1624,7 @@ make_alias_description (PangoFcFamily *fcfamily,
pango_font_description_set_family (desc, fcfamily->family_name);
pango_font_description_set_style (desc, italic ? PANGO_STYLE_ITALIC : PANGO_STYLE_NORMAL);
- pango_font_description_set_variant (desc, PANGO_VARIANT_NORMAL);
pango_font_description_set_weight (desc, bold ? PANGO_WEIGHT_BOLD : PANGO_WEIGHT_NORMAL);
- pango_font_description_set_stretch (desc, PANGO_STRETCH_NORMAL);
return desc;
}
@@ -1643,7 +1639,7 @@ pango_fc_face_describe (PangoFontFace *face)
FcPattern *match_pattern;
FcPattern *result_pattern;
- if (fcface->fake)
+ if (is_alias_family (fcfamily->family_name))
{
if (strcmp (fcface->style, "Regular") == 0)
return make_alias_description (fcfamily, FALSE, FALSE);
@@ -1824,13 +1820,11 @@ pango_fc_face_get_type (void)
*/
static PangoFcFace *
create_face (PangoFcFamily *fcfamily,
- const char *style,
- gboolean fake)
+ const char *style)
{
PangoFcFace *face = g_object_new (PANGO_FC_TYPE_FACE, NULL);
face->style = g_strdup (style);
face->family = fcfamily;
- face->fake = fake;
return face;
}
@@ -1855,98 +1849,37 @@ pango_fc_family_list_faces (PangoFontFamily *family,
fcfamily->faces = g_new (PangoFcFace *, fcfamily->n_faces);
i = 0;
- fcfamily->faces[i++] = create_face (fcfamily, "Regular", TRUE);
- fcfamily->faces[i++] = create_face (fcfamily, "Bold", TRUE);
- fcfamily->faces[i++] = create_face (fcfamily, "Italic", TRUE);
- fcfamily->faces[i++] = create_face (fcfamily, "Bold Italic", TRUE);
+ fcfamily->faces[i++] = create_face (fcfamily, "Regular");
+ fcfamily->faces[i++] = create_face (fcfamily, "Bold");
+ fcfamily->faces[i++] = create_face (fcfamily, "Italic");
+ fcfamily->faces[i++] = create_face (fcfamily, "Bold Italic");
}
else
{
- FcObjectSet *os = FcObjectSetBuild (FC_STYLE, FC_WEIGHT, FC_SLANT, NULL);
+ FcObjectSet *os = FcObjectSetBuild (FC_STYLE, NULL);
FcPattern *pat = FcPatternBuild (NULL,
FC_FAMILY, FcTypeString, fcfamily->family_name,
NULL);
-
- enum {
- REGULAR,
- ITALIC,
- BOLD,
- BOLD_ITALIC
- };
- /* Regular, Italic, Bold, Bold Italic */
- gboolean has_face [4] = { FALSE, FALSE, FALSE, FALSE };
- PangoFcFace **faces;
- gint num = 0;
-
+
fontset = FcFontList (NULL, pat, os);
-
+
FcPatternDestroy (pat);
FcObjectSetDestroy (os);
-
- /* at most we have 3 additional artifical faces */
- faces = g_new (PangoFcFace *, fontset->nfont + 3);
-
+
+ fcfamily->n_faces = fontset->nfont;
+ fcfamily->faces = g_new (PangoFcFace *, fcfamily->n_faces);
+
for (i = 0; i < fontset->nfont; i++)
{
- FcChar8 *style, *font_style = NULL;
- int weight, slant;
-
- if (FcPatternGetInteger(fontset->fonts[i], FC_WEIGHT, 0, &weight) != FcResultMatch)
- weight = FC_WEIGHT_MEDIUM;
-
- if (FcPatternGetInteger(fontset->fonts[i], FC_SLANT, 0, &slant) != FcResultMatch)
- slant = FC_SLANT_ROMAN;
-
- if (FcPatternGetString (fontset->fonts[i], FC_STYLE, 0, &font_style) != FcResultMatch)
- font_style = NULL;
-
- if (weight <= FC_WEIGHT_MEDIUM)
- {
- if (slant == FC_SLANT_ROMAN)
- {
- has_face[REGULAR] = TRUE;
- style = "Regular";
- }
- else
- {
- has_face[ITALIC] = TRUE;
- style = "Italic";
- }
- }
- else
- {
- if (slant == FC_SLANT_ROMAN)
- {
- has_face[BOLD] = TRUE;
- style = "Bold";
- }
- else
- {
- has_face[BOLD_ITALIC] = TRUE;
- style = "Bold Italic";
- }
- }
-
- if (!font_style)
- font_style = style;
- faces[num++] = create_face (fcfamily, font_style, FALSE);
- }
+ FcChar8 *s;
+ FcResult res;
- if (has_face[REGULAR])
- {
- if (!has_face[ITALIC])
- faces[num++] = create_face (fcfamily, "Italic", TRUE);
- if (!has_face[BOLD])
- faces[num++] = create_face (fcfamily, "Bold", TRUE);
+ res = FcPatternGetString (fontset->fonts[i], FC_STYLE, 0, &s);
+ if (res != FcResultMatch)
+ s = "Regular";
+ fcfamily->faces[i] = create_face (fcfamily, s);
}
- if ((has_face[REGULAR] || has_face[ITALIC] || has_face[BOLD]) && !has_face[BOLD_ITALIC])
- faces[num++] = create_face (fcfamily, "Bold Italic", TRUE);
-
- faces = g_renew (PangoFcFace *, faces, num);
-
- fcfamily->n_faces = num;
- fcfamily->faces = faces;
FcFontSetDestroy (fontset);
}