kern table

RoboFont Forums Help / General kern table

This topic contains 5 replies, has 2 voices, and was last updated by  frederik 6 years, 6 months ago.

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #5828

    Jeremie
    Member

    Hello,

    I understand RoboFont generates OT (GPOS) kerning well.
    But is it also able to generate the old school TrueType <kern> table ?
    If not, it would be nice to have the option somehow.

    #5829

    frederik
    Keymaster

    He Jeremie

    you could do some post processing when a font is generated and add a kern table to the font whenever a font is being generated.

    There is a notification event “fontDidGenerate” you could subscribe to

    good luck

    #5832

    Jeremie
    Member

    Hi Frederik,

    Thanks, subscribing the ‘fontDidGenerate’ works. I manage to add the kern table to the generated font.

    the only strange thing with ttLib.TTFont .save() function is that I couldn’t rewrite the same TTF file without a sstruct error:

    “””error: unpack requires a string argument of length 32″””

    I had to save into a new temporary file:

    fontpath= info[“path”]
    (head, tail) = path.split(fontpath)
    tail = tail[:-4]
    tail += ‘_kern.ttf’
    fontpath_kern = path.join(head, tail)
    tt = ttLib.TTFont(fontpath)

    … some code…

    tt.save(fontpath_kern)

    #5836

    Jeremie
    Member

    The notification event “fontDidGenerate” works well with the menu command “Generate Font” but, does it work with the Font Method “generate()” ?
    I can’t seem to be able to make them work together… is that a bug or am I doing something wrong?

    #5837

    Jeremie
    Member

    Hi again,

    I have place a first version of my script on :
    https://github.com/sansplomb/RobofontTools/tree/master/GenerateFont

    It adds the possibility to export kern table into the generated font. It supports Groups and can also expand Group kerning.
    Any feedback welcome :-)

    #5842

    frederik
    Keymaster

    Hi

    saving a fontTools object into the same file path is not a good plan. FontTools read the file only when it is required to read them, this is causing the error. Save to a temp file and replace it when you are done. This is safer as you can eliminate possible saving errors.

    For now the event “fontDidGenerate” is only send when using the generate from the menu. I didn’t made up my mind if this should be called when a font is generated programmatically, as a script already knows when a font is being generated and the script is able to do some post-processing of the fonts.

    thanks

Viewing 6 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic.