[metapost] accessing letters in picture (for...within loop)
Taco Hoekwater
taco at elvenkind.com
Tue Nov 21 13:36:53 CET 2006
Stephan Hennig wrote:
>
> I might be missing the point (in fact, I've not seen Hans' answer yet).
(That was offlist)
> I need to access properties of single letters such as their coordinates
> in the picture, but see no way to get them using the substring operator.
Ah.
I guess you can put the each of the characters (one at a time) as
labels into an otherwise empty picture (using the proper font,
of course) and checking the boundingbox to get the right size.
> PS: Taco, would it take much to change MetaPost's behaviour in this
> respect? I mean, could for...each process single characters by default?
> Or what is the rationale for returning those arbitrary bunches of
> letters? Since the current behaviour seems not to be documented or
> explained I don't think iterating over single letters would introduce an
> incompatible change. What do you think?
TeX is using kerning between certain letter pairs, and that is to
blame for the apparent randomness of the chunks (it generates small
horizontal shifts in the DVI file that have to be converted to
metapost). Otherwise, you would receive back full strings.
I cannot change this, because it would break existing figures.
Greetings, Taco
More information about the metapost
mailing list