Re: problem with portability of text extents



On 02/14/2011 01:09 PM, Bogdan Butnaru wrote:
> On Mon, Feb 14, 2011 at 15:56, John Ellson
> <ellson research att com> wrote:
>> I haven't checked, but yes, I too can imagine that there could be
>> extra high glyphs in a given font file, but the API only asks for
>> the logical_rect of the font *family*. Perhaps that should that
>> be the highest ascent of a standard set of characters - something
>> like the "The quick brown fox.." string that pango uses now (but
>> maybe with more than just 'T' in upper-case). Perhaps the chosen
>> string should include the integral character, or perhaps not, but
>> my point is that it should be consistent across platforms.
>
> I’d expect it to be consistent across systems for the *exact same
> font*, not for two fonts with the same name (and even similar
> “look”); I’m not saying it’s actually is, but without making sure
> the font is identical we can’t tell.
>
> Try the following:
>
> 1) Find a font (download a freeware one) that you are sure doesn’t
> exist on either of the two computers. Even if you don’t know where
> Pango gets the fonts from, you can check that one isn’t installed
> by just trying to use it; if it doesn’t work it means Pango didn’t
> find it.
>
> 2) Install the font on both computers. (The normal procedure for
> installing fonts on each platform should work, I guess.)
>
> 3) Try the same code you used above, but with that font.
>
> This way we can be sure that the font is identical, and if there
> is any difference then Pango is to blame.
>
> -- Bogdan Butnaru
>

Bogdan,

Thanks for your suggestion.

I found a font that existed on the Mac, but not on Fedora
(Thonburi).  When I copied it to Fedora the whitespace above the text,
and the height, was the same (within 1%) even though pango was using
the Atsui engine on the Mac, and Fontconfig/Freetype on Fedora.

The whitespace above the text was still unreasonably large in both
cases (for normal alphanumerics).

So the bug isn't in variation in the font engine implementations.  The
bug is  in the definition of logical_rect.y.  Pango doesn't let me
specify a font-file, it only lets me specify a font-family, and I
still question if the font designer's arbitrary y=0 reference is
suitable for layout purposes.

While playing with this, I found a font in which the ink_rect exceeds
the boundaries of the logical_rect in the x direction.
    http://www.1001freefonts.com/font/BaroqueScript.zip
If this is allowed, then it should also be allowed to define the
logical_rect.y to be the maximum ascent of some selection of "normal"
characters, while allowing other characters, such as math integrals,
to exceed it.

John



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