mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-03-01 05:48:26 +00:00
Bug 395866 font fallback does not respect stylesheet font list r=vlad, b1.9=stuart
This commit is contained in:
parent
ae36f23f23
commit
556d3b4dc6
@ -128,6 +128,8 @@ public:
|
||||
|
||||
gfxAtsuiFont* FindFontFor(ATSUFontID fid);
|
||||
|
||||
PRBool HasFont(ATSUFontID fid);
|
||||
|
||||
protected:
|
||||
static PRBool FindATSUFont(const nsAString& aName,
|
||||
const nsACString& aGenericName,
|
||||
|
@ -429,7 +429,7 @@ gfxAtsuiFontGroup::gfxAtsuiFontGroup(const nsAString& families,
|
||||
GetOrMakeFont(fontID, aStyle, &mFonts);
|
||||
}
|
||||
|
||||
CreateFontFallbacksFromFontList(&mFonts, &mFallbacks, kATSULastResortOnlyFallback);
|
||||
CreateFontFallbacksFromFontList(&mFonts, &mFallbacks, kATSUSequentialFallbacksExclusive);
|
||||
}
|
||||
|
||||
PRBool
|
||||
@ -443,7 +443,7 @@ gfxAtsuiFontGroup::FindATSUFont(const nsAString& aName,
|
||||
gfxQuartzFontCache *fc = gfxQuartzFontCache::SharedFontCache();
|
||||
ATSUFontID fontID = fc->FindATSUFontIDForFamilyAndStyle (aName, fontStyle);
|
||||
|
||||
if (fontID != kATSUInvalidFontID) {
|
||||
if (fontID != kATSUInvalidFontID && !fontGroup->HasFont(fontID)) {
|
||||
//fprintf (stderr, "..FindATSUFont: %s\n", NS_ConvertUTF16toUTF8(aName).get());
|
||||
GetOrMakeFont(fontID, fontStyle, &fontGroup->mFonts);
|
||||
}
|
||||
@ -673,6 +673,16 @@ gfxAtsuiFontGroup::FindFontFor(ATSUFontID fid)
|
||||
return GetOrMakeFont(fid, GetStyle(), &mFonts);
|
||||
}
|
||||
|
||||
PRBool
|
||||
gfxAtsuiFontGroup::HasFont(ATSUFontID fid)
|
||||
{
|
||||
for (PRUint32 i = 0; i < mFonts.Length(); ++i) {
|
||||
if (fid == static_cast<gfxAtsuiFont *>(mFonts.ElementAt(i).get())->GetATSUFontID())
|
||||
return PR_TRUE;
|
||||
}
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Simple wrapper for ATSU "direct data arrays"
|
||||
*/
|
||||
@ -1519,6 +1529,12 @@ gfxAtsuiFontGroup::InitTextRun(gfxTextRun *aRun,
|
||||
break;
|
||||
}
|
||||
|
||||
if (firstTime && !HasFont(substituteFontID)) {
|
||||
// XXX We are using kATSUSequentialFallbacksExclusive at first time.
|
||||
// But the method uses non-listed font in font fallbacks on 10.4. (ATSUI Reference does not say so...)
|
||||
status = kATSUFontsNotMatched;
|
||||
}
|
||||
|
||||
// then, handle any chars that were found in the fallback list
|
||||
if (status == kATSUFontsMatched) {
|
||||
// substitute font will be used in [changedOffset, changedOffset + changedLength)
|
||||
|
Loading…
x
Reference in New Issue
Block a user