Index: content/browser/renderer_host/render_sandbox_host_linux.cc |
=================================================================== |
--- content/browser/renderer_host/render_sandbox_host_linux.cc (revision 258675) |
+++ content/browser/renderer_host/render_sandbox_host_linux.cc (working copy) |
@@ -407,7 +407,7 @@ |
} |
FcLangSet* langset = FcLangSetCreate(); |
- MSCharSetToFontconfig(langset, charset); |
+ bool is_english = MSCharSetToFontconfig(langset, charset); |
FcPattern* pattern = FcPatternCreate(); |
// TODO(agl): FC_FAMILy needs to change |
@@ -415,16 +415,18 @@ |
reinterpret_cast<const FcChar8*>(face.c_str())); |
std::string generic_font_name; |
- switch (fallback_family) { |
- case PP_BROWSERFONT_TRUSTED_FAMILY_SERIF: |
- generic_font_name = "Times New Roman"; |
- break; |
- case PP_BROWSERFONT_TRUSTED_FAMILY_SANSSERIF: |
- generic_font_name = "Arial"; |
- break; |
- case PP_BROWSERFONT_TRUSTED_FAMILY_MONOSPACE: |
- generic_font_name = "Courier New"; |
- break; |
+ if (is_english) { |
jungshik at Google
2014/03/27 11:06:11
Can we access Chrome's per-script font pref here?
Lei Zhang
2014/03/27 19:31:25
I don't know. Added a TODO. Will investigate in th
|
+ switch (fallback_family) { |
+ case PP_BROWSERFONT_TRUSTED_FAMILY_SERIF: |
+ generic_font_name = "Times New Roman"; |
+ break; |
+ case PP_BROWSERFONT_TRUSTED_FAMILY_SANSSERIF: |
+ generic_font_name = "Arial"; |
+ break; |
+ case PP_BROWSERFONT_TRUSTED_FAMILY_MONOSPACE: |
+ generic_font_name = "Courier New"; |
+ break; |
+ } |
} |
if (!generic_font_name.empty()) { |
const FcChar8* fc_generic_font_name = |
@@ -547,7 +549,7 @@ |
// MSCharSetToFontconfig translates a Microsoft charset identifier to a |
// fontconfig language set by appending to |langset|. |
- static void MSCharSetToFontconfig(FcLangSet* langset, unsigned fdwCharSet) { |
+ static bool MSCharSetToFontconfig(FcLangSet* langset, unsigned fdwCharSet) { |
// We have need to translate raw fdwCharSet values into terms that |
// fontconfig can understand. (See the description of fdwCharSet in the MSDN |
// documentation for CreateFont: |
@@ -566,6 +568,7 @@ |
// So, for each of the documented fdwCharSet values I've had to take a |
// guess at the set of ISO 639-1 languages intended. |
+ bool is_english = false; |
jungshik at Google
2014/03/27 11:06:11
Perhaps, it'd be better to change change |is_engli
Lei Zhang
2014/03/27 19:31:25
Done.
|
switch (fdwCharSet) { |
case NPCharsetAnsi: |
// These values I don't really know what to do with, so I'm going to map |
@@ -574,6 +577,7 @@ |
case NPCharsetMac: |
case NPCharsetOEM: |
case NPCharsetSymbol: |
+ is_english = true; |
FcLangSetAdd(langset, reinterpret_cast<const FcChar8*>("en")); |
break; |
case NPCharsetBaltic: |
@@ -582,12 +586,11 @@ |
FcLangSetAdd(langset, reinterpret_cast<const FcChar8*>("lv")); |
FcLangSetAdd(langset, reinterpret_cast<const FcChar8*>("lt")); |
break; |
- // TODO(jungshik): Would we be better off mapping Big5 to zh-tw |
- // and GB2312 to zh-cn? Fontconfig has 4 separate orthography |
- // files (zh-{cn,tw,hk,mo}. |
case NPCharsetChineseBIG5: |
+ FcLangSetAdd(langset, reinterpret_cast<const FcChar8*>("zh-tw")); |
+ break; |
case NPCharsetGB2312: |
- FcLangSetAdd(langset, reinterpret_cast<const FcChar8*>("zh")); |
+ FcLangSetAdd(langset, reinterpret_cast<const FcChar8*>("zh-cn")); |
break; |
case NPCharsetEastEurope: |
// A scattering of eastern European languages. |
@@ -631,6 +634,7 @@ |
// Don't add any languages in that case that we don't recognise the |
// constant. |
} |
+ return is_english; |
} |
void SendRendererReply(const std::vector<int>& fds, const Pickle& reply, |