From 3478d8e504fe6d3cc0af6fd6060015525d6aaaca Mon Sep 17 00:00:00 2001 From: Jonathan Kew Date: Tue, 23 Dec 2014 12:50:10 +0000 Subject: [PATCH] Bug 1108616 - part 3 - Only do language-specific shaping when the language was explicitly tagged. r=jdaggett --- gfx/thebes/gfxFont.cpp | 6 ++++-- gfx/thebes/gfxGraphiteShaper.cpp | 2 +- gfx/thebes/gfxHarfBuzzShaper.cpp | 4 +++- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/gfx/thebes/gfxFont.cpp b/gfx/thebes/gfxFont.cpp index 1cd63fb32601..cb3940c0cfdb 100644 --- a/gfx/thebes/gfxFont.cpp +++ b/gfx/thebes/gfxFont.cpp @@ -2896,7 +2896,8 @@ gfxFont::InitFakeSmallCapsRun(gfxContext *aContext, } else if (ch != ToLowerCase(ch)) { // ch is upper case chAction = (aSyntheticUpper ? kUppercaseReduce : kNoChange); - if (mStyle.language == nsGkAtoms::el) { + if (mStyle.explicitLanguage && + mStyle.language == nsGkAtoms::el) { // In Greek, check for characters that will be modified by // the GreekUpperCase mapping - this catches accented // capitals where the accent is to be removed (bug 307039). @@ -2948,7 +2949,8 @@ gfxFont::InitFakeSmallCapsRun(gfxContext *aContext, TransformString(origString, convertedString, true, - mStyle.language, + mStyle.explicitLanguage + ? mStyle.language : nullptr, charsToMergeArray, deletedCharsArray); diff --git a/gfx/thebes/gfxGraphiteShaper.cpp b/gfx/thebes/gfxGraphiteShaper.cpp index 68c832d27e8a..a31b24cf850c 100644 --- a/gfx/thebes/gfxGraphiteShaper.cpp +++ b/gfx/thebes/gfxGraphiteShaper.cpp @@ -145,7 +145,7 @@ gfxGraphiteShaper::ShapeText(gfxContext *aContext, grLang = MakeGraphiteLangTag(style->languageOverride); } else if (entry->mLanguageOverride) { grLang = MakeGraphiteLangTag(entry->mLanguageOverride); - } else { + } else if (style->explicitLanguage) { nsAutoCString langString; style->language->ToUTF8String(langString); grLang = GetGraphiteTagForLang(langString); diff --git a/gfx/thebes/gfxHarfBuzzShaper.cpp b/gfx/thebes/gfxHarfBuzzShaper.cpp index f5dd79bb4fdc..1e28fab91015 100644 --- a/gfx/thebes/gfxHarfBuzzShaper.cpp +++ b/gfx/thebes/gfxHarfBuzzShaper.cpp @@ -1228,11 +1228,13 @@ gfxHarfBuzzShaper::ShapeText(gfxContext *aContext, language = hb_ot_tag_to_language(style->languageOverride); } else if (entry->mLanguageOverride) { language = hb_ot_tag_to_language(entry->mLanguageOverride); - } else { + } else if (style->explicitLanguage) { nsCString langString; style->language->ToUTF8String(langString); language = hb_language_from_string(langString.get(), langString.Length()); + } else { + language = hb_ot_tag_to_language(HB_OT_TAG_DEFAULT_LANGUAGE); } hb_buffer_set_language(buffer, language);