guile-gtk-general
[Top][All Lists]
Advanced

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

trouble setting the font of a gtklabel, test case attached


From: Juri Pakaste
Subject: trouble setting the font of a gtklabel, test case attached
Date: Sat, 09 Apr 2005 19:16:35 +0300

I'm trying to set the font of a GtkLabel after reading the user's
selection from a font selector. I'm using a pango attribute list for
this. I'm seeing some extremely weird behaviour: if I print out the
PangoFontDescription object before creating the PangoAttrFontDesc, this
works. If I don't do the print, it does not work. This is completely
reproducible.

Here's test code:

(use-modules (gnome-0)
             (gnome gtk)
             (gnome pango)
             (oop goops))

(let ((w (make <gtk-window> #:type 'toplevel))
      (l (make <gtk-label>)))
  (set-text l "foo")
  (add w l)

  (let ((f-desc (pango-font-description-from-string "Verdana 20")))
;    (format #t "f-desc: ~a~%" f-desc)
    (let ((f-attr (pango-attr-font-desc-new f-desc))
          (attr-list (pango-attr-list-new)))
      (pango-attr-list-insert attr-list f-attr)
      (set-attributes l attr-list)))

  (show-all w)
  (gtk-main))

The above code uses the default font. If I uncomment the format line, it
uses Verdana 20, as it was supposed to.

It's quite possible my code is broken as this is the first time, I
think, I've used any Pango APIs from any language. But still, this is
quite unexpected behaviour.

I'm running guile 1.6.7 (From Ubuntu, 1.6.7-1ubuntu1) with g-wrap 1.9.5
and guile-gnome 2.7.99 compiled from original sources.

-- 
[ Juri Pakaste | address@hidden | http://www.iki.fi/juri/ ]

Attachment: signature.asc
Description: This is a digitally signed message part


reply via email to

[Prev in Thread] Current Thread [Next in Thread]