[Fontinst] Adjusting kerning information before reglyphing
Lars Hellström
lars.hellstrom at residenset.net
Tue Jul 26 13:03:23 CEST 2005
At 19.26 +0200 2005-07-25, Stephen Hartke wrote:
>Lars,
>
>Thanks for your response.
>
>> \installfont doesn't apply metric files to each other, it just reads them
>> in sequence, pretty much as if there was one file which just \inputmtx'ed
>> them all in sequence.
>Thanks for clarifying this.
>
>> What you should do is to have a second \reglyphfont applied to your kerns
>> file. There is no requirement that there has to be glyph definitions in
>> files \reglyphfont is applied to, it can be just as well be only kerns.
>> \reglyphfont can also be used to filter out data from this file, if there
>> is anything there that you don't want.
>
>Unfortunately, this didn't work. My kerns file is not just a list of
>\resetkern commands, but contains some macros that compute the proper
>kern information based on the numbers pulled from FontForge. Can
>\reglyphfont handle such an mtx file?
No, it can only handle "transformable" MTX files, i.e., files conforming to
the restricted syntax that \transformfont supports. The set of commands
supported is pretty much those that can be generated by one of \afmtomtx,
\pltomtx, and \mtxtomtx. (BTW, this includes \setkern but not \resetkern.)
>I guess I could have my bash script compute the values and generate an
>mtx file that purely has just \resetkern commands. However, that means
>I have to duplicate some of the functionality of fontinst (reading in
>widths, calculating bounding boxes, etc), which seems a waste.
Hmm... we may get by with some hacking. The way fontinst reads files is
always to \input them (which in the case of AFM and PL files means we need
to play some pretty advanced redefinition tricks in order to fool TeX into
usefully parsing these files, but that's a different matter). The file
conversion commands work by redefining the few supported commands to write
their data to the output file, whereas the "unsupported" commands just
continue to work as they normally do. Since most commands by default just
locally set data in internal tables, they don't seem to have any effect in
these contexts, but they are executed and you may well use them to
preprocess data for \setkern proper.
Some examples:
\setcommand\midadjust#1#2{\setkern{theskewchar}{#1}{#2}}
will make \midadjust{a}{10} behave as if the file had said
\setkern{theskewchar}{a}{10}.
\setcommand\altmidadjust#1#2{
\resetint{temp}{\sub{#2}{250}}
\setkern{theskewchar}{#1}{\strint{temp}} % \int{temp} won't work.
}
will make \altmidadjust{a}{260} behave as if the file had said
\setkern{theskewchar}{a}{10}.
A lot depends on what processing you need to make, though. Could you give
some concrete examples?
Lars Hellström
More information about the fontinst
mailing list