TTX to UFO

Which tools can convert TTX format into UFO?

Comments

  • Your best option is Extractor. It can convert a few different binary font formats into UFO.
  • RoboFont can open TTX files. And it saves to UFO by default.
  • John Hudson
    John Hudson Posts: 3,229
    Since a TTX file is an XML representation of an sfnt font, I am interested to know why you want to go direct from TTX to UFO rather than via the TTF/OTF that the TTX represents?
  • John, because Glyphs app exposes different amount of the OpenType layout features depending on the format it "ingests". Glyphs exposes more of the features to the user when it opens a font in UFO format in comparison with the equivalent font in TTF/OTF. Seems unreasonable, but in practice, that's what happens. BTW, Glyphs doesn't read TTX. As you've noted, both TTX and UFO are XML representations, so the conversion should be relatively simple.
  • Although conversion might be attractive in the short term, I would hope you’ve told @Georg Seifert about the problem. Arguably a bug, but at least a reasonable feature request!
  • How did you get the TTX file? If you used the ttx tool to create it, you could convert it back using the same ttx tool. But, as @John Hudson pointed out, TTX is based on the SFNT container format that is used by TTF and OTF files. Those are exported font formats that cannot be reconstructed fully to the original source file. UFO is a source format and, as such, can be opened losslessly by a font editor. Converting a TTX to UFO will, in most cases, result in a less complete UFO file as compared to the original source file.

    If you have access to the original source file, prefer it to any exported files like TTX/TTF/OFT when opening in a font editor since they do not contain all of the information. Features specifically cannot be losslessly reconstructed from an exported font (E.g., should a certain GPOS rule be imported as manual feature code or an anchor on a glyph layer? That is impossible to know from an exported file and requires guesswork by the font editor. Same for kerning and a lot of other things.)

    As you've noted, both TTX and UFO are XML representations, so the conversion should be relatively simple.
    XML is a generic container format. TTX and UFO both use it, but that does not ease the conversion between the two. TTX is mostly a ttx/FontTools specific format, so I would recommend using the ttx tool or the FontTools library to convert a TTX file back to TTF/OTF. I believe RoboFont does exactly that under the hood when opening a TTX file. It might be a good idea to create a Glyphs file format plugin that does the same, but in the meantime, TTX files can be converted with ttx and then opened in Glyphs.
  • John Hudson
    John Hudson Posts: 3,229
    Glyphs exposes more of the features to the user when it opens a font in UFO format in comparison with the equivalent font in TTF/OTF.
    UFO is designed as a source format, so I am not surprised that Glyphs can typically derive more OTL data from a source UFO than by decompiling a TTF. But it doesn’t follow that a UFO converted from a TTX representation of a TTF will contain any cleaner and more complete OTL data than the decompiled TTF: you are still dealing with a GSUB/GPOS table representation, not original OTL source code.

  • If you want to go from a font file to OpenType .fea, I recommend my fontFeatures library:

    pip3 install fontFeatures
    otf2fea YourFont.otf
  • Thank you all for your helpful comments.
    So, it's clear that there are many angles on this question. Some situations do not lend themselves to ideal solutions.

    As an additional alternative, what are some reliable tools that convert OTF/TTF directly to UFO?
  • I don't think there are any reliable tools that can do this well in the general case, yet. (In the general case it's impossible - if the TTF is a variable font it can't be expressed as UFO.) My babelfont project will get there eventually, but it's not there yet.

    But stepping back, it looks like you're trying to unbake a cake, which is a sign that something has gone wrong earlier in the process.
  • I often have to deal with imperfect projects that need to be fixed and supplemented. You could call them half-baked cakes, if you want. No need to include variable fonts in the question. 
  • @Simon Cozens  otf2fea works very well. Thanks.
  • I often have to deal with imperfect projects that need to be fixed and supplemented. You could call them half-baked cakes, if you want. No need to include variable fonts in the question. 

    Can’t you get to the sources that where used to compile the font files? 
  • And as @Thomas Phinney said it might interesting to get your font to see if we can improve the feature decompiler.
  • John Hudson
    John Hudson Posts: 3,229
    edited November 2021
    Kamal, in case it is of use anywhere in your workflows: our Volto tool converts VOLT .vtp files or TSIV tables to AFDKO .fea syntax.

  • Thanks, John. That's good to know.
    Georg, I will take the Glyphs-specific discussion to the Glyph Forum.