[LAD] Setting fonts in pixels rather than points
Paul Davis
paul at linuxaudiosystems.com
Sat Dec 26 22:49:51 UTC 2009
On Sat, Dec 26, 2009 at 4:38 PM, Jens M Andreasen
<jens.andreasen at comhem.se> 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;
}
More information about the Linux-audio-dev
mailing list