Merge branches 'wip/edges', 'mikabox/crap', 'mikabox/lock', 'mikabox/maybe' and ...
[mikachu/openbox.git] / obrender / font.c
index a22e23f..6f9b38f 100644 (file)
@@ -60,6 +60,15 @@ static void measure_font(const RrInstance *inst, RrFont *f)
 
 }
 
+void RrFontDescriptionFromString(RrFont *font, gchar *description)
+{
+    PangoFontDescription *desc;
+    desc = pango_font_description_from_string(description);
+    pango_font_description_merge(font->font_desc, desc, TRUE);
+    pango_font_description_free(desc);
+    pango_layout_set_font_description(font->layout, font->font_desc);
+}
+
 RrFont *RrFontOpen(const RrInstance *inst, const gchar *name, gint size,
                    RrFontWeight weight, RrFontSlant slant)
 {
@@ -169,8 +178,8 @@ static void font_measure_full(const RrFont *f, const gchar *str,
     rect.width = (rect.width + PANGO_SCALE - 1) / PANGO_SCALE;
     rect.height = (rect.height + PANGO_SCALE - 1) / PANGO_SCALE;
 #endif
-    *x = rect.width + ABS(shadow_x) + 4 /* we put a 2 px edge on each side */;
-    *y = rect.height + ABS(shadow_y);
+    *x = rect.width + /* ABS(shadow_x) +*/ 4 /* we put a 2 px edge on each side */;
+    *y = rect.height /*+ ABS(shadow_y) */;
 }
 
 RrSize *RrFontMeasureString(const RrFont *f, const gchar *str,
@@ -189,7 +198,7 @@ RrSize *RrFontMeasureString(const RrFont *f, const gchar *str,
 
 gint RrFontHeight(const RrFont *f, gint shadow_y)
 {
-    return (f->ascent + f->descent) / PANGO_SCALE + ABS(shadow_y);
+    return (f->ascent + f->descent) / PANGO_SCALE + 0-1;//ABS(shadow_y);
 }
 
 static inline int font_calculate_baseline(RrFont *f, gint height)