Re: problem with portability of text extents



On Mon, Feb 14, 2011 at 20:41, John Ellson <ellson research att com> wrote:
> Thanks for your suggestion.
You’re welcome!

> 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.

I think I understand your needs, but it’s hard to define “normal” in
general. (Consider that Pango needs to deal not only with Latin
“alphanumerics”, but all kinds of scripts.)

Can’t you just work-around this by simply telling Pango to draw
whatever you consider “normal” (for example, a string containing the
characters A–Z, a–z and 0–9, perhaps with a couple of accented
capitals if you expect to need it) in a hidden buffer, with the font
you need the measurements of, and then take the ink_rect and use that?
If I understand correctly, you need a per-font measure to use for
general layout, not measurement of a particular string, right?

(This method would allow any user to define what they consider
“normal”; someone developing for Arabic will probably use a string
with Arabic letters, and a Chinese user might use a few “standard”
ideographs, etc. I’d guess that’s why the method isn’t provided by
Pango itself.)

— Bogdan Butnaru


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