|
|
Log in / Subscribe / Register

Addressing brokenness in OpenType

Benefits for LWN subscribers

The primary benefit from subscribing to LWN is helping to keep us publishing, but, beyond that, subscribers get immediate access to all site content and access to a number of extra site features. Please sign up today!

By Nathan Willis
August 6, 2014

TypeCon 2014

At TypeCon 2014 in Washington, D.C., John Hudson presented a talk detailing the serious problems encountered when rendering text for many non-Latin languages—problems, he said, that stem from assumptions made in the OpenType font format, and that are overdue to be corrected. Although any file format has its limitations, Hudson said, he focused on what he called "problems of adjacency" that confront Indic and Arabic writing, and reveal a set of assumptions that were baked into the OpenType because of its roots in European alphabets.

The OpenType specification is an open, ISO standard for font files, first introduced in the mid 1990s, and built out of contributions from Adobe and Microsoft. The format it specifies for the actual shapes of glyphs themselves is derived from Adobe's PostScript-based Compact Font Format (CFF). But the specification includes much more than the outlines of characters; among other things, it also provides ways for font files to include rules for making context-sensitive substitutions of one glyph for another and for repositioning certain glyphs based on their adjacency to others.

Hudson started his talk by showing a video of Iraqi calligrapher Hajj Wafaa doing Arabic lettering with a broad-nib ink pen. Hudson pointed out that the adjacency issues he was discussing are inherent to the writing system, not to any technical implementation of it. Wafaa has to adjust for positioning and substitution rules as he works—the difference is that he can do so on the fly, based on accumulated experience. Software has to attempt to regularize and encode the required strategies, which is the difficult step. OpenType provides two basic means for adjusting how a sequence of character codes gets converted into text on screen: positioning rules, found in a font's GPOS table structure, and substitution rules, in the GSUB table.

Positioning

The positioning feature is most familiar to readers of Latin-based languages with regard to kerning awkward letter pairs (such as "AV") and placing diacritics. In the underlying string, a letter may be followed by the Unicode character for a diacritical mark; for example, "a" followed by "`". The text rendering engine encountering this sequence looks for a rule in the GPOS table, which tells it where to place the diacritic with respect to the letter—in this case, "à". Many languages support stacking multiple diacritics, so OpenType rules support this as well.

The approach breaks down almost entirely for several south Asian languages, however. Indic scripts simply do not fit into the assumptions made by OpenType; the individual letters in a word or syllable are positioned in two dimensions, often with respect to several surrounding letters. OpenType positioning essentially considers only the relationship between pairs of sequential character codes, because it was designed with kerning in mind. And kerning, he said, inherits its basic model from Gutenberg's metal type, where only horizontal movement was possible. Hudson then presented a real-world example.

[Telugu orthographic cluster and corresponding Unicode string]

Despite its unfamiliarity in the West, the Telugu language is the fifteenth most-common language in the world, with over 75 million native speakers. In the Telugu script, some of the basic building blocks of words are clusters made up of four letters of the form C M N V: an initial consonant, followed by two intermediary consonants, and ending with a vowel. The proper shaping of the character cluster is for the vowel V to be placed over the initial consonant C, and the two intermediary characters M and N to be placed below and to the right of C, respectively. Making matters still more complicated, the intermediary consonants M and N are also accompanied by "vowel killer" codes that are not printed at all, but alter the default shape of the glyphs.

This relationship cannot be expressed in OpenType without an arduous series of workarounds, Hudson explained, because GPOS rules can only be applied to adjacent characters. A common workaround, he said, is to designate the intermediary characters M and N in the font file as diacritic marks, which are defined as having zero width and can thus be ignored by the GPOS rule. This, of course, is a hack—the characters are not really diacritics at all. Moreover, because there is more than one of them in the middle of the cluster, there needs to be a separate rule defined to indicate how each should be positioned in relation to C.

