diff --git a/gfx/thebes/gfxAndroidPlatform.cpp b/gfx/thebes/gfxAndroidPlatform.cpp index d723c3504d4..9e7b06b35ef 100644 --- a/gfx/thebes/gfxAndroidPlatform.cpp +++ b/gfx/thebes/gfxAndroidPlatform.cpp @@ -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 gfxAndroidPlatform::GetScaledFontForFont(gfxFont *aFont) { diff --git a/gfx/thebes/gfxAndroidPlatform.h b/gfx/thebes/gfxAndroidPlatform.h index baa20ebac27..8f04a0eb809 100644 --- a/gfx/thebes/gfxAndroidPlatform.h +++ b/gfx/thebes/gfxAndroidPlatform.h @@ -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, diff --git a/gfx/thebes/gfxFT2FontList.cpp b/gfx/thebes/gfxFT2FontList.cpp index bb74c4fe9c7..62ffb109b7b 100644 --- a/gfx/thebes/gfxFT2FontList.cpp +++ b/gfx/thebes/gfxFT2FontList.cpp @@ -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 >& 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(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* diff --git a/layout/reftests/font-face/reftest.list b/layout/reftests/font-face/reftest.list index e6e483609b1..c8b48102f4a 100644 --- a/layout/reftests/font-face/reftest.list +++ b/layout/reftests/font-face/reftest.list @@ -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