зеркало из https://github.com/mozilla/gecko-dev.git
b=569770 part 6: use font group style to look for language and CSS features r=jfkthame
--HG-- extra : rebase_source : afe0ed117ddb5df2fe450d7845131663b39e31d7
This commit is contained in:
Родитель
0c7b2ac318
Коммит
6b1cf3b243
|
@ -75,7 +75,6 @@ using namespace mozilla; // for AutoSwap_* types
|
|||
gfxHarfBuzzShaper::gfxHarfBuzzShaper(gfxFont *aFont)
|
||||
: gfxFontShaper(aFont),
|
||||
mHBFace(nsnull),
|
||||
mHBLanguage(nsnull),
|
||||
mKernTable(nsnull),
|
||||
mHmtxTable(nsnull),
|
||||
mNumLongMetrics(0),
|
||||
|
@ -781,18 +780,6 @@ gfxHarfBuzzShaper::InitTextRun(gfxContext *aContext,
|
|||
}
|
||||
hb_blob_destroy(hheaTable);
|
||||
}
|
||||
|
||||
if (mFont->GetStyle()->languageOverride) {
|
||||
mHBLanguage =
|
||||
hb_ot_tag_to_language(mFont->GetStyle()->languageOverride);
|
||||
} else if (mFont->GetFontEntry()->mLanguageOverride) {
|
||||
mHBLanguage =
|
||||
hb_ot_tag_to_language(mFont->GetFontEntry()->mLanguageOverride);
|
||||
} else {
|
||||
nsCString langString;
|
||||
mFont->GetStyle()->language->ToUTF8String(langString);
|
||||
mHBLanguage = hb_language_from_string(langString.get());
|
||||
}
|
||||
}
|
||||
|
||||
if (mCmapFormat <= 0 || (!mUseHintedWidths && !mHmtxTable)) {
|
||||
|
@ -826,8 +813,8 @@ gfxHarfBuzzShaper::InitTextRun(gfxContext *aContext,
|
|||
}
|
||||
|
||||
// css features need to be merged with the existing ones, if any
|
||||
const nsTArray<gfxFontFeature> *cssFeatures =
|
||||
mFont->GetStyle()->featureSettings;
|
||||
const gfxFontStyle *style = aTextRun->GetFontGroup()->GetStyle();
|
||||
const nsTArray<gfxFontFeature> *cssFeatures = style->featureSettings;
|
||||
if (!cssFeatures) {
|
||||
cssFeatures = mFont->GetFontEntry()->mFeatureSettings;
|
||||
}
|
||||
|
@ -859,7 +846,19 @@ gfxHarfBuzzShaper::InitTextRun(gfxContext *aContext,
|
|||
hb_buffer_set_script(buffer,
|
||||
aRunScript <= HB_SCRIPT_INHERITED ? HB_SCRIPT_LATIN
|
||||
: hb_script_t(aRunScript));
|
||||
hb_buffer_set_language(buffer, mHBLanguage);
|
||||
|
||||
hb_language_t language;
|
||||
if (style->languageOverride) {
|
||||
language = hb_ot_tag_to_language(style->languageOverride);
|
||||
} else if (mFont->GetFontEntry()->mLanguageOverride) {
|
||||
language =
|
||||
hb_ot_tag_to_language(mFont->GetFontEntry()->mLanguageOverride);
|
||||
} else {
|
||||
nsCString langString;
|
||||
style->language->ToUTF8String(langString);
|
||||
language = hb_language_from_string(langString.get());
|
||||
}
|
||||
hb_buffer_set_language(buffer, language);
|
||||
|
||||
hb_buffer_add_utf16(buffer, reinterpret_cast<const uint16_t*>(aString + aRunStart),
|
||||
aRunLength, 0, aRunLength);
|
||||
|
|
|
@ -91,9 +91,6 @@ protected:
|
|||
// harfbuzz face object, created on first use (caches font tables)
|
||||
hb_face_t *mHBFace;
|
||||
|
||||
// language to use for shaping, derived from the style's language
|
||||
hb_language_t mHBLanguage;
|
||||
|
||||
// Following table references etc are declared "mutable" because the
|
||||
// harfbuzz callback functions take a const ptr to the shaper, but
|
||||
// wish to cache tables here to avoid repeatedly looking them up
|
||||
|
@ -121,9 +118,6 @@ protected:
|
|||
// Whether the font implements hinted widths, or we should read tables
|
||||
// directly to get ideal widths
|
||||
PRBool mUseHintedWidths;
|
||||
|
||||
// Features to apply in addition to the defaults built into the shaper
|
||||
const nsTArray<hb_feature_t> *mOpenTypeFeatures;
|
||||
};
|
||||
|
||||
#endif /* GFX_HARFBUZZSHAPER_H */
|
||||
|
|
|
@ -2255,7 +2255,7 @@ gfxFcFont::GetOrMakeFont(FcPattern *aRequestedPattern, FcPattern *aFontPattern)
|
|||
size, language, 0.0,
|
||||
PR_TRUE, PR_FALSE, PR_FALSE,
|
||||
NS_LITERAL_STRING(""),
|
||||
NS_LITERAL_STRING("")); // TODO: no opentype feature support here yet
|
||||
NS_LITERAL_STRING(""));
|
||||
|
||||
// Note that a file/index pair (or FT_Face) and the gfxFontStyle are
|
||||
// not necessarily enough to provide a key that will describe a unique
|
||||
|
|
Загрузка…
Ссылка в новой задаче