boring-expansion-spec icon indicating copy to clipboard operation
boring-expansion-spec copied to clipboard

[`GSUB`/`GPOS`/`BASE`/`JSFT`] Use `ltag` table for arbitrary language tags

Open behdad opened this issue 4 years ago • 1 comments

The AAT ltag table allows encoding arbitrary BCP 47 language tags. This frees us from the current limited model of language tags in OpenType. As such we shall embrace it.

ltag table assigns a zero-based index to arbitrary encoded BCP 47 tags. Any table then can reference these languages. The number of languages that can be encoded is practically limited to 16 bits in the current version of the table. The morx and kerx tables refer to this index by encoding the index+1, such that the number 0 can be used to mean "no language" still. Eg. quoting morx:

For feature type 39, a selector value of 0 means, as elsewhere “no change,” and will generally be used for language-independent glyphs (such as general Cyrillic). Other selector values are one more than an index into the 'ltag' table and can be used to indicate switching to a set of language-specific glyphs (such as for Serbian). See the documentation for the 'ltag' table for details.

Proposal: anywhere language tags are used, if the first byte is 0, then the following three bytes form a 24bit numeric value that is one more than an index into the ltag table language index. Any language can be referred that way, even if there exists an OpenType language tag for it. Furthermore, BCP 47 language tag matching may be used by client as they see fit.

References:

ltag: https://developer.apple.com/fonts/TrueType-Reference-Manual/RM06/Chap6ltag.html

morx table that uses ltag for example: https://developer.apple.com/fonts/TrueType-Reference-Manual/RM06/Chap6morx.html

behdad avatar Nov 10 '21 21:11 behdad

cc @nedley

behdad avatar Nov 17 '21 18:11 behdad