summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDana Jansens <danakj@orodu.net>2007-03-04 07:14:25 +0000
committerDana Jansens <danakj@orodu.net>2007-03-04 07:14:25 +0000
commitd0f9d647aaed5c9f2d3cc3a16cc2d4b717622bc0 (patch)
treec77d8abca043b0b58b650937b4640fcc00d749ed
parent43d0f79057c1c4dfa1999db8fd6d9f48e5b47951 (diff)
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
-rw-r--r--render/font.c106
-rw-r--r--render/render.h1
2 files changed, 0 insertions, 107 deletions
diff --git a/render/font.c b/render/font.c
index ace605e5..0bb82620 100644
--- a/render/font.c
+++ b/render/font.c
@@ -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)
diff --git a/render/render.h b/render/render.h
index 0b8d3b4c..713e2f12 100644
--- a/render/render.h
+++ b/render/render.h
@@ -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,