Re: Units and resolution independence for gtk+



On Wed, 2008-08-06 at 19:42 -0400, David Zeuthen wrote:
> 
> > Also, my only quick feedback is that you are hooking up on the font
> > size, while you should instead hook on screen dpi.  Think of screen dpi
> > as a global scaling factor, and font size is relative size of the fonts
> > to the other elements.
> 
> Actually the way it works right now is that it hooks up to both dpi and
> font size; here's the relevant part
> 
>   /* pango_size is in points; 10 points at 96 DPI is 12 pixels; convert accordingly */
>   pixels_per_em = 1.2 * (dpi_to_use * (((gdouble) pango_size) / PANGO_SCALE) / 96.0);
> 
> and pango_size (e.g. the result of pango_font_description_get_size())
> doesn't change when the DPI changes (and it shouldn't "point size" is an
> abstract concept). Is this incorrect?

This is correct.

I think what I mean is that most of the UI should use units in points,
not in em's.  That is, increasing font size should not necessarily
increase all UI elements.  I can't think of any concrete cases though.

If you just use dpi though, (replace GTK_UNIT_ONE_TWELFTH_EM with
GTK_UNIT_POINT), then the font size can be used more purposefully: to
change text size relative to other UI, where in your current design,
there's not much point in having different font size and dpi.

Makes sense?

>      David
> 
-- 
behdad
http://behdad.org/

"Those who would give up Essential Liberty to purchase a little
 Temporary Safety, deserve neither Liberty nor Safety."
        -- Benjamin Franklin, 1759



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]