remove the font code for parsing Xft font strings. we are using the individual values specified in the user's configuration now, no longer using the strings from the theme file at all

This commit is contained in:
Dana Jansens 2007-03-04 07:14:25 +00:00
parent 43d0f79057
commit d0f9d647aa
2 changed files with 0 additions and 107 deletions

View file

@ -75,112 +75,6 @@ static void measure_font(const RrInstance *inst, RrFont *f)
g_free(locale);
}
static RrFont *openfontstring(const RrInstance *inst, gchar *fontstring)
{
RrFont *out;
FcPattern *pat;
gint tint;
gchar *sval;
gint ival;
if (!(pat = XftNameParse(fontstring)))
return NULL;
out = g_new(RrFont, 1);
out->inst = inst;
out->ref = 1;
out->font_desc = pango_font_description_new();
out->layout = pango_layout_new(inst->pango);
/* get the data from the parsed xft string */
/* get the family */
if (FcPatternGetString(pat, "family", 0,
(FcChar8**)&sval) == FcResultMatch)
pango_font_description_set_family(out->font_desc, sval);
/* get the weight */
if (FcPatternGetInteger(pat, "weight", 0, &ival) == FcResultMatch) {
if (ival == FC_WEIGHT_LIGHT)
pango_font_description_set_weight(out->font_desc,
PANGO_WEIGHT_LIGHT);
else if (ival == FC_WEIGHT_DEMIBOLD)
pango_font_description_set_weight(out->font_desc,
PANGO_WEIGHT_SEMIBOLD);
else if (ival == FC_WEIGHT_BOLD)
pango_font_description_set_weight(out->font_desc,
PANGO_WEIGHT_BOLD);
else if (ival == FC_WEIGHT_BLACK)
pango_font_description_set_weight(out->font_desc,
PANGO_WEIGHT_ULTRABOLD);
}
/* get the style/slant */
if (FcPatternGetInteger(pat, "slant", 0, &ival) == FcResultMatch) {
if (ival == FC_SLANT_ITALIC)
pango_font_description_set_style(out->font_desc,
PANGO_STYLE_ITALIC);
else if (ival == FC_SLANT_OBLIQUE)
pango_font_description_set_style(out->font_desc,
PANGO_STYLE_OBLIQUE);
}
/* get the size */
if (FcPatternGetInteger(pat, "size", 0, &ival) == FcResultMatch)
pango_font_description_set_size(out->font_desc, ival * PANGO_SCALE);
else if (FcPatternGetInteger(pat, "pixelsize", 0, &ival) == FcResultMatch)
pango_font_description_set_absolute_size(out->font_desc,
ival * PANGO_SCALE);
else
pango_font_description_set_size(out->font_desc, 8 * PANGO_SCALE);
if (FcPatternGetBool(pat, OB_SHADOW, 0, &out->shadow) != FcResultMatch)
out->shadow = FALSE;
if (FcPatternGetInteger(pat, OB_SHADOW_OFFSET, 0, &out->offset) !=
FcResultMatch)
out->offset = 1;
if (FcPatternGetInteger(pat, OB_SHADOW_ALPHA, 0, &tint) != FcResultMatch)
tint = 25;
if (tint > 100) tint = 100;
else if (tint < -100) tint = -100;
out->tint = tint;
/* setup the layout */
pango_layout_set_font_description(out->layout, out->font_desc);
pango_layout_set_single_paragraph_mode(out->layout, TRUE);
pango_layout_set_ellipsize(out->layout, PANGO_ELLIPSIZE_MIDDLE);
/* get the ascent and descent */
measure_font(inst, out);
FcPatternDestroy(pat);
return out;
}
RrFont *RrFontOpenByString(const RrInstance *inst, gchar *fontstring)
{
RrFont *out;
if (!started) {
font_startup();
started = TRUE;
}
if ((out = openfontstring(inst, fontstring)))
return out;
g_warning(_("Unable to load font: %s\n"), fontstring);
g_warning(_("Trying fallback font: %s\n"), "sans");
if ((out = openfontstring(inst, "sans")))
return out;
g_warning(_("Unable to load font: %s\n"), "sans");
return NULL;
}
RrFont *RrFontOpen(const RrInstance *inst, gchar *name, gint size,
RrFontWeight weight, RrFontSlant slant, gboolean shadow,
gint shadowoffset, gchar shadowtint)

View file

@ -227,7 +227,6 @@ RrAppearance *RrAppearanceNew (const RrInstance *inst, gint numtex);
RrAppearance *RrAppearanceCopy (RrAppearance *a);
void RrAppearanceFree (RrAppearance *a);
RrFont *RrFontOpenByString (const RrInstance *inst, gchar *fontstring);
RrFont *RrFontOpen (const RrInstance *inst, gchar *name, gint size,
RrFontWeight weight, RrFontSlant slant,
gboolean shadow, gint shadowoffset,