[MPEG-OTSPEC] [EXTERNAL] Re: Co-existence of glyph rendering source types

Renzhi Li Renzhi.Li at microsoft.com
Sat Sep 12 01:45:02 CEST 2020


I was thinking in OFF2 (or "NextFont") MVP*, since it is already a completely new format, we should have some redesign. In my personal idea, we could have these visual formats:

  *   A unified vector visual like TT but with cubic support, and without composite glyphs and components.
     *   Format is mostly like TT but allowing "shape fragments" for data sharing. A shape fragment could be a contour, or a part of a contour, like a serif shape.
     *   No composite glyphs and components, shape sharing is completely transparent.
  *   A unified raster visual.
     *   Able to contain PNG or SVG or other kinds of images (like ASTC).
     *   It can define glyphs' raster visual as a slice of a larger image, so multiple glyphs could be packed together into one single image. This technique is also known as Texture Atlas in game development.
[cid:93fdf2d7-91cd-49ac-94e5-b2137a1beb91]
  *   WebAssembly for hints.
  *   A table describing how the vector or raster visuals build up the final glyph visual — some sort of ASTs.

Since OFF2 is extensible, we could add more formats later, like ... GLTF for 3D Emoji?

* Minimal Viable Product

________________________________
From: mpeg-otspec <mpeg-otspec-bounces at lists.aau.at> on behalf of Dave Crossland <dcrossland at google.com>
Sent: Friday, September 11, 2020 16:34
To: Adam Twardoch (Lists) <list.adam at twardoch.com>
Cc: mpeg-otspec <mpeg-otspec at lists.aau.at>
Subject: [EXTERNAL] Re: [MPEG-OTSPEC] Co-existence of glyph rendering source types

I'm not sure "political reasons" is a good principle. The political reasons have a technical basis, right?

On Fri, Sep 11, 2020, 7:23 PM Adam Twardoch (Lists) <list.adam at twardoch.com<mailto:list.adam at twardoch.com>> wrote:
Ps. In my world, OFF2 would bring down the number of flavors to just 4: glyf (TT, optionally also cubic), CFF2 (for political reasons), SVG and sbix.

Drop EBDT, CBDT and CFF.

On Sat, 12 Sep 2020 at 00:43, Adam Twardoch (Lists) <list.adam at twardoch.com<mailto:list.adam at twardoch.com>> wrote:
OpenType currently has provisions for multiple sources for glyph rendering:

1. Outlines

- glyf (optionally with fvar)
- CFF
- CFF2 (with or without variations)
- SVG

2. Bitmaps

- EBDT
- CBDT (uses PNG)
- sbix (also uses PNG)

In the spec, the relationship between these seven flavors is extremely convoluted, and sometimes contradictory.

https://docs.microsoft.com/en-us/typography/opentype/spec/cbdt<https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Ftypography%2Fopentype%2Fspec%2Fcbdt&data=02%7C01%7Crenzhi.li%40microsoft.com%7C032984bc5e5d40f1179d08d856ab375e%7C72f988bf86f141af91ab2d7cd011db47%7C0%7C0%7C637354640659402348&sdata=2tVhDUno4%2BBq9k9urcb2BB7tOO58cW4Mnm32PQJ95ZQ%3D&reserved=0> says nothing about whether some other glyph rendering source (e.g. glyf) must or may be present in the font or not.

https://docs.microsoft.com/en-us/typography/opentype/spec/sbix<https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Ftypography%2Fopentype%2Fspec%2Fsbix&data=02%7C01%7Crenzhi.li%40microsoft.com%7C032984bc5e5d40f1179d08d856ab375e%7C72f988bf86f141af91ab2d7cd011db47%7C0%7C0%7C637354640659412342&sdata=cvWOLEkXBDom9oxwml8h4YHTFbT%2BJEjrJK4VzpHrKg4%3D&reserved=0> says that the font "may also" contain glyf or CFF, but makes no mention of SVG, CBDT or CFF2.

https://docs.microsoft.com/en-us/typography/opentype/spec/svg<https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Ftypography%2Fopentype%2Fspec%2Fsvg&data=02%7C01%7Crenzhi.li%40microsoft.com%7C032984bc5e5d40f1179d08d856ab375e%7C72f988bf86f141af91ab2d7cd011db47%7C0%7C0%7C637354640659412342&sdata=Ijuy%2FRnfMOLVW96Tsauigv6ZxpB8pUu%2FWTZPDc%2B67hY%3D&reserved=0> says »For every SVG glyph description, there must be a corresponding TrueType, CFF or CFF2 glyph description in the font.« No mention of sbix or CBDT.

