Hi Ikka,

On Tuesday April 13 2010 11:19:05 Ilkka Oksanen wrote:
> Is the way to increase or decrease font size of a label at runtime? I know
> I can do this:
> 
> label.setFont(new qx.bom.Font(12));
> 
> But then the font face doesn't look same anymore. I guess that is because
> default font face (and size) depends on the version of OS. 
Right. The font face is depending on the platform you're on. This is set at 
the Font theme which is provided by the framework. As long as you do not 
change this behaviour by using your own font theme these settings will be 
applied.

> In an ideal case I would like to just increase font size relatively, e.g 
> current size +- 2 pixels.
> 
> label.getFont().setHeight( label.getFont().getHeight() + 2 );
> 
> Is something like that possible? My example doesn't work.  I'm using
> Qooxdoo 1.0.1 and Modern theme.
The best way would be to implement an own Font theme. Take a look at your 
application class structure. There should be a folder "theme" by default and 
also a provided (empty) Font theme.
There you can implement your own fonts and then you can use them throughout 
your application by using the name you chosen.

--snip--
// part of the framework font theme
qx.Theme.define("qx.theme.modern.Font",
{
  fonts :
  {
    "default" :
    {
      size : (qx.bom.client.System.WINVISTA || qx.bom.client.System.WIN7) ? 12 
: 11,
      lineHeight : 1.4,
      family : qx.bom.client.Platform.MAC ? [ "Lucida Grande" ] :
        (qx.bom.client.System.WINVISTA || qx.bom.client.System.WIN7) ?
        [ "Segoe UI", "Candara" ] :
        [ "Tahoma", "Liberation Sans", "Arial", "sans-serif" ]
    }
  }
}


// in your application
yourLabel.setFont("default");
--snip--

Take a look at the documentation at 

        http://qooxdoo.org/documentation/1.0/ui_theming#font_theme

to get to know more about font themes and theming in general.

cheers,
  Alex

------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to