OTF Variable fonts

Hello everybody,

I'm looking for resources that can teach me how to build an OTF variable font. I'm using Glyphs and I have already created a TTF GX variable typeface.
Recently a client asked me for an OTF format that still behaves as a variable but I don't know how to do it. I have found a lot of articles about VF and about OTF (some of them thanks to this site) but nothing on how to practically create it: which software or plug in...Am I missing something?

Thank you in advance for any information you can provide.

Comments

  • Any reason why they asked for the OTF format?
  • Please be aware a variable font with an OTF file extension can contain either TrueType outlines or PostScript-style outlines.

    It seems you want to make a variable font with PostScript-style outlines, so it must contain a CFF2 font table. Currently afdko allows you to generate such font. Font editors that make use of it, can probably be used.
  • Any reason why they asked for the OTF format?
    Sorry, didn't ask. Actually I didn't know they exist before that request. I always used TTF GX export of Glyphs without any problem and I thought it was the only format available. Does exist a plug in that allows you to create such format?
  • Glyphs doesn’t support CFF2 variable fonts, yet. We are working on it. 
  • Glyphs doesn’t support CFF2 variable fonts, yet. We are working on it. 
    thank you.

    Please be aware a variable font with an OTF file extension can contain either TrueType outlines or PostScript-style outlines.

    It seems you want to make a variable font with PostScript-style outlines, so it must contain a CFF2 font table. Currently afdko allows you to generate such font. Font editors that make use of it, can probably be used.
    and thank you too!
  • edited August 2020
    At the moment you can use either fontmake or AFDKO to build variable-CFF2 fonts from the command line, or use FontLab 7. Fontmake and FontLab 7 can take .glyphs files directly, or can be used to convert them to designspace+UFOs to be used with AFDKO.

  • One concern to note is that Variable OTFs struggle with hinting overlapping contours. So if you need to preserve overlaps, generating a variable TTF is the better bet right now—at least if you intend to add hinting. 
  • One concern to note is that Variable OTFs struggle with hinting overlapping contours. So if you need to preserve overlaps, generating a variable TTF is the better bet right now—at least if you intend to add hinting. 
    I have noticed that some similar issue still happens with TTF as well, you see a "shadow" of the overlapping contours when I try them on a browser or on text editing software. So I usually merge all contours just before the export.
  • Please be aware a variable font with an OTF file extension can contain either TrueType outlines or PostScript-style outlines.
    Indeed. It seems worth wondering why the client wants this. If they are asking it because they think that OTF means "has layout tables"/"more advanced"/whatever, then I would consider simply changing the file extension.

    It's hard to imagine that a client really genuinely prefers to have CFF2 outlines, when surely the whole point of OpenType is that we don't have to care about the choice of outlines.
  • Andrea T. said:
    One concern to note is that Variable OTFs struggle with hinting overlapping contours. So if you need to preserve overlaps, generating a variable TTF is the better bet right now—at least if you intend to add hinting. 
    I have noticed that some similar issue still happens with TTF as well, you see a "shadow" of the overlapping contours when I try them on a browser or on text editing software. So I usually merge all contours just before the export.
    I think it depends on the renderer being used. Any Microsoft renderer is based on the bilevel renderer, such as 4×4 oversampling, and stacking the same outline multiple times will still be the same render. On the other hand, the FreeType anti-aliasing method cannot handle self-intersection properly (it counts the overlap as more area being taken and therefore assumes the pixel is more filled) and causes glitches like this.
  • Andrea T. said:
    I'm using Glyphs and I have already created a TTF GX variable typeface.

    If you refer to GX, that sounds like you have made a variable font that doesn't conform to the OT 1.8.x spec for variable fonts. E.g., you've defined axes differently than spec'd in OT. Is that what you mean?

    If you meant a variable font with TT outlines, then I suggest you say that, or perhaps a (glyf/)gvar variable font. (At this point, I'm guessing most people would take OT as implied.)
  • 'TTF GX' is how Glyphs identified their initial variable font export option, and they still use [GX] as an icon image for that (beta) export option, so it is a little confusing.
  • Andrea T. said:
    One concern to note is that Variable OTFs struggle with hinting overlapping contours. So if you need to preserve overlaps, generating a variable TTF is the better bet right now—at least if you intend to add hinting. 
    I have noticed that some similar issue still happens with TTF as well, you see a "shadow" of the overlapping contours when I try them on a browser or on text editing software. So I usually merge all contours just before the export.
    I think it depends on the renderer being used. Any Microsoft renderer is based on the bilevel renderer, such as 4×4 oversampling, and stacking the same outline multiple times will still be the same render. On the other hand, the FreeType anti-aliasing method cannot handle self-intersection properly (it counts the overlap as more area being taken and therefore assumes the pixel is more filled) and causes glitches like this.
    This issue is being resolved in the upcoming FreeType 2.10.3, though it requires that the OVERLAP_SIMPLE and OVERLAP_COMPOUND flags are set for the specific glyphs (which most variable ttf fonts probably don't have set). You can see our discussion about this issue on the Cascadia Code github.

    I ended up adding a brute force override to implement those two flags on all glyphs of Cascadia Code (rather than just the ones that needed it) as a stopgap until ufo2ft decides how they'd like to implement it. 

  • Andrea T. said:
    One concern to note is that Variable OTFs struggle with hinting overlapping contours. So if you need to preserve overlaps, generating a variable TTF is the better bet right now—at least if you intend to add hinting. 
    I have noticed that some similar issue still happens with TTF as well, you see a "shadow" of the overlapping contours when I try them on a browser or on text editing software. So I usually merge all contours just before the export.
    I think it depends on the renderer being used. Any Microsoft renderer is based on the bilevel renderer, such as 4×4 oversampling, and stacking the same outline multiple times will still be the same render. On the other hand, the FreeType anti-aliasing method cannot handle self-intersection properly (it counts the overlap as more area being taken and therefore assumes the pixel is more filled) and causes glitches like this.
    This issue is being resolved in the upcoming FreeType 2.10.3, though it requires that the OVERLAP_SIMPLE and OVERLAP_COMPOUND flags are set for the specific glyphs (which most variable ttf fonts probably don't have set). You can see our discussion about this issue on the Cascadia Code github.

    I ended up adding a brute force override to implement those two flags on all glyphs of Cascadia Code (rather than just the ones that needed it) as a stopgap until ufo2ft decides how they'd like to implement it. 


    I prefer the rendering of 4×4 oversampling anyway. Because it is pretty much the same render process as standard bilevel rendering, and it is not sensitive to every single area in the pixel. It is pretty much a more practical anti-aliasing engine. So even with this update my font renderer named TD renderer will of course still use 4×4 oversampling, like classic GDI does.
  • Please be aware a variable font with an OTF file extension can contain either TrueType outlines or PostScript-style outlines.
    This is technically true, but in over 20 years of OpenType work, the only OTFs I have encountered with TrueType outlines were one or two specifically created to test software assumptions. I have never seen or even heard of one that was in normal use or encountered “in the wild.”

    So, on the one hand: yes, theoretically possible. If you are writing an app or a code library, you should probably not make an assumption. But as a practical rule of thumb for everybody else, it is perfectly reasonable to assume that an OTF almost certainly contains PostScript-style outlines.
  • simon@upo ~/Library/Fonts $ grep 'glyf' *otf | wc -l
    26
    
  • Thomas PhinneyThomas Phinney Posts: 2,748
    edited September 2020
    Fascinating. The same thing on my computer returns zero. What are the 26 fonts, and what is their provenance?

    And… out of how many OTFs in that directory?
  • simon@upo ~/Library/Fonts $ grep 'glyf' *otf | wc -l
    26
    
    Table name tags are plaintext inside font binaries?! One can grep inside files?! The earth is not flat, you say?! 😳🤯😵

    Thank you!
  • You of course need to be careful grepping for table name tags, in case the same text appears in e.g. the name table. But in this case, I followed up with a thorough check, and as a quick back-of-the-envelope sketch, it's super useful.

    I have 602 otf files in that directory. The TT-outlined .otf files are all from CreativeMarket, so that's something.
  • By default FontCreator gives a font file a .otf extension on export, no matter the outline format.
  • AFAIR, the Bitstream fonts that shipped with Corel Draw had the .otf extension and were TT-flavored. But maybe not. :)
  • Marc OxborrowMarc Oxborrow Posts: 220
    edited October 2020
    I bought a copy of Corel Draw back in the day solely for the font collection. The fonts had a .TTF extension. 

    Interestingly (or not?), the version name is "Version 1.01 emb4-OT."





  • Igor PetrovicIgor Petrovic Posts: 263
    edited October 2020
    Does all of this mean that Variable fonts are more naturally inclined to TrueType curves (so the OTF variable font is kind of hack), or it's perfectly fine to have OT(PS) curves (just have to check is the font drawing software capable to export it at the end)? 
  • Variable fonts can be made using TrueType glyph data (glyf + gvar tables) or using a CFF2 table. The ".ttf" / ".otf" extension is orthogonal to this.
  • Any reason why they asked for the OTF format?
    Here's an example. I prepared family styles with PostScript outlines and manual PostScript hinting, in the .otf extension. If I wanted to publish a variable font, the file will be in .ttf format.
    Some resellers simply won't accept such submission, as all files must be in the same format.

  • Dave CrosslandDave Crossland Posts: 1,391
    simon@upo ~/Library/Fonts $ grep 'glyf' *otf | wc -l
    26
    
    Table name tags are plaintext inside font binaries?! One can grep inside files?! The earth is not flat, you say?! 😳🤯😵

    Thank you!
    The unix "strings" tool is useful as a precursor to such grepping as it will strip non text characters
  • Thomas PhinneyThomas Phinney Posts: 2,748
    edited June 2022
    Does all of this mean that Variable fonts are more naturally inclined to TrueType curves (so the OTF variable font is kind of hack), or it's perfectly fine to have OT(PS) curves (just have to check is the font drawing software capable to export it at the end)? 
    Neither. It’s a bit more subtle than that....

    Variable fonts are not more naturally inclined to either type of curves.

    One could argue that the original CFF OpenType fonts are actually a bit of a hack (given the data redundancy inherent in the format, shoving a whole CFF font into a table), BUT the CFF2 format used for CFF variable fonts addresses that problem.

    However… as CFF2 variable fonts were just a bit late getting spec’d relative to TTF variable fonts, and supporting TrueType variable fonts involves less engineering, CFF variable fonts are not as well supported as TrueType variable fonts. Some things still don’t support them,

    And then again there are many things that do support them, but supported TrueType variable fonts first. So sometimes current/recent versions of browser X or app Y support both flavors, but if you go back a bit, there are versions that supported TT variable fonts but not CFF2 variable fonts.
  • edited June 2022
    Fascinating. The same thing on my computer returns zero. What are the 26 fonts, and what is their provenance?

    And… out of how many OTFs in that directory?

    ~/Library/Fonts$ grep -R 'glyf' --include=*otf .

    Binary file ./SyrCOMUrhoy.otf matches

    In my collection of historic and exotic fonts:

    ~/font_examples$ grep -R 'glyf' --include=*otf . | wc -l

          45


Sign In or Register to comment.