https://docs.microsoft.com/en-us/typography/opentype/spec/otff<https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Ftypography%2Fopentype%2Fspec%2Fotff&data=02%7C01%7Crenzhi.li%40microsoft.com%7C032984bc5e5d40f1179d08d856ab375e%7C72f988bf86f141af91ab2d7cd011db47%7C0%7C0%7C637354640659422339&sdata=W%2Fcc%2B8V6UQjb7YLaZbjJMrWlEDocifHSlygiIdBzcLo%3D&reserved=0> says » An OpenType font file contains data, in table format, that comprises either a TrueType or a Compact Font Format (CFF) outline font. « By this, one might read that am sbix-only SFNT or a CBDT-only SFNT or an EBDT-only SFNT or perhaps even a CFF2-only SFNT is not an OpenType font.

The same page says » OpenType fonts that contain TrueType outlines should use the value of 0x00010000 for the sfntVersion. OpenType fonts containing CFF data (version 1 or 2) should use 0x4F54544F ('OTTO', when re-interpreted as a Tag) for sfntVersion.« Here CFF is used as “1 or 2”, while in the SVG spec, CFF is named separately from CFF2 so it must mean "1". Again, no guidance for sbix-only, CBDT-only or EBDT-only fonts.

Same document: » Required Tables. Whether TrueType or CFF outlines are used in an OpenType font« Again, no word on non-outline fonts (sbix-only, CBDT-only, EBDT-only).

Same document: » OpenType fonts may also contain bitmaps of glyphs, in addition to outlines.« But the sbix table says outlines are optional. Contradiction?

In the same document 'maxp' is listed as required in the same way as 'head' is but https://docs.microsoft.com/en-us/typography/opentype/spec/maxp<https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Ftypography%2Fopentype%2Fspec%2Fmaxp&data=02%7C01%7Crenzhi.li%40microsoft.com%7C032984bc5e5d40f1179d08d856ab375e%7C72f988bf86f141af91ab2d7cd011db47%7C0%7C0%7C637354640659422339&sdata=W9pmetXwIIbhnrKtYNywMS1AMyevWBZJUtd%2F7AK%2FeYI%3D&reserved=0> says » This table establishes the memory requirements for this font. Fonts with CFF data must use Version 0.5 of this table, specifying only the numGlyphs field. Fonts with TrueType outlines must use Version 1.0 of this table, where all data is required.« It’s unclear if “CFF” is inclusive of CFF2 here or not, and it’s unclear what role the table has with bitmap-only fonts.

Same on
https://docs.microsoft.com/en-us/typography/opentype/spec/hmtx<https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Ftypography%2Fopentype%2Fspec%2Fhmtx&data=02%7C01%7Crenzhi.li%40microsoft.com%7C032984bc5e5d40f1179d08d856ab375e%7C72f988bf86f141af91ab2d7cd011db47%7C0%7C0%7C637354640659432331&sdata=qRAiffd%2F1bptT4j32rGGJtu6u8K1oj5JPt%2FcgQ4p%2Brc%3D&reserved=0> — the description goes into detail about glyf, CFF & CFF2 but makes no reference to bitmap-only fonts.

Therefore, the spec does not provide sufficient info about which tables should or must be in an outline-less sbix-based, CBDT-based or EBDT-based font.

https://docs.microsoft.com/en-us/typography/opentype/spec/ebdt<https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Ftypography%2Fopentype%2Fspec%2Febdt&data=02%7C01%7Crenzhi.li%40microsoft.com%7C032984bc5e5d40f1179d08d856ab375e%7C72f988bf86f141af91ab2d7cd011db47%7C0%7C0%7C637354640659432331&sdata=oIS2HpcMj8ha2TFMu6scwQw8PAM8NKYypngmOQ9H9%2BI%3D&reserved=0> and
https://docs.microsoft.com/en-us/typography/opentype/spec/eblc<https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Ftypography%2Fopentype%2Fspec%2Feblc&data=02%7C01%7Crenzhi.li%40microsoft.com%7C032984bc5e5d40f1179d08d856ab375e%7C72f988bf86f141af91ab2d7cd011db47%7C0%7C0%7C637354640659442328&sdata=DTf%2B9BnRYY%2BwAWJZtzD6xJoQkT1zk8m2ttWuwdkfsCg%3D&reserved=0> make no mention of their relationship to the outline formats, or to other bitmap formats.

