AFM mathtext

Hi, I regularly use matplotlib on lots of systems I

    > don't have root access to. On most of these
    > installation of gs 8.15 is quite problematic (and buggy)
    > and as I result using TeX with matplotlib is
    > impractical. Additionally as all of the printers I have
    > access to are HP made the use of embedded truetype fonts
    > is also problematic. The combination of these two
    > problems has made it difficult to use mpl for anything I
    > need to print and for which I need mathtext.

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

    def get_kern(self, font, symleft, symright, fontsize, dpi):
        """
        Get the kerning distance for font between symleft and symright.

        font is one of tt, it, rm, cal or None

        sym is a single symbol(alphanum, punct) or a special symbol
        like \sigma.

        """
        return 0

For an afm class instance, you can call get_kern_distance to get the
kerning distance between two characters.

    >>> from afm import AFM
    >>> fh = file('ptmr8a.afm')
    >>> afm = AFM(fh)
    >>> afm.get_kern_dist('A', 'y')
    -92.0

and if I recall correctly this has to be corrected by a factor of
1000.

JDH

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?

Nick

···

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