AFM mathtext

The Group element is the only place kerning is set, but groups are the
right place. Eg \rm{hi mom} is a group. I just took a look and
noticed I commented out the place where the kern is set

    def advance(self):
        'get the horiz advance'
        return self.metrics.advance # how to handle cm units?+ self.kern*self.widthm

It looks like I was a bit confused about how to best include the
kerning information, and was experimenting by treating it as a
fraction of the width of an "m". You may want to try some
alternatives. But this is where you would start hacking.

JDH

···

On Wed, 2005-10-19 at 12:08 -0500, John Hunter wrote:

    >> Hi this looks very nice! I have to run now but I'll give you a
    >> quick tip. kerning controls the inter-letter spacing, and your
    >> Fonts class has to override "get_kern"; the base class always
    >> returns 0

    > I had missed this function - but as far as I can see it
    > isn't actually called in the majority of cases (only
    > where set_font is called on the parent GroupElement -
    > which doesn't always happen in any of the common cases
    > I've tried). Am I missing something?

I've made some improvements and I think the result looks as good as it's
going to using the Symbol font and without a suitable font for \cal; a
revised patch is attached. In the patch I've refactored the kerning in
mathtext.py and removed all kerning information from TrueType the font
classes (as it wasn't being used anyway) by renaming the relevant
get_kern functions.

Nick

afm.patch (10.8 KB)

···

On Wed, 2005-10-19 at 15:28 -0500, John Hunter wrote:

It looks like I was a bit confused about how to best include the
kerning information, and was experimenting by treating it as a
fraction of the width of an "m". You may want to try some
alternatives. But this is where you would start hacking.

I've made a small alteration to my code for AFM mathtext to show digits
and brackets () in the roman rather than the italic font, as is normal
in mathtext. The patch is attached.

Nicholas

afm_num.patch (312 Bytes)