[Sugar-devel] Sugar font size

James Simmons jim.simmons at walgreens.com
Thu Apr 23 10:53:18 EDT 2009


Christoph,

I ran into similar issues with fonts in Read Etexts.  This is the code I use to increase or decrease font sizes:

    def font_decrease(self):
        font_size = self.font_desc.get_size() / 1024
        font_size = font_size - 1
        if font_size < 1:
            font_size = 1
        self.font_desc.set_size(font_size * 1024)
        self.textview.modify_font(self.font_desc)

    def font_increase(self):
        font_size = self.font_desc.get_size() / 1024
        font_size = font_size + 1
        self.font_desc.set_size(font_size * 1024)
        self.textview.modify_font(self.font_desc)

Apparently pygtk's idea of font size is based on something other than point size.  I don't remember all the details but I'm pretty sure this is from the PyGTK tutorial, and it does work.

James Simmons


Message: 3
Date: Wed, 22 Apr 2009 20:22:37 +0200
From: Christoph Derndorfer <christoph.derndorfer at gmail.com>
Subject: [Sugar-devel] FWD: Sugar font size & wiki
To: Sugar Devel <sugar-devel at lists.sugarlabs.org>
Cc: Christoph Derndorfer <e0425826 at student.tuwien.ac.at>,	Stefan Heher
	<heher at sbox.tugraz.at>, Walther Neuper <neuper at ist.tugraz.at>,	Patrick
	Loder <patlod at sbox.tugraz.at>
Message-ID: <49EF606D.8040003 at gmail.com>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

Dear all,

a small team of students and a professor at the Technical University 
Graz (in CC) is currently working on an activity to exercise Maths based 
on the requests by the teachers of our small Austrian OLPC / Sugar pilot.

Anyway, they're currently running into some issues wrt to setting the 
font-size in their activity, please see the message below for details.

Any help or pointers to possible solutions would be greatly appreciated!

Thanks in advance,
Christoph

Walther Neuper schrieb:

--- snip ---

> > Two issues become urgent now:
> > 
> > # Sugar does _not_ accept our way of specifying the font size:
> > 
> >        self.toggle_equal = gtk.ToggleButton("<==>")
> >        self.toggle_equal.modify_font(pango.FontDescription("sans 72"))
> >        self.toggle_equal.connect("toggled", self.toggle_equal_callback)
> >        self.settings_table.attach(self.toggle_equal, 3, 4, 11, 12 )
> >        self.toggle_equal.show()
> > 
> >   With this code the font size is taken as a (too small) default, and we 
> > would like to
> >   deliver ReckonPrimer1.0 as soon as possible
>   
--- snip ---

-- Christoph Derndorfer co-editor, olpcnews url: www.olpcnews.com 
e-mail: christoph at olpcnews.com

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.sugarlabs.org/archive/sugar-devel/attachments/20090423/0f75b2db/attachment.htm 


More information about the Sugar-devel mailing list