https://docs.microsoft.com/en-us/typography/opentype/spec/recom#embedded-bitmaps<https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Ftypography%2Fopentype%2Fspec%2Frecom%23embedded-bitmaps&data=02%7C01%7Crenzhi.li%40microsoft.com%7C032984bc5e5d40f1179d08d856ab375e%7C72f988bf86f141af91ab2d7cd011db47%7C0%7C0%7C637354640659442328&sdata=q7VjBF2rFCpJ9kj9%2ByQJ440NsQcpm1D%2FI50%2F%2FQ0b9NM%3D&reserved=0> explicitly allowes EBDT-only fonts and says that all required tables except glyf and loca should be there. Does that still include maxp & hmtx?

Since recommendations allow EBDT-only, one could think that CBDT-only is also allowed, because somewhere it says that CBDT uses similar concepts to EBDT. But maybe someone else might think differently.

sbix and CBDT also make no mention of their relationship with each other, and I think sbix/CBDT are not coordinated either.

There is a reluctance on some parties’ part to support SVG in fonts, but I can easily see how either CBDT or sbix or both could be used for SVG the same way as EBDT was used for TT outlines — as a hand-tuned representation for small sizes. An engine might prefer the fast PNG rendering for smaller sizes and switch to slower SVG for larger sizes, or if it doesn't have an SVG renderer, it still might render upscaled PNGs from sbix/CBDT (as Apple used to do with sbix-only, and as Google still does with CBDT-only).

In OFF2, we might do away with EBDT/CBDT entirely. EBDT is no better than sbix, in fact it's worse because it has a max PPM of 127 (!). sbix can be used for all kinds of bitmaps, and its PNGs can be monochrome or grayscale.

I don't see why OT fonts that have SVG also MUST have glyf/CFF(2), while sbix does not have to have glyf/CFF(2), and EBDT/CBDT also, in practice, doesn't have to have outlines.

If an sbix-only font (without glyf/CFF(2)) is valid (at least some part of the spec suggests it is), then a font with sbix and SVG but without glyf or CFF(2) also should be valid, bit isn't.

Finally, I don't think it's clear whether a CFF2 table and a CFF table can or cannot co-exist in the same font.

https://docs.microsoft.com/en-us/typography/opentype/spec/recom<https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Ftypography%2Fopentype%2Fspec%2Frecom&data=02%7C01%7Crenzhi.li%40microsoft.com%7C032984bc5e5d40f1179d08d856ab375e%7C72f988bf86f141af91ab2d7cd011db47%7C0%7C0%7C637354640659452319&sdata=%2BxYr7nAngUjPQJ0PaEs2b5A6NDe4warYAMuSh7tlSME%3D&reserved=0> says »Mixing Outline Formats
Both Microsoft and Adobe recommend against mixing outline formats within a single font. Choose the format that meets your feature requirements.«

But of course...
https://docs.microsoft.com/en-us/typography/opentype/spec/otff<https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Ftypography%2Fopentype%2Fspec%2Fotff&data=02%7C01%7Crenzhi.li%40microsoft.com%7C032984bc5e5d40f1179d08d856ab375e%7C72f988bf86f141af91ab2d7cd011db47%7C0%7C0%7C637354640659452319&sdata=wMuVyEbVt7qcxqFXGi4adiGHNgYmgg8fa0JUTb7Apkw%3D&reserved=0> lists “SVG Outlines” as the 3rd kind of outlines next to “TrueType Outlines” and “CFF Outlines”, and the SVG table spec says you *must* mix SVG Outlines with either TT or CFF outlines, so obviously that recommendation is, uh, err... 😁

I hope we can clarify these relationships.

A.












_______________________________________________
mpeg-otspec mailing list
mpeg-otspec at lists.aau.at<mailto:mpeg-otspec at lists.aau.at>
https://lists.aau.at/mailman/listinfo/mpeg-otspec<https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.aau.at%2Fmailman%2Flistinfo%2Fmpeg-otspec&data=02%7C01%7Crenzhi.li%40microsoft.com%7C032984bc5e5d40f1179d08d856ab375e%7C72f988bf86f141af91ab2d7cd011db47%7C0%7C0%7C637354640659462316&sdata=Jj1189xsw80U4%2FtlcjtPvapKZtd%2FgjdXHfhVKj8lLac%3D&reserved=0>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.aau.at/pipermail/mpeg-otspec/attachments/20200911/23efd83f/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image.png
Type: image/png
Size: 93899 bytes
Desc: image.png
URL: <https://lists.aau.at/pipermail/mpeg-otspec/attachments/20200911/23efd83f/attachment-0001.png>


More information about the mpeg-otspec mailing list