Re: [LAD] Setting fonts in pixels rather than points

From: Paul Davis <paul@email-addr-hidden>
Date: Sun Dec 27 2009 - 00:49:51 EET

On Sat, Dec 26, 2009 at 4:38 PM, Jens M Andreasen
<jens.andreasen@email-addr-hidden> wrote:
> It is like this: If the fontsize for the (mostly decorative) labels is
> too big, the application window will become absolutely huge and for no
> apparent reason won't fit on the desktop. This destroys the users
> experience... Playing it safe and just setting the labels to a small
> size won't work always either. I can't read the labels in Ardour when
> run from Gnome without zooming in or changing my normal settings. It
> works the way I believe it was intended with WindowMaker though.

have you used the font scaler in ardour? its true that it change
(almost) all text, rather than parts of it.

> Anyways, here is what I do for 'Sans' with a max height of 13 that is to
> be used for labeling some 16x16 px checkboxes:

jens - there's a faster way to do this. rather than using widgets,
create Pango layouts and then use pango_layout_get_ink_extents(). in
c++:

void
Gtkmm2ext::get_ink_pixel_size (Glib::RefPtr<Pango::Layout> layout,
                               int& width,
                               int& height)
{
        Pango::Rectangle ink_rect = layout->get_ink_extents ();
        
        width = (ink_rect.get_width() + PANGO_SCALE / 2) / PANGO_SCALE;
        height = (ink_rect.get_height() + PANGO_SCALE / 2) / PANGO_SCALE;
}
_______________________________________________
Linux-audio-dev mailing list
Linux-audio-dev@email-addr-hidden
http://lists.linuxaudio.org/listinfo/linux-audio-dev
Received on Sun Dec 27 04:15:01 2009

This archive was generated by hypermail 2.1.8 : Sun Dec 27 2009 - 04:15:02 EET