Font Convertor

Can anyone recommend the best app that would allow me to edit (batch process?) completed .ufo and .otf files?

I'm interested in being able to do something to the effect of 'find and replace' for font naming (and maybe other metadata) quickly and painlessly. Is there an app that would allow me to 'open up the hood' so-to-speak on said files and make changes, save etc.?

I'm going to have a bunch of files that will potentially need the naming changed from their temporary names to finalized font names.

Comments

  • Adam Twardoch
    Adam Twardoch Posts: 515
    edited September 2015
    Your best bet for .otf/.ttf is fontTools/TTX https://github.com/behdad/fonttools/ 

    1. Download https://github.com/behdad/fonttools/archive/master.zip
    2. Follow the instructions for fontTools given on http://store.fontlab.com/index.php?option=com_fss&view=kb&Itemid=431&kbartid=13 

    Once you've installed fontTools/TTX, you can use it in commandline such as this: 
    ttx -t name -t 'CFF ' yourfont.otf
    You'll get a yourfont.ttx file which is an XML file containing the "name" and "CFF " tables that have the font names. Open it in a text editor, search-and-replace, then do
    ttx -m yourfont.otf yourfont.ttx
    You'll get a yourfont#1.otf file which will contain the new naming. 

    Even simpler, you can first just do
    ttx yourfont.otf
    and you'll get a yourfont.ttx which contains the entire font in XML format. Do your edits there and run 
    ttx yourfont.ttx
    to get a new yourfont#1.otf. 

    The first method (just converting specific tables) is a bit more "secure" since you'll unlikely screw up anything else in the font. 

    My tool: 
    https://github.com/twardoch/fonttools-utils/tree/master/pyftfeatfreeze
    can also be used for just renaming the internal font names, like here:  
    pyftfeatfreeze.py -R 'Lato/Otal' Lato-Regular.ttf Otal-Regular.ttf
    In the -R option, you can supply a list of comma-separated search and replace string pairs: 'search1/replace1,search2/replace2,...' . You separate the search string from the replace string by /, and all comma-separated pairs are executed one after another. 

    Best,
    Adam
  • Appreciate this Adam, it looks pretty straight forward I'll give it a shot soon!
  • Michael,
    for pyftfeatfreeze, I specifically made the search-replace function to work on substrings so spaces can be taken out of the equation. For example, the full name may be "Lato Pro Bold" and the PS namy may be "LatoPro-Bold". I could specify -R 'Lato Pro/Otal Com,LatoPro/OtalCom' but perhaps it's better to just do -R 'Lato/Otal' or -R 'Lato/LatoCust'.

    Beware of situations like, in the above case, -R 'Lato/Lato Cust'. This will inadvertently insert a space into the PS name (so it'll become "Lato CustPro-Bold" which is invalid. (I'll probably fix that so spaces are always removed when needed). 

    But there is a special -S -U 'Cust' method that appends a suffix. That one is done intelligently i.e. the suffix may contain spaces and they will be stripped off when needed. You can use -S -U together with -R. 
  • Adam, I just ran this above and created the .ttx file no problem. Converting it back though I ended up with the files you mentioned, but they are .ttf rather than .otf files. Am I doing something wrong?
  • And is a .ttx file the insides of a font file? Or is it parsed in some way? Scanning through it I don't see any thing that I can comprehend as OpenType features or even kerning tables.
  • Kent Lew
    Kent Lew Posts: 944
    A .ttx file is an XML representation of the decoded binary tables of the font.

    The OpenType features are in the GSUB and GPOS tables. The compiled structure of OT features takes a bit of getting used to, especially if you’re primarily accustomed to working with the Adobe syntax of an uncompiled .fea file.

    You can learn more about the structure of an OpenType font by reading the OT spec documentation.

    The OT {kern} feature data will be in the GPOS table. If there is a top-level <kern> table in your ttx file, that is the legacy, flat kerning table.



  • Your best bet for .otf/.ttf is fontTools/TTX

    Your second best bet is DTL OTMaster, which can be purchased from FontLab Ltd.’s webshop. Adam can tell you more about it. ;)

  • OTMaster looks good, I could really use the Table Comparator and Consistency Checker as well.
  • The first method (just converting specific tables) is a bit more "secure" since you'll unlikely screw up anything else in the font.
    Although I’m pretty biased, I think OTM is a very user-friendly and powerful tool for editing .ttf and .otf fonts. It is also very ‘secure’, because you will have to do your best to screw up anything else in the font.

    There are a number of OTM users here on TD, and perhaps some of them are willing to share their experiences with you.
  • Is there any way to script OTM for batch-processing multiple fonts?

    Sometimes I feel OTM is too ‘secure’, especially when it prevents editing of some name records, unless I change a name in a related table first. Hey, let me screw up my fonts if I want to. Maybe a checkbox

    ☑️ I know what I’m doing

    would be nice :)
  • Is there any way to script OTM for batch-processing multiple fonts?

    What would you like to batch-process exactly?

    Hey, let me screw up my fonts if I want to.

    Aye Aye Sir! We will add a preference setting for screwing up fonts! At least for the CFF-FontName <–> PS Name & the Windows Full name entries.