On Tuesday 21 July 2009, Daniel Silverstone wrote:
> On Mon, 2009-07-20 at 16:18 +0100, John-Mark Bell wrote:
> >                                     if (!plot.text(x, y + (int)
> >                                             (height * 0.75 * scale),
>
> This *0.75 malarky... If this is for RISC OS's
> baseline-rather-than-top-left behaviour for font plotting, then why not
> do it in the RISC OS frontend instead of here to be undone in all the
> other frontends? Or am I simply mistaken?
>
> Since you're refactoring the font plotting API a bit, now is the time to
> fix this particular nit.

Yes, that's what it's for. Unfortunately I think there is a complication. Also 
I can't find anywhere in the GTK code that undoes this so I think Pango also 
plots at baseline.

The complication is handling lines of text where the font size or font 
changes, for example <p>abc <big>def</big> ghi <small>jkl</small></p>. I think 
the easiest way to handle this is:

1. Make all the text boxes in a line as high as the highest one (i.e. the one 
   with the biggest font size * line height)
2. When plotting compute baseline as bottom + a fixed ratio of height (.25)  
   and ask plotter to plot at baseline

Otherwise the core would have to ask the platform for the distance between top 
and baseline for each text box in order to position each at the correct y to 
make the baselines match.

NetSurf wasn't even doing (1). I just committed this in r8716, and baselines 
are now aligned for that example in RISC OS and GTK. One problem is that if 
you then resize the window, the text box heights won't shrink back down when 
they could. Probably has other layout regressions I didn't find.

James

-- 
James Bursa, NetSurf developer                http://www.netsurf-browser.org/


Reply via email to