Some Turkish symbols have display issues#3369
Conversation
|
Assigning to @sathomas for investigation |
|
One thing I notice right away is that we're only serving Web Open Font Format ( |
|
BTW, any reason for not serving the Open Sans font directly from Google web fonts instead of hosting it ourselves? Google's font loader is pretty sophisticated about picking the best format for the user's browser (e.g. although |
|
It does indeed appear to be an issue with the font. The version of Open Sans that we're serving only includes character sets for (some) Latin languages (234 glyphs). The complete Open Sans font from Adobe has more extended character sets, including some for Cyrillic and Greek languages (for a total of 938 glyphs). Alas, I'm ignorant of the Turkish language, but I would guess it includes characters from Latin languages not fully represented in our current subset (e.g. South Eastern European) or perhaps some characters borrowed from Cyrillic or Greek. Updating to the full font would probably address this issue, but there isn't a complete guarantee. (For example, the full font from Adobe includes the entire basic Greek character set, but not the Polytonic or Coptic characters.) In any case, it's presumably the best we can do. Note that the upgrade will definitely increase the size of our assets. The 10 font variations we're currently hosting take up about 250 KB. Moving to the full font would increase that to about 1 MB. (TrueType fonts are about 10x larger, so if we add If we need to support Android 2.x devices (with 4 MB browser cache), we might want to consider an adaptive approach where we only serve extended language versions when needed (based on HTTP Accept-Language and then accounting for user preferences). FWIW, Android 2.x is currently about 25% of the Android market. |
|
Re: my last comment Actually, we can use the css Also, we'll want to verify that Android 2.x only loads font assets that are actually needed by the page content. I'm pretty sure that's the case, but not certain. I'd hate to go to the trouble only to find out that Android was opportunistically pre-loading all fonts referenced in the style sheets. |
|
Another option: Continue to use the existing Open Sans subset for Western European languages but fall back to a standard font stack (e.g. "Arial, Helvetica, sans-serif") for others. |
|
Open Sans is almost identical to Droid Sans, is there any way we can tap |
|
Sure. We could put Droid Sans at the head of our font stack. We could also switch from Open Sans to Droid Sans for all browsers. Droid Sans Pro includes the same character sets as the full Adobe Open Sans. Android browsers would avoid having to download any fonts, while all other browsers would see the same behavior as today, albeit with a (slightly) different visual result. Note, though, that Droid Sans Pro is only available in two weights, Regular and Bold. Open Sans is available in ten weights (add Light, SemiBold, and ExtraBold, plus italic versions of all). We're currently serving all 10 weights of Open Sans, though it's not clear how many we're actually using (or intend to use). Also, for some inexplicable reason, Google Web Fonts only offers the non-Pro version of Droid Sans, and that version omits the extra character sets needed, e.g., for Turkish. I want to research this a bit more. Maybe there's some licensing issue that would affect us as well. |
|
A quick check shows that we're currently using all 10 weights/styles of Open Sans. That probably rules out Droid Sans as an option, except possibly as a last resort for Andoid only.. |
|
@sathomas : I don't remember exactly as to why we have taken a local copy of the Font instead of serving from Google directly. I'm assuming it was related to production builds and being able to concatenate everything together to reduce the total number of requests. However, I'm not against serving this from Google, especially if it can help the issues we're seeing. Can you investigate what the page size implications are when switching to serving from Google web fonts ? Also, can you explain how the css |
We did try to inline, then backed out because there was too much duplication and the static assets were huge, so we went back to not inlining. So this very well may be the case. I haven't heard any consideration of using the google-hosted stuff though. |
|
Will definitely take a look at using Google. There are a couple of ways I can think of for using Here's a really quick example that I haven't thought through completely (so it may be a really bad idea). But it shows the general idea.
There are plenty of other variations (e.g. "Open Sans" for Western European, "Open Sans Extended" for other languages). In theory, the browser will only download fonts that it actually needs, but that (among other things) should be tested. |
Browser Support of Font FormatsNearly all browsers support Web Open Font Format Font Format(s) Provided by Google Web FontsWhen a web page requests fonts hosted by Google Web Fonts, the service provides different font formats based on the browser's user agent string. The algorithm for selecting the format(s) appears to be:
Character SetsThe OAE currently uses a basic subset of the full Open Sans character set. That basic subset contains 234 glyphs and generally supports only Western European languages. The full Open Sans character set contains 938 glyphs and supports many additional languages. The OAE currently hosts local copies of the Open Sans fonts and delivers those fonts from its own server. Were OAE to switch to accessing the fonts via Google Web Fonts, it could still elect to use only the basic subset. It could also use the full character set or any of a number of other subsets and combinations. Font SizesThe OAE style sheets currently reference all five available Open Sans weights: Light (300), Normal (400), Semi-Bold (600), Bold (700), and Extra-Bold (800). The exact fonts in use on any OAE page will depend on which CSS styles are active on that page, but it would be possible for a single page to use all five weights and their italic (technically, oblique) styles. The following data assumes all 10 font faces are in use. The following table lists the file sizes (in KB) of the different font formats for both the basic and full character sets. The table shows both native TrueType file sizes and TrueType files compressed with
From the table, changing from the basic subset to the full character set increases the font size by about a factor of 4. Uncompressed TrueType fonts are about twice the size of other font formats. |
Font Recommendations and OptionsHere are some of the main options available. Various permutations of the approaches below are also possible.
1. Use Google Web Fonts instead of local hosting and reference the full Open Sans character set.Advantages:
Disadvantages:
2. Locally host Open Sans .woff and .ttf formats and provide full character set only to non-Western European usersAdvantages:
Disadvantages:
3. Use Google Web Fonts basic character subset only, defaulting non-Western European users to sans-serifAdvantages:
Disadvantages:
4. Use Google Web Fonts basic character subset, locally hosted extended character set, and default older Android devices to sans-serifAdvantages:
Disadvantages:
As an additional optimization if OAE locally hosts Open Sans, it can rename the web font version(s) (e.g. to "Open Sans Web") and add the standard name ("Open Sans") to the front of the font stack. Users that happen to have Open Sans installed locally will then use their local copy instead of the web font, eliminating the network bandwidth and latency of the font download. |
|
Do we need all the different weights? I had a quick browse through the app and I couldn't see more than 2 opensans font at page load and then 3 extra that got lazily loaded. Having to fetch all 10 fonts on page load seems like an absolute worst-case scenario. Doing a bunch of work that will need to be maintained (ie: every time we add a new language) seems a bit cumbersome for something that seems like an edge-case? I'd like to see the impact of simply using Google's font CDN as:
|
|
I forgot to mention that it also supports ~800 characters rather than the ~250 we currently support |
|
I was very concerned about having to download megabytes of fonts on the first page load. However, if the browsers lazy load them, I see no reason for not using Google's font CDN. Lets go ahead and switch to that. |
|
There is some indication that IE9 downloads all the @font-faced fonts as per Paul Irish [1] but I don't have a VM to try it out in. IE10 doesn't seem to suffer from this problem. You can try it out at [2] [1] http://www.paulirish.com/2009/fighting-the-font-face-fout/#update2011 |
There was a problem hiding this comment.
I think we need this to be // to make sure that OAE and the downloaded font are using the same protocol and avoid unsafe content messages.
|
When I run the production build on this branch, it doesn't seem to import the google's font CSS although it is in the minified file ( http://cl.ly/code/1S120h2s3X3F ) We'll probably also want to add |
|
FWIWI: It's not loading the google CSS file because the @import rule is not the first rule in the (minified) file |
|
Here are the CSS selectors that specify a font weight other than normal (400) or bold (700): In In In In In In |
|
The current styles do tend to use 600 (semibold) weight a fair bit, and there is a definite difference between it: and true bold (700): A font weight of 200 is also commonly used. Since there is no 200 weight for Open Sans, browsers are presumably substituting the closest (300) weight. Again, there is a definite difference between 300 and normal (400): It does seem like we don't need to include the extra bold (800) variant when requesting the fonts from Google |
|
I think this is about the best we can do without either:
In the worst case (Android browser, Western European user) we're adding about an extra 600 KB to the page load |
|
@sathomas: Is there more work you'd like to do here or is this ready to be merged? |
|
Ready for merging. If we do decide to modify the design or take on responsibility of managing fonts with translations, we can re-visit. Also, keep an eye out for Vietnamese translations. If/when that happens, we'll have to add the Vietnamese character set. |
|
@sathomas : Can you submit this PR against the bootstrap branch? |
|
Closed in favor of #3556 |






Some of the characters in
İçeriğe erişimare more bold than the others. Perhaps we're missing something in the Open Sans font we're using.