FWIW, this is the "font-sizing code" I ended up using in my three activities 
(OurMusic, SunMoonMusic and FileMix). It is contained near the beginning of the 
csndsugui.py module.

It contains an option for the user to resize text in the given activity for the 
particular monitor, and sizes for OLPC (XO-1/XO-1.5), SoaS 0.84 and up. Thank 
goodness, from Mirabelle upward, SoaS seems not to be changing font size.

All multiplication factors were determined empirically - by filling a screen 
width with text (the starting point was the OLPC display), then seeing what 
modifications were necessary for the various incarnations of SoaS.

The code works well for all versions of Sugar I've tried, as well as monitors.


    def scale_font(self, widget):
      font = widget.get_pango_context().get_font_description()

# The FONT DISPLAY in this activity can be resized (smaller or larger)
# by changing the value of "resize" below. "Resize" can be positive
# or negative, and is not limited to integers. A value of 1 equals a
# point in font size.
      resize = 0

      font_size = font.get_size() + (resize * 1024)
      width = gtk.gdk.screen_width()
      mult = width * .00076
      if os.path.exists("/etc/olpc-release") or 
os.path.exists("/etc/power/olpc-pm"):
        mult = width * .00082
      elif os.path.exists("/etc/fedora-release"):
        release = open("/etc/fedora-release").read()
        if release.find("SoaS release 1 ") != -1:
          mult = width * .00132
        elif release.find("SoaS release 2 ") != -1:
          mult = width * .00085
        elif release.find("Fedora release ") != -1:
          mult = width * .00119
      font.set_size(int(font_size * mult))
      widget.modify_font(font)


Art Hunkins
  ----- Original Message ----- 
  From: Gonzalo Odiard 
  To: sugar-devel 
  Sent: Saturday, December 04, 2010 11:48 AM
  Subject: Re: [Sugar-devel] UI: Advice about UI changes in Write


  Sascha
  I understand your comments, but I think we need to prioritize the simple use 
of the more useful features.
  A spinbutton is not IMHO a good interface to change the zoom level, but I am 
not sure, that's the reason 
  why I asked to the UI team. Another option is add a button to set the zoom at 
Page width, or Page height, 
  but probably another hacker will complain about too much controls...

  Gonzalo

   


  On Sat, Dec 4, 2010 at 7:18 AM, Sascha Silbe 
<sascha-ml-reply-to-201...@silbe.org> wrote:

    Excerpts from Gonzalo Odiard's message of Fri Dec 03 14:00:58 +0100 2010:


    > You can increment/decrement  the zoom with Ctrl + / - to any level.


    Is that discoverable? What are the increments (step size)? How fast is
    it?

    It usually takes me only very few tries to choose the correct zoom level
    by entering a number (good first guess + something similar to binary
    search). If I can only single-step (in addition to the few fixed zoom
    levels), it'll either be a bad match (too large increment) or take a lot
    of key presses / time (fine increment => many steps).


    Sascha

    --
    http://sascha.silbe.org/
    http://www.infra-silbe.de/


    _______________________________________________
    Sugar-devel mailing list
    Sugar-devel@lists.sugarlabs.org
    http://lists.sugarlabs.org/listinfo/sugar-devel






------------------------------------------------------------------------------


  _______________________________________________
  Sugar-devel mailing list
  Sugar-devel@lists.sugarlabs.org
  http://lists.sugarlabs.org/listinfo/sugar-devel
_______________________________________________
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel

Reply via email to