sawfish r4212 - trunk/src



Author: jkozicki
Date: Sat Jan 19 12:14:35 2008
New Revision: 4212
URL: http://svn.gnome.org/viewvc/sawfish?rev=4212&view=rev

Log:
Pango draw() ignores font by Yuuki Harano


~/.sawfishrc:

(setq test-font1 (get-font-typed "pango" "Arial Italic 8"))
(setq test-font2 (get-font-typed "pango" "Arial Italic 20"))

(define (test-update w type)
 `(((background . "white")
		 (foreground . "black")
		 (text . ,window-name)
		 (left-edge . 0)
		 (right-edge . 0)
		 (top-edge . -20)
		 (height . 20)
		 (font . ,(if (equal (window-class w) "XTerm") test-font2 test-font1))
   ))
 )

(add-frame-style 'test test-update)



~/.sawfish/custom is empty.

Then, text in title bar of xterm should be large font, and other title bar should be small font. But all is large.

pango_context is created and set font with fontdesc in pango_load(), and used in pango_draw() without font changes. So, only one font is used.

You should set font before using pango_context in pango_draw().






Modified:
   trunk/src/fonts.c

Modified: trunk/src/fonts.c
==============================================================================
--- trunk/src/fonts.c	(original)
+++ trunk/src/fonts.c	Sat Jan 19 12:14:35 2008
@@ -485,6 +485,12 @@
     PangoLayout *layout;
     PangoRectangle rect;
 
+    {
+	PangoFontDescription *desc = pango_font_describe(f->font);
+	pango_context_set_font_description(pango_context, desc);
+	pango_font_description_free(desc);
+    }
+
     layout = pango_layout_new (pango_context);
     pango_layout_set_text (layout, string, length);
 
@@ -540,6 +546,12 @@
     xft_color.color.blue = fg->blue;
     xft_color.color.alpha = fg->alpha;
 
+    {
+	PangoFontDescription *desc = pango_font_describe(f->font);
+	pango_context_set_font_description(pango_context, desc);
+	pango_font_description_free(desc);
+    }
+
     layout = pango_layout_new (pango_context);
     pango_layout_set_text (layout, string, length);
     iter = pango_layout_get_iter (layout);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]