W3C home > Mailing lists > Public > public-webfonts-wg@w3.org > October 2013

Re: Native browser/CSS support for TTC (raw and/or within WOFF)?

From: Adam Twardoch (List) <list.adam@twardoch.com>
Date: Fri, 18 Oct 2013 18:52:37 +0200
Message-ID: <52616755.6060602@twardoch.com>
To: Chris Lilley <chris@w3.org>, public-webfonts-wg@w3.org
On 13-10-18 18:12, Chris Lilley wrote:
>> Of course there's some caveats: since TTC is "one file" which stores
>> several "subfonts", I believe @font-face might need to be modified
>> somehow so that it allows selection of the subfonts.
> Rather than modify @font-face, I suspect the correct approach would be
> to define a fragment identifier syntax (the part of a url after the #)
> that points into a TTC.

I agree. We already use the fragment identified syntax for SVG fonts as 
used with @font-face:

@font-face {
   font-family: 'MyFont Web';
   src: url("MyFontWeb.woff") format("woff"),
     url("MyFontWeb.otf") format("opentype"),
     url("MyFontWeb.svg#myfont") format("svg");

And in the May 2012 discussion on the CSS3 Fonts list, John Daggett 
proposed a similar syntax for TTC:

@font-face {
     font-family: 'MyFont Web';
     src: url("MyFontWeb.ttc#1"); /* use the first font in the set of 
fonts */

> So a TTC is a single file containing multiple sfnt streams. What is
> the official defining document?

I just realized that TTC (called "TrueType Collections") is part of the 
OpenType font format spec, and the structure is documented as part of 
the main "The OpenType Font File" document:

"A TrueType Collection (TTC) is a means of delivering multiple OpenType 
fonts in a single file structure. TrueType Collections are most useful 
when the fonts to be delivered together share many glyphs in common. 
(...) The CFF rasterizer does not currently support TTC files."

In the May 2012 thread, Vlad wrote: "In addition, TTC is a normative 
part of the OpenType specification, and there is an ongoing discussion 
about extending TTC concept to support CFF OT fonts (with OTC as a name 
for it). In fact, there is nothing in the current spec that would 
prohibit it, it's just the name itself ("TrueType Collection") implies 
that its use may be limited to TrueType-flavored fonts only. So, in 
light of these discussions taking place, it seems much more reasonable 
to extend the CSS to support TTC rather than restricting its use."

The Working Draft of ISO/IEC 14496-22 3rd edition (Open Font Format, 
OFF) has been published on August 3rd, 2013:
(The second link is a zipped Word document).

Section 4.6 of the OFF 3rd ed WD spec states:

"4.6    Font collections
A Font Collection (either TTC or OTC, formerly known as TrueType 
Collection) is a means of delivering multiple OFF fonts in a single file 
structure. Font collections containing either TrueType or CFF outlines 
(TTC or OTC) are most useful when the fonts to be delivered together 
share many glyphs in common. (...)

NOTE    Even though the original definition of TrueType Collection (as 
part of the TrueType specification) was intended to be used with fonts 
containing TrueType outlines, this is no longer the case. TTC files may 
contain either TrueType or CFF outlines, regardless of whether or not 
fonts have layout tables present. For backward compatibility and 
simplicity, the description of the font collection file structure is 
using the term TrueType Collection though it should be understood that 
it is used for both CFF and TrueType outlines."

So this is, indeed, a well-established and well-documented structure, 
and now works with both CFF and TT outlines.

There is a simple Perl-based set of scripts for splitting and merging TTC:

They're a bit old, and possibly don't work well with OTC files (with the 
CFF table). But they show that they're tiny and probably rather simple 
to re-implement in any other tool.

The spirit of the May 2012 discussion was that it would be useful to 
support those. I guess 17 months ago was just not the right time to 
discuss this as there were other pressing matters at hand.

But I believe now is the time. Especially in the wake of the color font 
ideas, because there can be many cool things that could be done with TTC.

For example, a TTC could contain one "glyf" table which acts as one 
large container for glyphs, but there could be several subfonts which 
could have their own cmap tables (thus exposing different "encoded" 
portions of the same glyph set), could include a roman and an italic 
font in the same file, exposing the roman through one cmap and italic 
through another, but then allowing for example kerning between the roman 
and the italic glyphs (say an italic "f" followed by an upright ")"), 
or, for example, providing one font file with several subfonts where one 
utilizes the Microsoft COLR/CPAL table to perform automatic layering, 
but the other subfonts encoding the appropriate "layer" glyph sets 
directly (or even have different COLR tables), so the user could choose 
whether to get a layered font consisting of, say, one layer or two 
layers, or three layers etc. Further, the same mechanism could be used 
to provide font collections where the "glyf" table would be shared but 
each subfont would come with a different GSUB table implementing 
somewhat different OpenType Layout behavior.

All kinds of clever stuff can be done using TTC.



May success attend your efforts,
-- Adam Twardoch
(Remove "list." from e-mail address to contact me directly.)
Received on Friday, 18 October 2013 16:53:07 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 20:34:17 UTC