With a little contemplation, the practical impossibilities of this approach become clear. Separate rules would be required for every possible combination of M and N medial characters in conjunction with every possible C consonant. Not only might the set of positioning rules overrun the size of the GPOS table, but performing the lookups while drawing text to the screen would impose a serious performance cost on the rendering engine. Not every possible letter sequence is a valid word, Hudson said, which limits the scope somewhat, but the increasing number of foreign loanwords makes the problem still larger, because they bring in sequences of letters that are not used in the original language. The sample word in his slides, he revealed, was actually the Telugu loanword for the English term "software."

GPOS rules can instruct the renderer to ignore diacritics, Hudson said, and they can even be written to ignore classes of related characters (such as variant forms of the same letter). But to properly support Telugu and similar writing systems, rules should be able to ignore arbitrary sets of characters defined within the font file. There is no technical reason why this cannot be done, he said; OpenType just needs to be amended to cope with the idea.

Substitution

The most familiar examples of glyph substitution in English are typographic ligatures, in which the sequence of character codes "f" "i" in a string are rendered with a distinct "fi" glyph rather than the "f" and "i" glyphs individually. This substitution is a common one in the GSUB OpenType table.

Cursive scripts, naturally, involve writing far more of these substitution rules. The Arabic language, notably, has four forms for each letter: isolated, initial, medial, and final. And, Hudson said, comparatively straightforward GSUB rules describe which is rendered for a given character code in context. But while such substitution rules generally suffice for the Arabic language, GSUB fails for several other languages that use the Arabic alphabet but operate with different rules.

[Several common Urdu words containing baṛi ye]

Hudson showed two examples. First is the baṛi ye, which exists in the Arabic language as an alternate, stylistic variant of the letter ye, but is a separate letter in Urdu. It is much wider than the usual ye, and Urdu text typically relocates vowel markers and other characters above and below it in order to be more compact. In addition, it sweeps backward in relation to the standard flow of the text (baṛi means "turned"), so it affects letters that precede it in many strings. GSUB rules cannot express the changes needed at all, Hudson said.

His second example is the Bengali script, which routinely requires placing multiple markers above the top line of the text. While Hudson and others have managed to create GSUB rules that more or less produce readable Bengali text in OpenType, he said, they are difficult hacks that require outside scripts to process the text in each application. In practice, most Bengali speakers simply put up with collisions and misplaced characters in their daily computer use and documents.

[A problematic Bengali string]

Fixing GSUB's shortcomings is not as simple as extending GPOS's functionality, he said. The problem is that, ultimately, OpenType rules assume that characters fit into fixed rectangular bounding boxes, and this assumption limits the operations that can move those boxes around. There are alternate software solutions for rendering Arabic scripts, he noted, such as Decotype's Arabic Composition Engine (ACE); they throw out the box model entirely. The typographic community has already dealt with similar issues when addressing how to render mathematical equations, Hudson said; surely it can come up with similar solutions for non-Latin scripts.

There are certainly other issues with OpenType, Hudson said. For example, Chinese and Japanese font developers do not run into the adjacency issues he described, but they do regularly hit the 65,000-character limit of OpenType files.

There is currently no active plan to develop a new revision to OpenType, but there is growing interest. Indeed, improving support for non-Latin writing systems was a major (if unofficial) theme at this year's TypeCon. Hudson noted that the typographic community has been using prefabricated rectangles as its base component for the three centuries since Gutenberg. That attests to the benefits of the system, he admitted, but it increasingly means grafting solutions like kerning and ligatures from one script onto another, whether they are appropriate or not. 300 years from now, he asked, will we still be talking about these problems in the same terms?

Hopefully not, he concluded. Kerning and ligatures are specific technical solutions. When technologists ask "how do we implement kerning and ligatures for this script?" they are asking the wrong question, Hudson said. Instead, they need to ask how the writing system in question copes with its adjacency problems already, then work toward a solution—even if that means breaking backward compatibility with an established format like OpenType.

Index entries for this article
ConferenceTypeCon/2014


to post comments

