bug 769194 - support src:local(...) in @font-face rules on Android/FT2FontList. r=jdaggett

This commit is contained in:
Jonathan Kew 2012-06-29 12:39:44 +01:00
Родитель 7721a8d74d
Коммит ef1c77f347
4 изменённых файлов: 46 добавлений и 8 удалений

Просмотреть файл

@ -160,6 +160,14 @@ gfxAndroidPlatform::MakePlatformFont(const gfxProxyFontEntry *aProxyEntry,
aLength);
}
gfxFontEntry*
gfxAndroidPlatform::LookupLocalFont(const gfxProxyFontEntry *aProxyEntry,
const nsAString& aFontName)
{
return gfxPlatformFontList::PlatformFontList()->LookupLocalFont(aProxyEntry,
aFontName);
}
RefPtr<ScaledFont>
gfxAndroidPlatform::GetScaledFontForFont(gfxFont *aFont)
{

Просмотреть файл

@ -48,6 +48,8 @@ public:
virtual gfxPlatformFontList* CreatePlatformFontList();
virtual gfxFontEntry* MakePlatformFont(const gfxProxyFontEntry *aProxyEntry,
const PRUint8 *aFontData, PRUint32 aLength);
virtual gfxFontEntry* LookupLocalFont(const gfxProxyFontEntry *aProxyEntry,
const nsAString& aFontName);
virtual nsresult GetFontList(nsIAtom *aLangGroup,
const nsACString& aGenericFamily,

Просмотреть файл

@ -186,6 +186,7 @@ FT2FontEntry::CreateFontEntry(const gfxProxyFontEntry &aProxyEntry,
fe->mItalic = aProxyEntry.mItalic;
fe->mWeight = aProxyEntry.mWeight;
fe->mStretch = aProxyEntry.mStretch;
fe->mIsUserFont = true;
}
return fe;
}
@ -1059,7 +1060,7 @@ struct FullFontNameSearch {
{ }
nsString mFullName;
gfxFontEntry *mFontEntry;
FT2FontEntry *mFontEntry;
};
// callback called for each family name, based on the assumption that the
@ -1078,12 +1079,17 @@ FindFullName(nsStringHashKey::KeyType aKey,
data->mFullName.Left(fullNameFamily, family.Length());
// if so, iterate over faces in this family to see if there is a match
if (family.Equals(fullNameFamily)) {
if (family.Equals(fullNameFamily, nsCaseInsensitiveStringComparator())) {
nsTArray<nsRefPtr<gfxFontEntry> >& fontList = aFontFamily->GetFontList();
int index, len = fontList.Length();
for (index = 0; index < len; index++) {
if (fontList[index]->Name().Equals(data->mFullName)) {
data->mFontEntry = fontList[index];
gfxFontEntry* fe = fontList[index];
if (!fe) {
continue;
}
if (fe->Name().Equals(data->mFullName,
nsCaseInsensitiveStringComparator())) {
data->mFontEntry = static_cast<FT2FontEntry*>(fe);
return PL_DHASH_STOP;
}
}
@ -1101,7 +1107,30 @@ gfxFT2FontList::LookupLocalFont(const gfxProxyFontEntry *aProxyEntry,
mFontFamilies.Enumerate(FindFullName, &data);
return data.mFontEntry;
if (!data.mFontEntry) {
return nsnull;
}
// Clone the font entry so that we can then set its style descriptors
// from the proxy rather than the actual font.
// Ensure existence of mFTFace in the original entry
data.mFontEntry->CairoFontFace();
if (!data.mFontEntry->mFTFace) {
return nsnull;
}
FT2FontEntry* fe =
FT2FontEntry::CreateFontEntry(data.mFontEntry->mFTFace, nsnull, 0,
data.mFontEntry->Name(), nsnull);
if (fe) {
fe->mItalic = aProxyEntry->mItalic;
fe->mWeight = aProxyEntry->mWeight;
fe->mStretch = aProxyEntry->mStretch;
fe->mIsUserFont = fe->mIsLocalUserFont = true;
}
return fe;
}
gfxFontEntry*

Просмотреть файл

@ -94,9 +94,8 @@ HTTP(..) == ex-unit-1-dynamic.html ex-unit-1-ref.html
# random-if(!cocoaWidget) HTTP(..) == src-format-arabic.html src-format-arabic-aat-ref.html
# random-if(cocoaWidget) HTTP(..) == src-format-arabic.html src-format-arabic-ot-ref.html
# bug 769194 - src:local() completely broken on android
fails-if(Android) == local-1.html local-1-ref.html
fails-if(Android) == local-styled-1.html local-styled-1-ref.html
== local-1.html local-1-ref.html
== local-styled-1.html local-styled-1-ref.html
HTTP(..) == synthetic-weight-style.html synthetic-weight-style-ref.html
HTTP(..) == synthetic-variations.html synthetic-variations-ref.html