Why are composite glyphs not used whenever possible in exported TTF files?

Adam Jagosz
Adam Jagosz Posts: 689
edited March 2017 in Technique and Theory
Why are only some glyphs implemented as composites? What is the criterium for determining if the glyph should be/remain composite?
I understand leaving the accented letters in Calibri as composites, but why are /questiondown and /exclamdown in Calibri composites, if colon, semicolon, ellipsis, quotes or any of the braces, brackets, parentheses, are not? All of the listed are identical with their rotated versions etc., there were no tweaks applied to them that would justify copying instead of referencing. It seems like the designer:
a) copied the glyphs expecting some tweaks might be needed, but then decided they looked fine and didn't bother to replace them with references, or
b) copied any glyphs that he thought were essential for the English language, and referenced all the glyphs they could that were only needed in some minor useless languages, like Spanish.

Point counts in the glyphs of Calibri that could be utilized as base glyphs for references but were not:
period 8
comma/quoteright/quoteleft 23, quotedblright/quotedblleft 46 (wow, the number of chromosomes in human genome:)
parenleft/parenright 27

Point counts in base glyphs that were used as base for composites:
exclam 34
question 59

One could wonder if the cost (in file size) of referencing a glyph is between the cost of a 27-node path and a 34-node one. 
Some other fonts implement inverted Spanish punctuation as copies, and composites are only used for accents, though.

And one final question, does implementing a glyph as composite have any side effects? Is that why it is avoided for basic glyphs (legacy / backward compatibility issues?)

Edit:
I edited the title to match more closely what I meant, the original title was: "Why are composite glyphs used sparingly?"
Tagged:

Comments

  • that were only needed in some minor useless languages, like Spanish.
    Wow! I didn't expect to read such a comment on a forum for professional type designers. Spanish is the first language for 427 million people, which is more than for English (339 million).

    I don't see any good reason for not using composites, though I have seen problems caused by mirrored or scaled composites though not for those just rotated like ¡ or ¿

    I use composites extensively in my fonts, but not for colon, semicolon, single, or double quotes, etc., only for subscripts, precomposed fractions, etc. 
  • Igor Freiberger
    Igor Freiberger Posts: 273
    edited March 2017
    Composites are not used sparingly. What you see when you open a font file in an editor does not show the production methods used to generate it. T1 and OT CFF formats, for example, have all composites decomposed when the file is generated, an option also available to TT.

    Besides this, composites may have been decomposed in a previous step for some technical reason. You should consider many fonts are made by teams and many designers use more than one type editor. Both scenarios can demand decomposition to keep compatibility among production steps.
  • Adam Jagosz
    Adam Jagosz Posts: 689
    edited March 2017
    @Bhikkhu Pesala
    minor useless languages, like Spanish.
    That was irony. Perhaps I crossed the line of allowed irony levels on this forum. I apologize.

    I see the reason behind not exporting mirrored composites (there's no way to indicate change of path direction in the reference, right?). Problems from scaled composites seem likely, too (non-integer resulting coordinates). Thanks for pointing these out.

    @Igor Freiberger
    What I meant was including composites in the final output files, not using them during production. I edited the discussion title.

    I only encountered TTF files with non unreferenced composite glyphs. Is that even possible in OTF files? Does it depend on more than the file extension? 
  • Mark Simonson
    Mark Simonson Posts: 1,734
    Composites are not allowed in CFF OpenType fonts (OT fonts with PostScript outlines). The .otf file extension usually indicates a CFF OT font, but not necessarily. Technically, an OT font with TrueType outlines could have either the .ttf or .otf extension if it includes a digital signature. By convention it's not usually done, though.
  • I can imagine one reason why sometimes it might not be preferable for certain glyphs to be made of composites: hinting.
  • Kent Lew
    Kent Lew Posts: 937
    I tend to use composites extensively for quotes, since it allows me to adjust all rather simultaneously, which I find tremendously useful when balancing opening & closing pairs.

    Adjusting fitting is trickier, depending upon the environment I happen to be working in, since different tools handle different kinds of positional adjustments slightly differently.
  • @Bhikkhu Pesala That was irony. 
    That reminds me, I should add uni2E18 and uni2E2E to my fonts. 
  • John Hudson
    John Hudson Posts: 3,189
    In TrueType fonts, the decision whether to use composites for particular glyphs is often informed by decisions about hinting and, hence, may vary depending on the production and hinting tools used.
  • Here are some stats on how much difference decomposing all composites makes:

    * 2,893 glyphs, 1298 composites, 79,653 points, 975,576 bytes
    * 2,893 glyphs, zero composites, 173,282 points, 1,487,016 bytes

    Hinting was applied using ttfautohint on exporting from FontCreator 10.1
  • Just out of curiosity, have there been experiments to see if you can create an entire typeface from a basic set of composites?
  • @Roel: you mean FontStruct?

  • Ray Larabie
    Ray Larabie Posts: 1,431
    edited March 2017
    @Roel Nieskens
    Paltime has only one dot/heart/star repeated with composites. Using a more complicated dot causes the rendering in Windows to go crazy.
  • I meant as a proper typeface for body text? Something that'd please type folk as well as those crazy web folks want an extremely small file size for their font?

  • Paul van der Laan
    Paul van der Laan Posts: 242
    edited March 2017
    @Roel: there is a trade off. Using not so many composites per glyphs produces small font files but shapes will lack the sophistication necessary for body text (as you can see on FontStruct).

    The more composites you need to create sophisticated shapes the bigger the file size will become again. (Perhaps even bigger than if you just draw outlines.)
  • Kent Lew
    Kent Lew Posts: 937
    I believe that was also the approach that David Jonathan Ross took to constructing his early Variable Font experiment: Lab DJR.
  • John Hudson
    John Hudson Posts: 3,189
    Roel, as noted by Paul, the amount of adjustment of shapes and proportions across the glyphs in a well-designed text face preclude the modular approach of today's TTF composite model. However, if the components were independently interpolable...
  • Interesting! Thanks for sharing your insights. 
  • My Amiri font currently has 6223 Arabic glyphs, of which only 512 are not composites. The composites are mostly base glyphs plus diacritical marks, but few of them are a bit more complex. I could have done with only those 512 glyphs and anchors for the diacritical marks, but handling two levels of marks in OpenType (diacritical and vowel marks) is rather complex hits a lot of implementation bugs (more so in 2008 when I first started working on it), so composites are the least problematic though it complicates working with the font.