Addressing brokenness in OpenType

Posted Aug 7, 2014 4:36 UTC (Thu) by rsidd (guest, #2582) [Link]

Brilliant article. I can't read Telugu or Bengali, but to me the rendering of Hindi and Tamil on screens these days (post-Unicode) seems excellent. Also, all these languages have been printed for decades if not over a century, using movable type / box placement (Tamil seems better-suited to this, definitely). They have also undergone minor modifications in writing to suit printing requirements.

One language that is quite badly affected is Urdu (spoken mainly in Pakistan, but with a significant presence in India too). Traditionally it was written in a very florid "nastaliq" script but, as this article discusses in detail, it is being written more and more in a boxy Arabic-derived "naskh" script because of computer limitations. (The everyday spoken language is very similar to Hindi, which is written in India in the Devanagari script.)

Addressing brokenness in OpenType

Posted Aug 7, 2014 14:05 UTC (Thu) by nix (subscriber, #2304) [Link] (1 responses)

The three centuries since Gutenberg? He died in 1468. That would be almost five and a half centuries ago.

Addressing brokenness in OpenType

Posted Aug 7, 2014 16:35 UTC (Thu) by n8willis (subscriber, #43041) [Link]

It took a long time to spread and reach any form of standardization, though. Which, for a typographer (as the speaker here was), generally means when the first type foundries were created. At that point, the typesetting process basically stopped fluctuating, until the phototypesetting era. Which didn't really change the underlying assumptions either.

Printing Presses

Posted Aug 7, 2014 14:12 UTC (Thu) by rriggs (guest, #11598) [Link] (5 responses)

He made the comment that OpenType (and all of our font systems) have been influenced by printing presses going back to Gutenberg. If that is the case, how do printing presses work for the languages that he discusses? Surely the local press has a typography system that works.

I'd really like to see the lexical sorting rules for some of these scripts.

Printing Presses

Posted Aug 7, 2014 16:28 UTC (Thu) by n8willis (subscriber, #43041) [Link] (2 responses)

| Surely the local press has a typography system that works.

In a lot of cases, no they don't. They have, for instance, one font developed by a (typically) a British type foundry, and it is awkward and limited. It's a common topic for talks, actually: there was one about Korean at this event, others I've heard told similar stories about Indic languages. It's a problem (as with OpenType) of trying to shoehorn the writing system into the existing European metal type framework. Or else there is (with ideographic languages) a prohibitively gigantic investment required to cast the vast number of glyphs. Which is not a good system either.

Printing Presses

Posted Aug 8, 2014 23:43 UTC (Fri) by Sho (subscriber, #8956) [Link] (1 responses)

'Mechanizing Korean: The Evolution of Korean Typewriters' (2004) is an interesting text on mechanical typesetting for Hangul.

As a general primer on Hangul typography, this (quite recent) W3C publication is quite nice - it also touches on kerning: http://www.w3.org/TR/klreq/

Printing Presses

Posted Aug 8, 2014 23:47 UTC (Fri) by Sho (subscriber, #8956) [Link]

I should add: In practice there are very few software implementations that actually attempt to graphically compose Hangul morpho-syllabic blocks from individual characters. Unicode contains code points both for the individual characters and precomposed blocks (and a simple formula can yield the block codepoint from the letter code points); fonts usually support the latter, and the font stack goes for those glyphs.

Printing Presses

Posted Aug 9, 2014 9:00 UTC (Sat) by barryascott (subscriber, #80640) [Link] (1 responses)

In the Maldives the local paper was hand written in the 80's by an expert coligrapher, which took a couple of days working for 8 pages, I recall. The English edition use wordstar and took a hour or so.

Printing Presses

Posted Nov 11, 2015 6:33 UTC (Wed) by ttonino (guest, #4073) [Link]

With the invention of the printing press, Europe moved to box-type text layout. And now we do not know any better.

Addressing brokenness in OpenType

Posted Aug 7, 2014 23:01 UTC (Thu) by marcH (subscriber, #57642) [Link] (15 responses)

> And kerning, he said, inherits its basic model from Gutenberg's metal type, where only horizontal movement was possible.

It'd be interesting to learn how printing presses modified a few centuries ago the ways the Latin alphabet was used. Same question for Chinese logograms some time earlier.

Only example a very quick search could find: http://en.wikipedia.org/wiki/Emphasis_(typography)#Letter_spacing

I imagine there were already at the time some raging debates between calligraphy purists versus rough geeks only interested by the imperfect but new and fancy technologies... Plus ça change,...

Hopefully they also had at the time some LWN-like newsletter producing well informed and balanced articles ;-)

Addressing brokenness in OpenType

Posted Aug 8, 2014 23:52 UTC (Fri) by dlang (guest, #313) [Link] (3 responses)

> It'd be interesting to learn how printing presses modified a few centuries ago the ways the Latin alphabet was used.

That is exactly my thought.

The disruption between the beautiful, hand lettered books prior to Gutenberg and the "ugly approximation" provided by the printed press was considered very significant by many for a long time.

But languages using the Latin alphabet adapted to the new model, simplifying a bit in the process.

Nobody today would say that all english language websites and books should be rendered in 'proper' cursive, they would be considered far harder to read

It may be that the right thing in the long run is for the users of the various languages to adapt them to a simpler approach, the resources (both computer and mental) to handle the current mass of rules and exceptions could then be used for other things instead.

Addressing brokenness in OpenType

Posted Aug 9, 2014 0:21 UTC (Sat) by Sho (subscriber, #8956) [Link] (2 responses)

It goes beyond just typography, even. If you look at Chinese logographic/logosylabbic writing, there are a bunch of good reasons it's a historically successful meme: It allowed writing to serve as true lingua franca, by abstracting away a lot of regional pronunciation/dialect differences. And virtue of the fact that many of the characters do share common graphical elements if they're thematically linked (e.g. having the same "radical", which is indeed also frequently used for dictionary indexing), it can be easy to guess the meaning of an unknown character from context.

But you can't easily coin new character-words unless your medium allows free-form painting (and the stroke density of the characters is at odds with low-resolution displays regardless). Introducing new characters requires updating a central register, updated copies of which are then slow to trickle down to end-user systems. So what you're seeing now is that users of Chinese are inventing a new phonographic layer on top of the logographic one, coining new words by combining existing characters based on their sound value - things are majorly in flux.

Plus the writing system is no longer really independent; the most common way to type Chinese characters is to select among them by typing Pinyin (a romanization of spoken Chinese, i.e. using the Latin alphabet).

Contrast this with the Korean Hangul, which looks superficially similar. Hangul is a featural alphabet. It has only roughly as many letters as Latin, which are laid out together into morpho-syllabic blocks (i.e. each block is a syllable, but because of how well Korean phonotactics and Hangul go hand in hand, they frequently also happen to map to distinct morphemes). The design of the letters is simple - and it's featural, that is the shapes aren't arbitrary, but for example visualizations of tongue position or mouth shape required to make the sounds they represent (the velar consonant ㄱ, somewhere between the English g and k, is the tongue when sounding it out, seen from the side). The blocks do add complexity over Latin of course by adding a vertical axis, but fonts usually contain precomposed glyphs for them, and as a trade-off you e.g. don't have letter case to deal with.

Moreover, many of the characters are graphical derivatives of each other - a base shape "plus something extra". Add a little offshoot to the vowel ㅣ(i) and you get ㅏ (a). Add another and you get the iotized version ㅑ (ya). This makes Hangul really friendly to creating keyboards with small numbers of distinct keys: Korean cellphone keyboard layouts used to have the base vowel shapes and a "." key to stack on those little offshoots. Theory goes this is a reason texting took off over there, which might have been a factor in creating the a massive mobile industry the country enjoys now.

It's an example of two East Asian writing systems in active use that interact with modern technology in very different ways.

Addressing brokenness in OpenType

Posted Aug 9, 2014 0:36 UTC (Sat) by Sho (subscriber, #8956) [Link] (1 responses)

(I should know better than to write long comments when dead-tired: Crediting "phonotactics" for the high frequency of block=morpheme matches in written Korean is vague-to-incorrect, so don't go around remembering that - but it wasn't really critical to the overall thrust of the text anyway.)

Addressing brokenness in OpenType

Posted Aug 12, 2014 0:22 UTC (Tue) by sjj (guest, #2020) [Link]

Thanks anyway, tired or not. Very interesting reading.

Addressing brokenness in OpenType

Posted Aug 8, 2014 23:56 UTC (Fri) by Sho (subscriber, #8956) [Link]

There are some obvious broad-strokes changes, e.g. Chinese and Korean used to frequently be laid out in columns instead of rows. This has changed a lot, especially in Korean vertical writing has essentially disappeared for longer-form texts.

Then there's the emergence of sans-serif type faces designed for printing, often grouped together as the "East Asian Gothic" typefaces, as opposed to the "Ming" typefaces which resemble Chinese calligraphy more closely.

Addressing brokenness in OpenType

Posted Aug 14, 2014 12:33 UTC (Thu) by Wol (subscriber, #4433) [Link] (9 responses)

> It'd be interesting to learn how printing presses modified a few centuries ago the ways the Latin alphabet was used. Same question for Chinese logograms some time earlier.

Apparently one noticeable effect is the simplification of the alphabet. An obvious example is the disappearance of the letter "thorn" ( a Y with a line through it, like the yen symbol ). That's why you see on signs "Ye Olde ..." - it's the letter thorn, pronounced "th", so all these people who think "ye" with a y sound is an old pronunciation/spelling have got it wrong ... it's always been "the", but the spelling has changed because the necessary letter disappeared.

I don't know how many letters have disappeared, but a recent official casualty is the German double-ess, and another ancient casualty is the Welsh thorn, a d with a line through it.

Cheers,
Wol

Addressing brokenness in OpenType

Posted Aug 14, 2014 15:48 UTC (Thu) by HelloWorld (guest, #56129) [Link] (6 responses)

> I don't know how many letters have disappeared, but a recent official casualty is the German double-ess
Nonsense, the ß is still used in all german-speaking countries except Switzerland and Liechtenstein.

Addressing brokenness in OpenType

Posted Aug 14, 2014 23:27 UTC (Thu) by Wol (subscriber, #4433) [Link] (5 responses)

Hence my careful use of the word "official".

I don't know much about how German is officially spelt, whether it follows the English system of "dictionaries describe the language" or the French system of "The Academie Francaise defines the language", but the double-ess was officially removed from the German alphabet a couple of years back.

Just because it no longer officially exists, doesn't mean people don't use it. The letter thorn no longer exists in the English alphabet, but it's still widely used and recognised, and that was a change made 300 years ago!

Cheers,
Wol

Addressing brokenness in OpenType

Posted Aug 15, 2014 1:06 UTC (Fri) by mjg59 (subscriber, #23239) [Link]

"the double-ess was officially removed from the German alphabet a couple of years back"

No, it wasn't - http://en.wikipedia.org/wiki/%C3%9F#Current_usage_in_German .

Addressing brokenness in OpenType

Posted Aug 15, 2014 7:05 UTC (Fri) by spaetz (guest, #32870) [Link]

I can assure you that our beloved ß still officially exists and not using it will get you bad grades in school :-).

Addressing brokenness in OpenType

Posted Aug 15, 2014 20:08 UTC (Fri) by mpr22 (subscriber, #60784) [Link] (1 responses)

Um, I honestly can't remember the last time I saw a piece of Modern English prose that used thorn (it was probably, in fact, an LWN comment by the person who is also a great enthusiast for yogh, wynn, and long s), and England (never mind the other English-speaking countries!) is full of native speakers who wouldn't know what the letter thorn was if it jumped up and bit them on the arse.

Addressing brokenness in OpenType

Posted Aug 15, 2014 20:42 UTC (Fri) by sfeam (subscriber, #2841) [Link]

I think the point being made in the earlier post was that the "Y" in "Ye Olde Junke Shoppe" and other such tourist-trap signage is actually a thorn, or would be if modern sign painters knew to distinguish it from an upper-case "y".

Addressing brokenness in OpenType

Posted Aug 17, 2014 17:37 UTC (Sun) by Jandar (subscriber, #85683) [Link]

The only "official" German is specified for usage in schools and government, it doesn't apply otherwise. This was ruled by the Federal Constitutional Court of Germany. The German language is what the German people recognize as their language, a very free and open source model ☺.

There is an informal standard thru dictionaries, the most famous is Duden.

Addressing brokenness in OpenType

Posted Aug 17, 2014 17:14 UTC (Sun) by Jandar (subscriber, #85683) [Link]

> German double-ess

The German ß [ɛsˈt͜sɛt] (Unicode U+00DF) isn't a double-s but a ligature from a variant of s (long s) with z. If it isn't possible to write "ß" the substitution is "ss".

Addressing brokenness in OpenType

Posted Aug 20, 2014 14:20 UTC (Wed) by rschroev (subscriber, #4164) [Link]

Thorn has disappeared from most languages, but not all: it still exists in Icelandic (see https://en.wikipedia.org/wiki/Thorn_%28letter%29#Icelandic and https://en.wikipedia.org/wiki/Icelandic_language#Writing_...).

Addressing brokenness in OpenType

Posted Aug 8, 2014 0:05 UTC (Fri) by jpnp (guest, #63341) [Link] (3 responses)

I'm interested how much the graphite "smart font" system from SIL <http://scripts.sil.org/cms/scripts/page.php?site_id=proje...> addresses these limitations of OpenType. It sounds significantly more flexible than OpenType, and is open both in specification and implementation, with support for graphite fonts added to Firefox, LibreOffice and OpenOffice.

Addressing brokenness in OpenType

Posted Aug 9, 2014 10:10 UTC (Sat) by gioele (subscriber, #61675) [Link] (2 responses)

The problem with Graphite fonts is the usual "code in app vs. code in system library" tradeoff: in Graphite fonts most of the layout engine is _in_ the font and developed by the font author. In TrueType/OpenType the font carries almost only data and the rendering engine is mostly in the system library.

In TTF/OTF systems you write the layout engine once and it will work for all the fonts. And if you improve the engine all the fonts will be improved. But font designers are limited: they can use only the features described in the specifications of TTF/OTF.

In Graphite systems every font author must write their own layout engine and this gives the author a lot of freedom. However, did you find a bug in the layout engine? You cannot fix it, you must ask the font author to fix it.

Addressing brokenness in OpenType

Posted Aug 11, 2014 16:06 UTC (Mon) by jpnp (guest, #63341) [Link] (1 responses)

I see the trade off, but I'm not sure it's a big problem. Surely the way to get the flexibility required for these more complex orthographic systems _is_ to include more of the logic with the font.

The problem with having all the logic in the system library is that it can't be changed without standardising a new OpenType version then waiting for a critical mass of software/system libraries to upgrade their support.

Addressing brokenness in OpenType

Posted Aug 11, 2014 17:16 UTC (Mon) by nybble41 (subscriber, #55106) [Link]

There is another option besides hard-coded logic and "every font for itself": shared libraries. Of course, that brings along a whole new set of problems and trade-offs, library versioning in particular, but it would mean that fonts could have a maximum of flexibility in their layout logic while still benefiting from later improvements to the common library routines. Fonts could bundle the libraries they depend on for distribution (aside from ones defined by the standard), with the system choosing the most recent version from those available at runtime.


Copyright © 2014, Eklektix, Inc.
This article may be redistributed under the terms of the Creative Commons CC BY-SA 4.0 license
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds