- From: John Daggett <jdaggett.lists@gmail.com>
- Date: Thu, 6 Mar 2014 09:41:08 +0900
- To: Martin J. Dürst <duerst@it.aoyama.ac.jp>
- Cc: John Holt Ripley <john.holtripley@googlemail.com>, www-international@w3.org
- Message-ID: <CAD3vw5Uw0pD7x8N9_MnoUWz-k_eOeMGj3zpYD+zJVr=ee5S4gg@mail.gmail.com>
Martin Dürst wrote: >> Is there a specification that details how a browser should determine >> which font to use for any given Unicode codepoint, or is it up to >> vendors to determine it themselves? > > I think that as far as Web pages go, some of it is defined in the > relevant CSS specifications. Specifically, the CSS3 Fonts specification defines the behavior here. See section 5.2 on font matching: http://www.w3.org/TR/css3-fonts/#font-style-matching Step 7: If there are no more font families to be evaluated and no matching face has been found, then the user agent performs a system font fallback procedure to find the best match for the character to be rendered. The result of this procedure may vary across user agents. So system font fallback is determined by a given implementation, using the fonts available and the particular platform font API's it's using. > My understanding is that a browser will run through the fonts > specified in the font-family declaration until it finds one that has > that glyph. If not it looks at its own preferences, and then a > system fallback font. I'd like to understand why the same page on > the same machine would support Unicode characters differently in two > different browsers, if both could use the same system fallback font. There isn't a single, all-inclusive fallback font for all Unicode characters. So user agents need to figure out how to dig up a font for a given character using whatever underlying platform font API is available (or not!). In Firefox alone we use GDI or DirectWrite API's on Windows, CoreText on OSX and fontconfig on Linux. For system font fallback, Firefox first checks common default fonts for a given script, then it uses a list of common fallback fonts for each platform and then it tries to use a platform font API to lookup a font. We put a lot of effort into making this as fast and efficient as possible, as do other browsers. As I mentioned to you on Twitter [1], I think you really need to focus your question a little more. System font fallback for Unicode characters is a wide-ranging subject, the details of color emoji, characters in scripts that require complex shaping and things like combining diacritics and variation selectors lead to all sorts of complex, subtle rules that are dictated by available fonts and platform font API. >From the pages you linked to [2], it looks like you're primarily interested in fallback for symbol characters and emoji. Here you should understand that there isn't a standard color emoji font format. Apple has one, Microsoft has one and Google has one. This is currently under discussion by the folks working on the OpenType spec. So implementations may or may not support a particular color emoji format available on a given platform. Emoji fonts often support both a standard outline glyph along with a color glyph, so you may see variations for the same font across browsers. Cheers, John Daggett Mozilla Japan [1] https://twitter.com/nattokirai/status/440035031189164032 [2] http://unicode.johnholtripley.co.uk/all/
Received on Monday, 10 March 2014 10:23:44 UTC