{"id":160,"date":"2010-01-31T20:04:12","date_gmt":"2010-01-31T09:04:12","guid":{"rendered":"http:\/\/xhva.net\/log\/?p=160"},"modified":"2010-01-31T20:47:24","modified_gmt":"2010-01-31T09:47:24","slug":"all-you-never-wanted-to-know-about-browser-generic-font-family-fallbacks","status":"publish","type":"post","link":"https:\/\/xhva.net\/log\/2010\/01\/all-you-never-wanted-to-know-about-browser-generic-font-family-fallbacks\/","title":{"rendered":"All you never wanted to know about browser generic font family fallbacks"},"content":{"rendered":"<p>I recent\u00adly need\u00aded to know exact\u00adly what fonts desk\u00adtop browsers use in the case of gener\u00adic font fam\u00adi\u00adlies. Get\u00adting this info for mul\u00adti\u00adple plat\u00adforms and lan\u00adguages is actu\u00adal\u00adly pret\u00adty dif\u00adfi\u00adcult unless you enjoy sift\u00ading through sev\u00ader\u00adal dif\u00adfer\u00adent source trees in sev\u00ader\u00adal dif\u00adfer\u00adent source viewers.<\/p>\n<p>Locales are gen\u00ader\u00adal\u00adly expressed as two-let\u00adter lan\u00adguage codes (\u2018en\u2019 for Eng\u00adlish, \u2018ar\u2019 for Ara\u00adbic), some\u00adtimes with an addi\u00adtion\u00adal two-let\u00adter code for region or deriv\u00ada\u00adtive (\u2018en-GB\u2019 for British Eng\u00adlish, \u2018zh-CN\u2019 for Sim\u00adpli\u00adfied Chi\u00adnese). A good ref\u00ader\u00adence is the the <a href=\"http:\/\/download1.swsoft.com\/Plesk\/Plesk8.2\/Doc\/plesk-8.2-win-l10n-guide\/39382.htm\">Plesk Locale Codes doc<\/a>.<\/p>\n<p><a href=\"#matrix\">Skip to the matrix if you\u2019re just after en-US defaults.<\/a><\/p>\n<h3>Mozilla<\/h3>\n<p>Prob\u00ada\u00adbly the eas\u00adi\u00adest to read is Mozil\u00adla\u2019s prefs file, sim\u00adply because it\u2019s all in one place. It\u2019s grouped into plat\u00adform then locale. For exam\u00adple, <code>pref(\"font.name.serif.ja\", \"?? ???\")<\/code> spec\u00adi\u00adfies the serif font for Japanese.<\/p>\n<p>Note that these may not be the defaults in all Mozil\u00adla-derived browsers<\/p>\n<ul>\n<li><a href=\"http:\/\/mxr.mozilla.org\/mozilla-central\/source\/modules\/libpref\/src\/init\/all.js#1253\">Win\u00addows&nbsp;fonts<\/a><\/li>\n<li><a href=\"http:\/\/mxr.mozilla.org\/mozilla-central\/source\/modules\/libpref\/src\/init\/all.js#1654\">Mac fonts<\/a><\/li>\n<li><a href=\"http:\/\/mxr.mozilla.org\/mozilla-central\/source\/modules\/libpref\/src\/init\/all.js#2078\">OS\/2 fonts<\/a> (also see note in source about name remap\u00adping which may affect you).<\/li>\n<li><a href=\"http:\/\/mxr.mozilla.org\/mozilla-central\/source\/modules\/libpref\/src\/init\/all.js#2281\">BeOS fonts<\/a> include only basic map\u00adping to a gener\u00adic fam\u00adi\u00adly (remapped by the OS to a locale-spe\u00adcif\u00adic&nbsp;font?).<\/li>\n<li><a href=\"http:\/\/mxr.mozilla.org\/mozilla-central\/source\/modules\/libpref\/src\/init\/all.js#2442\">Unix\/Linux fonts<\/a> include only basic map\u00adping to a gener\u00adic font (remapped by the OS to a locale-spe\u00adcif\u00adic or sys\u00adtem-pref\u00ader\u00adence font?) This could mean a vari\u00adety of defaults depend\u00ading on the unix deriv\u00ada\u00adtive, dis\u00adtro, win\u00addow sys\u00adtem, graph\u00adi\u00adcal envi\u00adron\u00adment and god knows what else (please cor\u00adrect me if I\u2019m&nbsp;wrong).<\/li>\n<\/ul>\n<h3>Chrome<\/h3>\n<p>Chrome breaks down font defaults into a gener\u00adic plat\u00adform file then spe\u00adcif\u00adic over\u00adride files. They fol\u00adlow a nam\u00ading con\u00adven\u00adtion using the locale codes above. Files are in XML, thus need\u00adless\u00adly ver\u00adbose and hard to skim. Look for <code>&lt;message name=\"IDS_SERIF_FONT_FAMILY\" use_name_for_id=\"true\"&gt;Times New Roman&lt;\/message&gt;<\/code> at the bot\u00adtom of gener\u00adic files and <code>&lt;translation id=\"IDS_SERIF_FONT_FAMILY\"&gt;Tahoma&lt;\/translation&gt;<\/code> in the overrides.<\/p>\n<ul>\n<li><a href=\"http:\/\/src.chromium.org\/viewvc\/chrome\/trunk\/src\/chrome\/app\/resources\/locale_settings_win.grd?view=markup\">Win\u00addows fonts (gener\u00adic)<\/a><\/li>\n<li><a href=\"http:\/\/src.chromium.org\/viewvc\/chrome\/trunk\/src\/chrome\/app\/resources\/locale_settings_mac.grd?view=markup\">Mac fonts (gener\u00adic)<\/a><\/li>\n<li><a href=\"http:\/\/src.chromium.org\/viewvc\/chrome\/trunk\/src\/chrome\/app\/resources\/locale_settings_linux.grd?view=markup\">Lin\u00adux fonts (gener\u00adic)<\/a>. As at 2010\/01\/31 this looks iden\u00adti\u00adcal to the Win\u00addows defaults.<\/li>\n<li><a href=\"http:\/\/src.chromium.org\/viewvc\/chrome\/trunk\/src\/chrome\/app\/resources\/platform_locale_settings\/\">Plat\u00adform and local spe\u00adcif\u00adic over\u00adrides<\/a>. All locales are includ\u00aded, but only some have over\u00adrides, eg. zh-CN. There are at least four pages of over\u00adride files, so be sure to use the select box at the top to move between pages (there\u2019s no next\/prev links).<\/li>\n<\/ul>\n<h3>Safari\/Webkit<\/h3>\n<p>Unlike the browsers above, Safari itself isn\u2019t open source and so it\u2019s hard to get a defin\u00adi\u00adtive list out\u00adside of West\u00adern locales. Webkit (the under\u00adly\u00ading engine that <strong>is<\/strong> open source) has these en-US defaults hard&nbsp;coded:<\/p>\n<ul>\n<li><a href=\"http:\/\/trac.webkit.org\/browser\/trunk\/WebKit\/win\/WebPreferences.cpp#L188\">Win\u00addows&nbsp;fonts<\/a><\/li>\n<li><a href=\"http:\/\/trac.webkit.org\/browser\/trunk\/WebKit\/mac\/WebView\/WebPreferences.mm#L297\">Mac fonts<\/a><\/li>\n<li><a href=\"http:\/\/trac.webkit.org\/browser\/trunk\/WebKit\/qt\/Api\/qwebsettings.cpp#L375\">QT fonts<\/a> (I\u2019m not sure what project they\u2019re used for, so infor\u00adma\u00adtion is welcome).<\/li>\n<li><a href=\"http:\/\/trac.webkit.org\/browser\/trunk\/WebKit\/gtk\/webkit\/webkitwebsettings.cpp#L805\">GTK<\/a> (again, seems to use a val\u00adue from some\u00adwhere&nbsp;else).<\/li>\n<\/ul>\n<p><strong>Stat\u00ading the obvi\u00adous but rel\u00ade\u00advant:<\/strong> Webkit has been port\u00aded to a legion of devices and plat\u00adforms now, each with their own fron\u00adtend capa\u00adble of chang\u00ading the default gener\u00adic fonts (espe\u00adcial\u00adly in the case of mobile where only one font may be avail\u00adable). Fire\u00adfox for Win\u00addows Mobile and <a href=\"http:\/\/www.opera.com\/mini\/help\/faq\/#characters\">Opera Mini<\/a> are in the same boat. Deter\u00admin\u00ading the default gener\u00adic fonts for these plat\u00adforms is arguably pointless.<\/p>\n<h3>Opera<\/h3>\n<p>This one\u2019s pure\u00adly from obser\u00adva\u00adtion of a local install on an \u2018en-AU\u2019 Win\u00addows machine (like\u00adly iden\u00adti\u00adcal to any oth\u00ader \u2018en\u2019 install). I\u2019m unable to check the defaults for any oth\u00ader plat\u00adform&nbsp;atm.<\/p>\n<ul>\n<li>Serif: Times New&nbsp;Roman<\/li>\n<li>Sans-serif: Ari\u00adal<\/li>\n<li>Mono\u00adspace: Couri\u00ader&nbsp;New<\/li>\n<li>Cur\u00adsive: Com\u00adic Sans&nbsp;MS<\/li>\n<li>Fan\u00adta\u00adsy:&nbsp;Arial<\/li>\n<\/ul>\n<p><em>Note that the orig\u00adi\u00adnal 10.0 release had a bug that did funky stuff to cur\u00adsive and fan\u00adta\u00adsy. Fixed in 10.1.<\/em><\/p>\n<h3>Internet Explorer<\/h3>\n<p>The tru\u00adly prob\u00adlem\u00adat\u00adic one.  I don\u2019t have the first idea how to gath\u00ader this infor\u00adma\u00adtion with\u00adout access to the region\u00adal build and OS. Infor\u00adma\u00adtion is wel\u00adcome! On my \u2018en-AU\u2019 WinXP machine IE6 through 8 default to:<\/p>\n<ul>\n<li>Serif: Times New&nbsp;Roman<\/li>\n<li>Sans-serif: Ari\u00adal<\/li>\n<li>Mono\u00adspace: Couri\u00ader&nbsp;New<\/li>\n<li>Cur\u00adsive: Com\u00adic Sans&nbsp;MS<\/li>\n<li>Fan\u00adta\u00adsy: Algerian<\/li>\n<\/ul>\n<h3 id=\"matrix\">A quick font matrix for&nbsp;en-US<\/h3>\n<p>Browsers across the top head\u00ader row, and font fam\u00adi\u00adlies down the first col\u00adumn. Where a font dif\u00adfers from oth\u00ader browsers, it has been high\u00adlight\u00aded and bolded.<\/p>\n<h4>Windows<\/h4>\n<table class=\"data\">\n<thead>\n<tr>\n<th><\/th>\n<th>Mozil\u00adla<\/th>\n<th>Safari<\/th>\n<th>Chrome<\/th>\n<th>Opera<\/th>\n<th>IE<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<th>Serif<\/th>\n<td>times new&nbsp;roman<\/td>\n<td>times new&nbsp;roman<\/td>\n<td>times new&nbsp;roman<\/td>\n<td>times new&nbsp;roman<\/td>\n<td>times new&nbsp;roman<\/td>\n<\/tr>\n<tr>\n<th>Sans-serif<\/th>\n<td>ari\u00adal<\/td>\n<td>ari\u00adal<\/td>\n<td>ari\u00adal<\/td>\n<td>ari\u00adal<\/td>\n<td>ari\u00adal<\/td>\n<\/tr>\n<tr>\n<th>Mono\u00adspace<\/th>\n<td>couri\u00ader&nbsp;new<\/td>\n<td>couri\u00ader&nbsp;new<\/td>\n<td>couri\u00ader&nbsp;new<\/td>\n<td>couri\u00ader&nbsp;new<\/td>\n<td>couri\u00ader&nbsp;new<\/td>\n<\/tr>\n<tr>\n<th>Cur\u00adsive<\/th>\n<td>com\u00adic sans&nbsp;ms<\/td>\n<td>com\u00adic sans&nbsp;ms<\/td>\n<td>com\u00adic sans&nbsp;ms<\/td>\n<td>com\u00adic sans&nbsp;ms<\/td>\n<td>com\u00adic sans&nbsp;ms<\/td>\n<\/tr>\n<tr>\n<th>Fan\u00adta\u00adsy<\/th>\n<td><strong style=\"color:white\">microsoft sans&nbsp;serif<\/strong><\/td>\n<td><strong style=\"color:white\">impact<\/strong><\/td>\n<td><strong style=\"color:white\">com\u00adic sans&nbsp;ms<\/strong><\/td>\n<td><strong style=\"color:white\">ari\u00adal<\/strong><\/td>\n<td><strong style=\"color:white\">alger\u00adian<\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h4>Mac<\/h4>\n<table class=\"data\">\n<thead>\n<tr>\n<th><\/th>\n<th>Mozil\u00adla<\/th>\n<th>Safari<\/th>\n<th>Chrome<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<th>Serif<\/th>\n<td>times<\/td>\n<td>times<\/td>\n<td>times<\/td>\n<\/tr>\n<tr>\n<th>Sans-serif<\/th>\n<td>hel\u00adveti\u00adca<\/td>\n<td>hel\u00adveti\u00adca<\/td>\n<td>hel\u00adveti\u00adca<\/td>\n<\/tr>\n<tr>\n<th>Mono\u00adspace<\/th>\n<td>couri\u00ader<\/td>\n<td>couri\u00ader<\/td>\n<td>couri\u00ader<\/td>\n<\/tr>\n<tr>\n<th>Cur\u00adsive<\/th>\n<td>apple chancery<\/td>\n<td>apple chancery<\/td>\n<td>apple chancery<\/td>\n<\/tr>\n<tr>\n<th>Fan\u00adta\u00adsy<\/th>\n<td>papyrus<\/td>\n<td>papyrus<\/td>\n<td>papyrus<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>No one uses Fan\u00adta\u00adsy appar\u00adent\u00adly, and I can\u2019t help but think that Apple used Com\u00adic Sans MS twice as a state\u00adment about the Win\u00addows aesthetic.<\/p>\n<p>If you\u2019re a brows\u00ader dev with more info or if your results con\u00adflict, please let me&nbsp;know.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I recent\u00adly need\u00aded to know exact\u00adly what fonts desk\u00adtop browsers use in the case of gener\u00adic font fam\u00adi\u00adlies. Get\u00adting this info for mul\u00adti\u00adple plat\u00adforms and lan\u00adguages is actu\u00adal\u00adly pret\u00adty dif\u00adfi\u00adcult unless you enjoy sift\u00ading through sev\u00ader\u00adal dif\u00adfer\u00adent source trees in sev\u00ader\u00adal dif\u00adfer\u00adent source view\u00aders. Locales are gen\u00ader\u00adal\u00adly expressed as two-let\u00adter lan\u00adguage codes (\u2018en\u2019 for English,&nbsp;[\u2026]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"wp_typography_post_enhancements_disabled":false,"ngg_post_thumbnail":0},"categories":[1],"tags":[],"_links":{"self":[{"href":"https:\/\/xhva.net\/log\/wp-json\/wp\/v2\/posts\/160"}],"collection":[{"href":"https:\/\/xhva.net\/log\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/xhva.net\/log\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/xhva.net\/log\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/xhva.net\/log\/wp-json\/wp\/v2\/comments?post=160"}],"version-history":[{"count":12,"href":"https:\/\/xhva.net\/log\/wp-json\/wp\/v2\/posts\/160\/revisions"}],"predecessor-version":[{"id":172,"href":"https:\/\/xhva.net\/log\/wp-json\/wp\/v2\/posts\/160\/revisions\/172"}],"wp:attachment":[{"href":"https:\/\/xhva.net\/log\/wp-json\/wp\/v2\/media?parent=160"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/xhva.net\/log\/wp-json\/wp\/v2\/categories?post=160"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/xhva.net\/log\/wp-json\/wp\/v2\/tags?post=160"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}