]> Dogcows Code - chaz/openbox/commitdiff
remove the font code for parsing Xft font strings. we are using the individual values...
authorDana Jansens <danakj@orodu.net>
Sun, 4 Mar 2007 07:14:25 +0000 (07:14 +0000)
committerDana Jansens <danakj@orodu.net>
Sun, 4 Mar 2007 07:14:25 +0000 (07:14 +0000)
render/font.c
render/render.h

index ace605e5b705f4d198f8f325bab57c1524497e37..0bb8262001634c0371fff8196099592f2daef4f5 100644 (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)
index 0b8d3b4ca2d72523bc9c702620478fd50c48f22b..713e2f124f543817d46740055a107a125ff6133c 100644 (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,
This page took 0.028086 seconds and 4 git commands to generate.