[luatex] Get area of a glyph?

Paul Isambert zappathustra at free.fr
Sun Sep 16 17:29:25 CEST 2012


Arno Trautmann <Arno.Trautmann at gmx.de> a écrit:
> 
> Hi all,
> 
> again a rather unusual question: I'd like to get the black area of a 
> glyph. Why? To estimate it's greyness: For a “–” e.g. I want to get 
> something like “5%” (of the whole box surface), while a “m” would give 
> some “30%”, and a black box of course would result in 100%. Of course I 
> would also be happy with any absolute value like “0.1 square inches” or 
> whatever. So: Is there any chance to read such a value from inside 
> LuaTex? Or is this information not available?

LuaTeX doesn't even read the curves used to draw a glyph, so no way you
can get that information, as far as I can tell; you'll have to read
directly from the font file (under the assumption that knowing the shape
of the glyph gives you its area, which I don't know, not being a
mathematician; perhaps by hit or miss?).

Perhaps approximations exist, but I've never heard of them.

Best,
Paul



More information about the luatex mailing list