Re: Absolute font sizes



On Wed, 2006-11-01 at 07:59 -0500, Owen Taylor wrote:
> On Tue, 2006-10-31 at 19:30 -0500, Behdad Esfahbod wrote:
> > On Tue, 2006-10-31 at 16:59 -0500, Owen Taylor wrote:
> > > On Tue, 2006-10-31 at 15:46 -0500, Behdad Esfahbod wrote:
> > > > On Tue, 2006-10-31 at 12:02 +0100, Kristian Rietveld wrote:
> > > > > Hey Behdad,
> > > > 
> > > > Hey Kris,
> > > > 
> > > > > We noticed this week that nothing in GTK+ currently checks whether the 
> > > > > font size returned by pango_font_description_get_size() is absolute or not.
> > > > 
> > > > This is a very unfortunate side effect of the fact that absolute size
> > > > was added in a much later version than normal sizes.  And indeed a
> > > > horrible API design choice to add
> > > > pango_font_description_get_size_is_absolute() instead of
> > > > pango_font_description_get_absolute_size().
> > > 
> > > And .. how would you implement the latter? :-)
> > 
> > Make size and absolute_size two separate fields.  Setting one will unset
> > the other.
> 
> How would that be better then the current setup? 

Not sure which one would have been better if absolute sizes did exist
from the beginning, but adding them in Pango 1.8 broke the API IMO, in
that pango_font_description_get_size() started returning values that had
a meaning different from what the same value returned had previously.
Namely, size in pixels instead of size in points.  If a separate
property was used, applications could get bug reports about "font size
not working when specified as absolute".  Now what they get is the font
size working, but off by a factor of dpi/72, that is not far from 1 most
of the time; making the bug very hard to pin down.

Another advantage of the separate API is that you can do things like
static analysis to make sure units are converted correctly.  With
get_size() returning pixels or points, that's not possible.

> 						- Owen

-- 
behdad
http://behdad.org/

"Commandment Three says Do Not Kill, Amendment Two says Blood Will Spill"
        -- Dan Bern, "New American Language"




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