[Sugar-devel] SoaS font scaling issue

Art Hunkins abhunkin at uncg.edu
Tue Dec 22 21:21:54 EST 2009


Here is the issue:

All text passes through the code below, which uses pango only - no reference 
to default font-size. It nicely sizes text to fit appropriately on all 
(landscape) screens.

    def scale_font(self, widget):
      if not os.path.exists("/sys/power/olpc-pm"):
        font = widget.get_pango_context().get_font_description()
        width = gtk.gdk.screen_width()
        size = (width * .00067)
        if (os.path.exists("/etc/fedora-release")):
          if not open("/etc/fedora-release").read().find("Strawberry") 
== -1:
            size = (width * .00105)
        font.set_size(int(font.get_size() * pango.SCALE_LARGE * size))
        widget.modify_font(font)

To test whether with changed default font-size, my text will comparably 
resize, I insert the following line near the beginning of my activity:

gtk.rc_parse_string(''' style "default" { font_name = "Sans 30" } ''')

This makes the menu-bar text nice and big, but leaves my activity text 
unchanged. I want the activity text to change as well. (I'm also currently 
looking to vary the default font-size by working with GConf - so far 
unsuccessfully.)

An .xo bundle of the activity with these features is available at 
http://www.arthunkins.com/OurMusic-2.xo. The added rc_parse line is near the 
beginning of ourmusic.py - commented out. Try with and without (activity 
text remains the same).

The scale_font routine is toward the beginning of csndsugui.py.

Thanks so much for your suggestions.

Art Hunkins

----- Original Message ----- 
From: "Daniel Drake" <dsd at laptop.org>
To: "Art Hunkins" <abhunkin at uncg.edu>
Sent: Tuesday, December 22, 2009 5:57 PM
Subject: Re: SoaS font scaling


> On Sun, 2009-12-20 at 22:15 -0500, Art Hunkins wrote:
>> To simulate such changes, I added the following line toward the beginning 
>> of
>> my activities:
>> gtk.rc_parse_string (''' style "default" { font_name = "Sans 30" } ''')
>>
>> This nicely enlarges the font of text in the menu bar at screen top, but 
>> it
>> leaves unchanged the font size within my activity! I had expected that
>> changes such as made by the string above would be reflected in Pango
>> automatically, and hence rescale everything.
>
> I don't know what's happening, sorry. You should ask on the mailing
> lists, including a link to your code.
>
> Daniel
>
> 



More information about the Sugar-devel mailing list