[metapost] accessing letters in picture (for...within loop)

Stephan Hennig mailing_list at arcor.de
Tue Nov 21 15:02:51 CET 2006

Taco Hoekwater schrieb:
> Stephan Hennig wrote:
>> I might be missing the point (in fact, I've not seen Hans' answer yet).
> (That was offlist)

Ah, thought you were talking about a behind-the-scenes-of-MetaPost
instead of a behind-the-scenes-of-this-list question. :)

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

Since I think that wouldn't take kerning information into account I
think a better way is to re-typeset every multi letter string, measure
its length and successively remove characters from the string.  However,
all these approaches bloat compilation time quite a lot (even with the
latexmp package).

>> PS:  Taco, would it take much to change MetaPost's behaviour in this
>> respect?
> 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).

A work around on the TeX side could be to add known horizontal space
between any two characters to split strings in the intermediate DVI
stage.  On the MetaPost side one had to correct for that space.  Since I
do not know how to add horizontal space while preserving true kerning
space I'll move to some other list with that question.

> I cannot change this, because it would break existing figures.

Could an option solve such issues, e.g., charwise:=1 ?

Best regards,
Stephan Hennig

More information about the metapost mailing list