W3C home > Mailing lists > Public > www-international@w3.org > January to March 2015

Experiments with font language support in browsers

From: Andrew Cunningham <andrewc@vicnet.net.au>
Date: Mon, 02 Mar 2015 17:51:18 +1100
Message-ID: <54F40866.4000600@vicnet.net.au>
To: www-international@w3.org
CC: "'acunningham@slv.vic.gov.au'" <acunningham@slv.vic.gov.au>
Hi all,

An experiment in CSS and fonts:

One of the things I have been thinking about lately is the best way to
develop a font for minority languages where the glyphs or glyph
positioning varies from the dominant languages. Traditionally we have
had to create separate fonts for each such language. For instance I
would need at least six Myanmar script fonts to adequately support the
range of languages that use the Myanmar script. Or three Latin fonts to
meet my usual language needs.

But how can we leverage Graphite and OpenType fonts on the web to
improve language support?

For a series of tests I started with a Latin and Cyrillic script font
that supported both graphite and opentype support via language systems
and also made this support available via other graphite or opentype

The above link is a fairly simplistic test. It uses various combinations
of language tagging (lang="vi"), and css combinations focusing on
font-feature-settings and font-langauge-override.

The preliminary results for current tests:


Correct rendering with
* lang="vi" AND font-feature-settings: "locl"; OR
* font-feature-settings: "cv75"


Correct rendering with:
* lang="vi"; OR
* -webkit-font-feature-settings: "cv75"


Correct rendering with:
* lang="vi"; OR
* -webkit-font-feature-settings: "cv75"

FIREFOX (with Graphite enabled)

Correct rendering with:
* lang="vi"; OR
* font-language-override: "vie"; OR
* font-feature-settings: "viet"

FIREFOX (with Graphite disabled)

Correct rendering with:
* lang="vi"; OR
* font-language-override: "vit"; OR
* font-feature-settings: "cv75"

Using just the lang attribute with a Graphite or OpenType font seems to
be sufficient, but this approach is hard wired into the browsers and
only supports a limited number of languages. It is not a scalable
solution. Additionally IE needs the OpenType "locl" feature explicitly
enabled for this approach to work.

font-language-override only works with Firefox and needs to be an exact
match. The OpenType and Graphite rules used different language codes to
identify the language system. OpenType has its own language system tag
registry. Graphite developers seem to prefer to use ISO-639-1/2/3
language tags

font-feature-settings appears to be the most flexible, and it is
possible to add graphite and opentype features together.

Obviously rules will be font specific.

Example rules used in a Devanagari test to provide Newari and Nepali
version of the digits:

:lang(new) {
font-language-override: "new";
-webkit-font-feature-settings: "ss11";
font-feature-settings: "ss11", "dig9" 2;
:lang(ne) {
font-language-override: "nep";
-webkit-font-feature-settings: "ss08", "ss09", "ss10";
font-feature-settings: "ss08", "ss09", "ss10", "dig5" 1, "dig8" 1, "dig9" 1;

I'd be interested in others thoughts and experiences.

And if there is an obvious fault in my logic, critiques are welcome.


Andrew Cunningham
Project Manager, Research and Development (Social and Digital Inclusion)
Public Libraries & Community Engagement
State Library of Victoria
328 Swanston Street
Melbourne VIC 3000

Ph: +61-3-8664-7430
Mobile: 0459-806-589
Fax: +61-3-9639-2175

Email: acunningham@slv.vic.gov.au
Alt. email: lang.support@gmail.com

Received on Monday, 2 March 2015 06:51:57 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 22:41:07 UTC