mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1062058 part 1 - avoid passing around proxy font entry object. r=heycam
This commit is contained in:
parent
37d334170d
commit
65944c3aad
@ -306,21 +306,32 @@ gfxAndroidPlatform::GetFTLibrary()
|
||||
return gPlatformFTLibrary;
|
||||
}
|
||||
|
||||
gfxFontEntry*
|
||||
gfxAndroidPlatform::MakePlatformFont(const gfxProxyFontEntry *aProxyEntry,
|
||||
const uint8_t *aFontData, uint32_t aLength)
|
||||
gfxFontEntry*
|
||||
gfxAndroidPlatform::LookupLocalFont(const nsAString& aFontName,
|
||||
uint16_t aWeight,
|
||||
int16_t aStretch,
|
||||
bool aItalic)
|
||||
{
|
||||
return gfxPlatformFontList::PlatformFontList()->MakePlatformFont(aProxyEntry,
|
||||
aFontData,
|
||||
aLength);
|
||||
return gfxPlatformFontList::PlatformFontList()->LookupLocalFont(aFontName,
|
||||
aWeight,
|
||||
aStretch,
|
||||
aItalic);
|
||||
}
|
||||
|
||||
gfxFontEntry*
|
||||
gfxAndroidPlatform::LookupLocalFont(const gfxProxyFontEntry *aProxyEntry,
|
||||
const nsAString& aFontName)
|
||||
gfxFontEntry*
|
||||
gfxAndroidPlatform::MakePlatformFont(const nsAString& aFontName,
|
||||
uint16_t aWeight,
|
||||
int16_t aStretch,
|
||||
bool aItalic,
|
||||
const uint8_t* aFontData,
|
||||
uint32_t aLength)
|
||||
{
|
||||
return gfxPlatformFontList::PlatformFontList()->LookupLocalFont(aProxyEntry,
|
||||
aFontName);
|
||||
return gfxPlatformFontList::PlatformFontList()->MakePlatformFont(aFontName,
|
||||
aWeight,
|
||||
aStretch,
|
||||
aItalic,
|
||||
aFontData,
|
||||
aLength);
|
||||
}
|
||||
|
||||
TemporaryRef<ScaledFont>
|
||||
|
@ -47,10 +47,16 @@ public:
|
||||
// platform implementations of font functions
|
||||
virtual bool IsFontFormatSupported(nsIURI *aFontURI, uint32_t aFormatFlags);
|
||||
virtual gfxPlatformFontList* CreatePlatformFontList();
|
||||
virtual gfxFontEntry* MakePlatformFont(const gfxProxyFontEntry *aProxyEntry,
|
||||
const uint8_t *aFontData, uint32_t aLength);
|
||||
virtual gfxFontEntry* LookupLocalFont(const gfxProxyFontEntry *aProxyEntry,
|
||||
const nsAString& aFontName);
|
||||
virtual gfxFontEntry* LookupLocalFont(const nsAString& aFontName,
|
||||
uint16_t aWeight,
|
||||
int16_t aStretch,
|
||||
bool aItalic);
|
||||
virtual gfxFontEntry* MakePlatformFont(const nsAString& aFontName,
|
||||
uint16_t aWeight,
|
||||
int16_t aStretch,
|
||||
bool aItalic,
|
||||
const uint8_t* aFontData,
|
||||
uint32_t aLength);
|
||||
|
||||
virtual void GetCommonFallbackFonts(const uint32_t aCh,
|
||||
int32_t aRunScript,
|
||||
|
@ -751,12 +751,14 @@ gfxDWriteFontList::GetDefaultFont(const gfxFontStyle *aStyle)
|
||||
}
|
||||
|
||||
gfxFontEntry *
|
||||
gfxDWriteFontList::LookupLocalFont(const gfxProxyFontEntry *aProxyEntry,
|
||||
const nsAString& aFullname)
|
||||
gfxDWriteFontList::LookupLocalFont(const nsAString& aFontName,
|
||||
uint16_t aWeight,
|
||||
int16_t aStretch,
|
||||
bool aItalic)
|
||||
{
|
||||
gfxFontEntry *lookup;
|
||||
|
||||
lookup = LookupInFaceNameLists(aFullname);
|
||||
lookup = LookupInFaceNameLists(aFontName);
|
||||
if (!lookup) {
|
||||
return nullptr;
|
||||
}
|
||||
@ -765,16 +767,19 @@ gfxDWriteFontList::LookupLocalFont(const gfxProxyFontEntry *aProxyEntry,
|
||||
gfxDWriteFontEntry *fe =
|
||||
new gfxDWriteFontEntry(lookup->Name(),
|
||||
dwriteLookup->mFont,
|
||||
aProxyEntry->Weight(),
|
||||
aProxyEntry->Stretch(),
|
||||
aProxyEntry->IsItalic());
|
||||
aWeight,
|
||||
aStretch,
|
||||
aItalic);
|
||||
fe->SetForceGDIClassic(dwriteLookup->GetForceGDIClassic());
|
||||
return fe;
|
||||
}
|
||||
|
||||
gfxFontEntry *
|
||||
gfxDWriteFontList::MakePlatformFont(const gfxProxyFontEntry *aProxyEntry,
|
||||
const uint8_t *aFontData,
|
||||
gfxDWriteFontList::MakePlatformFont(const nsAString& aFontName,
|
||||
uint16_t aWeight,
|
||||
int16_t aStretch,
|
||||
bool aItalic,
|
||||
const uint8_t* aFontData,
|
||||
uint32_t aLength)
|
||||
{
|
||||
nsresult rv;
|
||||
@ -836,9 +841,9 @@ gfxDWriteFontList::MakePlatformFont(const gfxProxyFontEntry *aProxyEntry,
|
||||
gfxDWriteFontEntry *entry =
|
||||
new gfxDWriteFontEntry(uniqueName,
|
||||
fontFile,
|
||||
aProxyEntry->Weight(),
|
||||
aProxyEntry->Stretch(),
|
||||
aProxyEntry->IsItalic());
|
||||
aWeight,
|
||||
aStretch,
|
||||
aItalic);
|
||||
|
||||
fontFile->Analyze(&isSupported, &fileType, &entry->mFaceType, &numFaces);
|
||||
if (!isSupported || numFaces > 1) {
|
||||
|
@ -347,11 +347,16 @@ public:
|
||||
|
||||
virtual gfxFontFamily* GetDefaultFont(const gfxFontStyle* aStyle);
|
||||
|
||||
virtual gfxFontEntry* LookupLocalFont(const gfxProxyFontEntry *aProxyEntry,
|
||||
const nsAString& aFontName);
|
||||
virtual gfxFontEntry* LookupLocalFont(const nsAString& aFontName,
|
||||
uint16_t aWeight,
|
||||
int16_t aStretch,
|
||||
bool aItalic);
|
||||
|
||||
virtual gfxFontEntry* MakePlatformFont(const gfxProxyFontEntry *aProxyEntry,
|
||||
const uint8_t *aFontData,
|
||||
virtual gfxFontEntry* MakePlatformFont(const nsAString& aFontName,
|
||||
uint16_t aWeight,
|
||||
int16_t aStretch,
|
||||
bool aItalic,
|
||||
const uint8_t* aFontData,
|
||||
uint32_t aLength);
|
||||
|
||||
bool GetStandardFamilyName(const nsAString& aFontName,
|
||||
|
@ -253,8 +253,11 @@ FT2FontEntry::CreateFontInstance(const gfxFontStyle *aFontStyle, bool aNeedsBold
|
||||
|
||||
/* static */
|
||||
FT2FontEntry*
|
||||
FT2FontEntry::CreateFontEntry(const gfxProxyFontEntry &aProxyEntry,
|
||||
const uint8_t *aFontData,
|
||||
FT2FontEntry::CreateFontEntry(const nsAString& aFontName,
|
||||
uint16_t aWeight,
|
||||
int16_t aStretch,
|
||||
bool aItalic,
|
||||
const uint8_t* aFontData,
|
||||
uint32_t aLength)
|
||||
{
|
||||
// Ownership of aFontData is passed in here; the fontEntry must
|
||||
@ -276,12 +279,12 @@ FT2FontEntry::CreateFontEntry(const gfxProxyFontEntry &aProxyEntry,
|
||||
// Create our FT2FontEntry, which inherits the name of the proxy
|
||||
// as it's not guaranteed that the face has valid names (bug 737315)
|
||||
FT2FontEntry* fe =
|
||||
FT2FontEntry::CreateFontEntry(face, nullptr, 0, aProxyEntry.Name(),
|
||||
FT2FontEntry::CreateFontEntry(face, nullptr, 0, aFontName,
|
||||
aFontData);
|
||||
if (fe) {
|
||||
fe->mItalic = aProxyEntry.mItalic;
|
||||
fe->mWeight = aProxyEntry.mWeight;
|
||||
fe->mStretch = aProxyEntry.mStretch;
|
||||
fe->mItalic = aItalic;
|
||||
fe->mWeight = aWeight;
|
||||
fe->mStretch = aStretch;
|
||||
fe->mIsUserFont = true;
|
||||
}
|
||||
return fe;
|
||||
@ -379,7 +382,7 @@ FT2FontEntry*
|
||||
FT2FontEntry::CreateFontEntry(FT_Face aFace,
|
||||
const char* aFilename, uint8_t aIndex,
|
||||
const nsAString& aName,
|
||||
const uint8_t *aFontData)
|
||||
const uint8_t* aFontData)
|
||||
{
|
||||
FT2FontEntry *fe = new FT2FontEntry(aName);
|
||||
fe->mItalic = FTFaceIsItalic(aFace);
|
||||
@ -1509,8 +1512,10 @@ FindFullName(nsStringHashKey::KeyType aKey,
|
||||
}
|
||||
|
||||
gfxFontEntry*
|
||||
gfxFT2FontList::LookupLocalFont(const gfxProxyFontEntry *aProxyEntry,
|
||||
const nsAString& aFontName)
|
||||
gfxFT2FontList::LookupLocalFont(const nsAString& aFontName,
|
||||
uint16_t aWeight,
|
||||
int16_t aStretch,
|
||||
bool aItalic)
|
||||
{
|
||||
// walk over list of names
|
||||
FullFontNameSearch data(aFontName);
|
||||
@ -1538,9 +1543,9 @@ gfxFT2FontList::LookupLocalFont(const gfxProxyFontEntry *aProxyEntry,
|
||||
data.mFontEntry->mFTFontIndex,
|
||||
data.mFontEntry->Name(), nullptr);
|
||||
if (fe) {
|
||||
fe->mItalic = aProxyEntry->mItalic;
|
||||
fe->mWeight = aProxyEntry->mWeight;
|
||||
fe->mStretch = aProxyEntry->mStretch;
|
||||
fe->mItalic = aItalic;
|
||||
fe->mWeight = aWeight;
|
||||
fe->mStretch = aStretch;
|
||||
fe->mIsUserFont = fe->mIsLocalUserFont = true;
|
||||
}
|
||||
|
||||
@ -1564,14 +1569,18 @@ gfxFT2FontList::GetDefaultFont(const gfxFontStyle* aStyle)
|
||||
}
|
||||
|
||||
gfxFontEntry*
|
||||
gfxFT2FontList::MakePlatformFont(const gfxProxyFontEntry *aProxyEntry,
|
||||
const uint8_t *aFontData,
|
||||
gfxFT2FontList::MakePlatformFont(const nsAString& aFontName,
|
||||
uint16_t aWeight,
|
||||
int16_t aStretch,
|
||||
bool aItalic,
|
||||
const uint8_t* aFontData,
|
||||
uint32_t aLength)
|
||||
{
|
||||
// The FT2 font needs the font data to persist, so we do NOT free it here
|
||||
// but instead pass ownership to the font entry.
|
||||
// Deallocation will happen later, when the font face is destroyed.
|
||||
return FT2FontEntry::CreateFontEntry(*aProxyEntry, aFontData, aLength);
|
||||
return FT2FontEntry::CreateFontEntry(aFontName, aWeight, aStretch,
|
||||
aItalic, aFontData, aLength);
|
||||
}
|
||||
|
||||
static PLDHashOperator
|
||||
|
@ -39,8 +39,12 @@ public:
|
||||
|
||||
// create a font entry for a downloaded font
|
||||
static FT2FontEntry*
|
||||
CreateFontEntry(const gfxProxyFontEntry &aProxyEntry,
|
||||
const uint8_t *aFontData, uint32_t aLength);
|
||||
CreateFontEntry(const nsAString& aFontName,
|
||||
uint16_t aWeight,
|
||||
int16_t aStretch,
|
||||
bool aItalic,
|
||||
const uint8_t* aFontData,
|
||||
uint32_t aLength);
|
||||
|
||||
// create a font entry representing an installed font, identified by
|
||||
// a FontListEntry; the freetype and cairo faces will not be instantiated
|
||||
@ -56,7 +60,7 @@ public:
|
||||
CreateFontEntry(FT_Face aFace,
|
||||
const char *aFilename, uint8_t aIndex,
|
||||
const nsAString& aName,
|
||||
const uint8_t *aFontData = nullptr);
|
||||
const uint8_t* aFontData = nullptr);
|
||||
|
||||
virtual gfxFont *CreateFontInstance(const gfxFontStyle *aFontStyle,
|
||||
bool aNeedsBold);
|
||||
@ -118,11 +122,16 @@ public:
|
||||
|
||||
virtual gfxFontFamily* GetDefaultFont(const gfxFontStyle* aStyle);
|
||||
|
||||
virtual gfxFontEntry* LookupLocalFont(const gfxProxyFontEntry *aProxyEntry,
|
||||
const nsAString& aFontName);
|
||||
virtual gfxFontEntry* LookupLocalFont(const nsAString& aFontName,
|
||||
uint16_t aWeight,
|
||||
int16_t aStretch,
|
||||
bool aItalic);
|
||||
|
||||
virtual gfxFontEntry* MakePlatformFont(const gfxProxyFontEntry *aProxyEntry,
|
||||
const uint8_t *aFontData,
|
||||
virtual gfxFontEntry* MakePlatformFont(const nsAString& aFontName,
|
||||
uint16_t aWeight,
|
||||
int16_t aStretch,
|
||||
bool aItalic,
|
||||
const uint8_t* aFontData,
|
||||
uint32_t aLength);
|
||||
|
||||
void GetFontList(InfallibleTArray<FontListEntry>* retValue);
|
||||
|
@ -724,12 +724,14 @@ gfxGDIFontList::EnumFontFamExProc(ENUMLOGFONTEXW *lpelfe,
|
||||
}
|
||||
|
||||
gfxFontEntry*
|
||||
gfxGDIFontList::LookupLocalFont(const gfxProxyFontEntry *aProxyEntry,
|
||||
const nsAString& aFullname)
|
||||
gfxGDIFontList::LookupLocalFont(const nsAString& aFontName,
|
||||
uint16_t aWeight,
|
||||
int16_t aStretch,
|
||||
bool aItalic)
|
||||
{
|
||||
gfxFontEntry *lookup;
|
||||
|
||||
lookup = LookupInFaceNameLists(aFullname);
|
||||
lookup = LookupInFaceNameLists(aFontName);
|
||||
if (!lookup) {
|
||||
return nullptr;
|
||||
}
|
||||
@ -743,7 +745,7 @@ gfxGDIFontList::LookupLocalFont(const gfxProxyFontEntry *aProxyEntry,
|
||||
GDIFontEntry *fe = GDIFontEntry::CreateFontEntry(lookup->Name(),
|
||||
gfxWindowsFontType(isCFF ? GFX_FONT_TYPE_PS_OPENTYPE : GFX_FONT_TYPE_TRUETYPE) /*type*/,
|
||||
lookup->mItalic ? NS_FONT_STYLE_ITALIC : NS_FONT_STYLE_NORMAL,
|
||||
lookup->mWeight, aProxyEntry->mStretch, nullptr,
|
||||
lookup->mWeight, aStretch, nullptr,
|
||||
static_cast<GDIFontEntry*>(lookup)->mFamilyHasItalicFace);
|
||||
|
||||
if (!fe)
|
||||
@ -753,22 +755,25 @@ gfxGDIFontList::LookupLocalFont(const gfxProxyFontEntry *aProxyEntry,
|
||||
fe->mIsLocalUserFont = true;
|
||||
|
||||
// make the new font entry match the proxy entry style characteristics
|
||||
fe->mWeight = (aProxyEntry->mWeight == 0 ? 400 : aProxyEntry->mWeight);
|
||||
fe->mItalic = aProxyEntry->mItalic;
|
||||
fe->mWeight = (aWeight == 0 ? 400 : aWeight);
|
||||
fe->mItalic = aItalic;
|
||||
|
||||
return fe;
|
||||
}
|
||||
|
||||
gfxFontEntry*
|
||||
gfxGDIFontList::MakePlatformFont(const gfxProxyFontEntry *aProxyEntry,
|
||||
const uint8_t *aFontData,
|
||||
gfxFontEntry*
|
||||
gfxGDIFontList::MakePlatformFont(const nsAString& aFontName,
|
||||
uint16_t aWeight,
|
||||
int16_t aStretch,
|
||||
bool aItalic,
|
||||
const uint8_t* aFontData,
|
||||
uint32_t aLength)
|
||||
{
|
||||
// MakePlatformFont is responsible for deleting the font data with NS_Free
|
||||
// so we set up a stack object to ensure it is freed even if we take an
|
||||
// early exit
|
||||
struct FontDataDeleter {
|
||||
FontDataDeleter(const uint8_t *aFontData)
|
||||
FontDataDeleter(const uint8_t* aFontData)
|
||||
: mFontData(aFontData) { }
|
||||
~FontDataDeleter() { NS_Free((void*)mFontData); }
|
||||
const uint8_t *mFontData;
|
||||
@ -817,12 +822,12 @@ gfxGDIFontList::MakePlatformFont(const gfxProxyFontEntry *aProxyEntry,
|
||||
|
||||
// make a new font entry using the unique name
|
||||
WinUserFontData *winUserFontData = new WinUserFontData(fontRef);
|
||||
uint16_t w = (aProxyEntry->mWeight == 0 ? 400 : aProxyEntry->mWeight);
|
||||
uint16_t w = (aWeight == 0 ? 400 : aWeight);
|
||||
|
||||
GDIFontEntry *fe = GDIFontEntry::CreateFontEntry(uniqueName,
|
||||
gfxWindowsFontType(isCFF ? GFX_FONT_TYPE_PS_OPENTYPE : GFX_FONT_TYPE_TRUETYPE) /*type*/,
|
||||
uint32_t(aProxyEntry->mItalic ? NS_FONT_STYLE_ITALIC : NS_FONT_STYLE_NORMAL),
|
||||
w, aProxyEntry->mStretch, winUserFontData, false);
|
||||
uint32_t(aItalic ? NS_FONT_STYLE_ITALIC : NS_FONT_STYLE_NORMAL),
|
||||
w, aStretch, winUserFontData, false);
|
||||
|
||||
if (!fe)
|
||||
return fe;
|
||||
|
@ -246,8 +246,10 @@ public:
|
||||
bool aFamilyHasItalicFace);
|
||||
|
||||
// create a font entry for a font referenced by its fullname
|
||||
static GDIFontEntry* LoadLocalFont(const gfxProxyFontEntry &aProxyEntry,
|
||||
const nsAString& aFullname);
|
||||
static GDIFontEntry* LoadLocalFont(const nsAString& aFontName,
|
||||
uint16_t aWeight,
|
||||
int16_t aStretch,
|
||||
bool aItalic);
|
||||
|
||||
uint8_t mWindowsFamily;
|
||||
uint8_t mWindowsPitch;
|
||||
@ -310,11 +312,17 @@ public:
|
||||
virtual gfxFontFamily* FindFamily(const nsAString& aFamily,
|
||||
bool aUseSystemFonts = false);
|
||||
|
||||
virtual gfxFontEntry* LookupLocalFont(const gfxProxyFontEntry *aProxyEntry,
|
||||
const nsAString& aFontName);
|
||||
virtual gfxFontEntry* LookupLocalFont(const nsAString& aFontName,
|
||||
uint16_t aWeight,
|
||||
int16_t aStretch,
|
||||
bool aItalic);
|
||||
|
||||
virtual gfxFontEntry* MakePlatformFont(const gfxProxyFontEntry *aProxyEntry,
|
||||
const uint8_t *aFontData, uint32_t aLength);
|
||||
virtual gfxFontEntry* MakePlatformFont(const nsAString& aFontName,
|
||||
uint16_t aWeight,
|
||||
int16_t aStretch,
|
||||
bool aItalic,
|
||||
const uint8_t* aFontData,
|
||||
uint32_t aLength);
|
||||
|
||||
virtual void AddSizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf,
|
||||
FontListSizes* aSizes) const;
|
||||
|
@ -81,11 +81,17 @@ public:
|
||||
|
||||
virtual bool GetStandardFamilyName(const nsAString& aFontName, nsAString& aFamilyName);
|
||||
|
||||
virtual gfxFontEntry* LookupLocalFont(const gfxProxyFontEntry *aProxyEntry,
|
||||
const nsAString& aFontName);
|
||||
virtual gfxFontEntry* LookupLocalFont(const nsAString& aFontName,
|
||||
uint16_t aWeight,
|
||||
int16_t aStretch,
|
||||
bool aItalic);
|
||||
|
||||
virtual gfxFontEntry* MakePlatformFont(const gfxProxyFontEntry *aProxyEntry,
|
||||
const uint8_t *aFontData, uint32_t aLength);
|
||||
virtual gfxFontEntry* MakePlatformFont(const nsAString& aFontName,
|
||||
uint16_t aWeight,
|
||||
int16_t aStretch,
|
||||
bool aItalic,
|
||||
const uint8_t* aFontData,
|
||||
uint32_t aLength);
|
||||
|
||||
void ClearPrefFonts() { mPrefFonts.Clear(); }
|
||||
|
||||
|
@ -725,7 +725,9 @@ gfxMacPlatformFontList::InitSingleFaceList()
|
||||
LOG_FONTLIST(("(fontlist-singleface) face name: %s\n",
|
||||
NS_ConvertUTF16toUTF8(singleFaceFonts[i]).get()));
|
||||
#endif
|
||||
gfxFontEntry *fontEntry = LookupLocalFont(nullptr, singleFaceFonts[i]);
|
||||
gfxFontEntry *fontEntry = LookupLocalFont(singleFaceFonts[i],
|
||||
400, 0,
|
||||
NS_FONT_STYLE_NORMAL);
|
||||
if (fontEntry) {
|
||||
nsAutoString familyName, key;
|
||||
familyName = singleFaceFonts[i];
|
||||
@ -740,6 +742,9 @@ gfxMacPlatformFontList::InitSingleFaceList()
|
||||
if (!mFontFamilies.GetWeak(key)) {
|
||||
gfxFontFamily *familyEntry =
|
||||
new gfxSingleFaceMacFontFamily(familyName);
|
||||
// LookupLocalFont sets these to true, need to clear
|
||||
fontEntry->mIsUserFont = false;
|
||||
fontEntry->mIsLocalUserFont = false;
|
||||
familyEntry->AddFontEntry(fontEntry);
|
||||
familyEntry->SetHasStyles(true);
|
||||
mFontFamilies.Put(key, familyEntry);
|
||||
@ -904,8 +909,10 @@ gfxMacPlatformFontList::AppleWeightToCSSWeight(int32_t aAppleWeight)
|
||||
}
|
||||
|
||||
gfxFontEntry*
|
||||
gfxMacPlatformFontList::LookupLocalFont(const gfxProxyFontEntry *aProxyEntry,
|
||||
const nsAString& aFontName)
|
||||
gfxMacPlatformFontList::LookupLocalFont(const nsAString& aFontName,
|
||||
uint16_t aWeight,
|
||||
int16_t aStretch,
|
||||
bool aItalic)
|
||||
{
|
||||
nsAutoreleasePool localPool;
|
||||
|
||||
@ -918,22 +925,15 @@ gfxMacPlatformFontList::LookupLocalFont(const gfxProxyFontEntry *aProxyEntry,
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (aProxyEntry) {
|
||||
uint16_t w = aProxyEntry->mWeight;
|
||||
NS_ASSERTION(w >= 100 && w <= 900, "bogus font weight value!");
|
||||
NS_ASSERTION(aWeight >= 100 && aWeight <= 900,
|
||||
"bogus font weight value!");
|
||||
|
||||
newFontEntry =
|
||||
new MacOSFontEntry(aFontName, fontRef,
|
||||
w, aProxyEntry->mStretch,
|
||||
aProxyEntry->mItalic ?
|
||||
NS_FONT_STYLE_ITALIC : NS_FONT_STYLE_NORMAL,
|
||||
true, true);
|
||||
} else {
|
||||
newFontEntry =
|
||||
new MacOSFontEntry(aFontName, fontRef,
|
||||
400, 0, NS_FONT_STYLE_NORMAL,
|
||||
false, false);
|
||||
}
|
||||
newFontEntry =
|
||||
new MacOSFontEntry(aFontName, fontRef,
|
||||
aWeight, aStretch,
|
||||
aItalic ?
|
||||
NS_FONT_STYLE_ITALIC : NS_FONT_STYLE_NORMAL,
|
||||
true, true);
|
||||
::CFRelease(fontRef);
|
||||
|
||||
return newFontEntry;
|
||||
@ -945,14 +945,16 @@ static void ReleaseData(void *info, const void *data, size_t size)
|
||||
}
|
||||
|
||||
gfxFontEntry*
|
||||
gfxMacPlatformFontList::MakePlatformFont(const gfxProxyFontEntry *aProxyEntry,
|
||||
const uint8_t *aFontData,
|
||||
gfxMacPlatformFontList::MakePlatformFont(const nsAString& aFontName,
|
||||
uint16_t aWeight,
|
||||
int16_t aStretch,
|
||||
bool aItalic,
|
||||
const uint8_t* aFontData,
|
||||
uint32_t aLength)
|
||||
{
|
||||
NS_ASSERTION(aFontData, "MakePlatformFont called with null data");
|
||||
|
||||
uint16_t w = aProxyEntry->mWeight;
|
||||
NS_ASSERTION(w >= 100 && w <= 900, "bogus font weight value!");
|
||||
NS_ASSERTION(aWeight >= 100 && aWeight <= 900, "bogus font weight value!");
|
||||
|
||||
// create the font entry
|
||||
nsAutoString uniqueName;
|
||||
@ -973,9 +975,9 @@ gfxMacPlatformFontList::MakePlatformFont(const gfxProxyFontEntry *aProxyEntry,
|
||||
}
|
||||
|
||||
nsAutoPtr<MacOSFontEntry>
|
||||
newFontEntry(new MacOSFontEntry(uniqueName, fontRef, w,
|
||||
aProxyEntry->mStretch,
|
||||
aProxyEntry->mItalic ?
|
||||
newFontEntry(new MacOSFontEntry(uniqueName, fontRef, aWeight,
|
||||
aStretch,
|
||||
aItalic ?
|
||||
NS_FONT_STYLE_ITALIC :
|
||||
NS_FONT_STYLE_NORMAL,
|
||||
true, false));
|
||||
|
@ -326,12 +326,15 @@ gfxSystemFcFontEntry::ReleaseGrFace(gr_face* aFace)
|
||||
|
||||
class gfxUserFcFontEntry : public gfxFcFontEntry {
|
||||
protected:
|
||||
explicit gfxUserFcFontEntry(const gfxProxyFontEntry &aProxyEntry)
|
||||
: gfxFcFontEntry(aProxyEntry.Name())
|
||||
explicit gfxUserFcFontEntry(const nsAString& aFontName,
|
||||
uint16_t aWeight,
|
||||
int16_t aStretch,
|
||||
bool aItalic)
|
||||
: gfxFcFontEntry(aFontName)
|
||||
{
|
||||
mItalic = aProxyEntry.mItalic;
|
||||
mWeight = aProxyEntry.mWeight;
|
||||
mStretch = aProxyEntry.mStretch;
|
||||
mItalic = aItalic;
|
||||
mWeight = aWeight;
|
||||
mStretch = aStretch;
|
||||
mIsUserFont = true;
|
||||
}
|
||||
|
||||
@ -410,9 +413,12 @@ gfxUserFcFontEntry::AdjustPatternToCSS(FcPattern *aPattern)
|
||||
|
||||
class gfxLocalFcFontEntry : public gfxUserFcFontEntry {
|
||||
public:
|
||||
gfxLocalFcFontEntry(const gfxProxyFontEntry &aProxyEntry,
|
||||
gfxLocalFcFontEntry(const nsAString& aFontName,
|
||||
uint16_t aWeight,
|
||||
int16_t aStretch,
|
||||
bool aItalic,
|
||||
const nsTArray< nsCountedRef<FcPattern> >& aPatterns)
|
||||
: gfxUserFcFontEntry(aProxyEntry)
|
||||
: gfxUserFcFontEntry(aFontName, aWeight, aStretch, aItalic)
|
||||
{
|
||||
if (!mPatterns.SetCapacity(aPatterns.Length()))
|
||||
return; // OOM
|
||||
@ -443,9 +449,13 @@ public:
|
||||
class gfxDownloadedFcFontEntry : public gfxUserFcFontEntry {
|
||||
public:
|
||||
// This takes ownership of the face and its underlying data
|
||||
gfxDownloadedFcFontEntry(const gfxProxyFontEntry &aProxyEntry,
|
||||
gfxDownloadedFcFontEntry(const nsAString& aFontName,
|
||||
uint16_t aWeight,
|
||||
int16_t aStretch,
|
||||
bool aItalic,
|
||||
const uint8_t *aData, FT_Face aFace)
|
||||
: gfxUserFcFontEntry(aProxyEntry), mFontData(aData), mFace(aFace)
|
||||
: gfxUserFcFontEntry(aFontName, aWeight, aStretch, aItalic),
|
||||
mFontData(aData), mFace(aFace)
|
||||
{
|
||||
NS_PRECONDITION(aFace != nullptr, "aFace is NULL!");
|
||||
InitPattern();
|
||||
@ -1582,8 +1592,10 @@ gfxPangoFontGroup::Shutdown()
|
||||
}
|
||||
|
||||
/* static */ gfxFontEntry *
|
||||
gfxPangoFontGroup::NewFontEntry(const gfxProxyFontEntry &aProxyEntry,
|
||||
const nsAString& aFullname)
|
||||
gfxPangoFontGroup::NewFontEntry(const nsAString& aFontName,
|
||||
uint16_t aWeight,
|
||||
int16_t aStretch,
|
||||
bool aItalic)
|
||||
{
|
||||
gfxFontconfigUtils *utils = gfxFontconfigUtils::GetFontconfigUtils();
|
||||
if (!utils)
|
||||
@ -1610,7 +1622,7 @@ gfxPangoFontGroup::NewFontEntry(const gfxProxyFontEntry &aProxyEntry,
|
||||
if (!pattern)
|
||||
return nullptr;
|
||||
|
||||
NS_ConvertUTF16toUTF8 fullname(aFullname);
|
||||
NS_ConvertUTF16toUTF8 fullname(aFontName);
|
||||
FcPatternAddString(pattern, FC_FULLNAME,
|
||||
gfxFontconfigUtils::ToFcChar8(fullname));
|
||||
FcConfigSubstitute(nullptr, pattern, FcMatchPattern);
|
||||
@ -1623,7 +1635,11 @@ gfxPangoFontGroup::NewFontEntry(const gfxProxyFontEntry &aProxyEntry,
|
||||
utils->GetFontsForFullname(name);
|
||||
|
||||
if (fonts.Length() != 0)
|
||||
return new gfxLocalFcFontEntry(aProxyEntry, fonts);
|
||||
return new gfxLocalFcFontEntry(aFontName,
|
||||
aWeight,
|
||||
aStretch,
|
||||
aItalic,
|
||||
fonts);
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
@ -1661,8 +1677,12 @@ gfxPangoFontGroup::GetFTLibrary()
|
||||
}
|
||||
|
||||
/* static */ gfxFontEntry *
|
||||
gfxPangoFontGroup::NewFontEntry(const gfxProxyFontEntry &aProxyEntry,
|
||||
const uint8_t *aFontData, uint32_t aLength)
|
||||
gfxPangoFontGroup::NewFontEntry(const nsAString& aFontName,
|
||||
uint16_t aWeight,
|
||||
int16_t aStretch,
|
||||
bool aItalic,
|
||||
const uint8_t* aFontData,
|
||||
uint32_t aLength)
|
||||
{
|
||||
// Ownership of aFontData is passed in here, and transferred to the
|
||||
// new fontEntry, which will release it when no longer needed.
|
||||
@ -1677,7 +1697,9 @@ gfxPangoFontGroup::NewFontEntry(const gfxProxyFontEntry &aProxyEntry,
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return new gfxDownloadedFcFontEntry(aProxyEntry, aFontData, face);
|
||||
return new gfxDownloadedFcFontEntry(aFontName, aWeight,
|
||||
aStretch, aItalic,
|
||||
aFontData, face);
|
||||
}
|
||||
|
||||
|
||||
|
@ -17,7 +17,6 @@
|
||||
|
||||
class gfxFcFontSet;
|
||||
class gfxFcFont;
|
||||
class gfxProxyFontEntry;
|
||||
typedef struct _FcPattern FcPattern;
|
||||
typedef struct FT_FaceRec_* FT_Face;
|
||||
typedef struct FT_LibraryRec_ *FT_Library;
|
||||
@ -43,11 +42,16 @@ public:
|
||||
static void Shutdown();
|
||||
|
||||
// Used for @font-face { src: local(); }
|
||||
static gfxFontEntry *NewFontEntry(const gfxProxyFontEntry &aProxyEntry,
|
||||
const nsAString &aFullname);
|
||||
static gfxFontEntry *NewFontEntry(const nsAString& aFontName,
|
||||
uint16_t aWeight,
|
||||
int16_t aStretch,
|
||||
bool aItalic);
|
||||
// Used for @font-face { src: url(); }
|
||||
static gfxFontEntry *NewFontEntry(const gfxProxyFontEntry &aProxyEntry,
|
||||
const uint8_t *aFontData,
|
||||
static gfxFontEntry *NewFontEntry(const nsAString& aFontName,
|
||||
uint16_t aWeight,
|
||||
int16_t aStretch,
|
||||
bool aItalic,
|
||||
const uint8_t* aFontData,
|
||||
uint32_t aLength);
|
||||
|
||||
private:
|
||||
|
@ -1075,8 +1075,11 @@ gfxPlatform::UseGraphiteShaping()
|
||||
}
|
||||
|
||||
gfxFontEntry*
|
||||
gfxPlatform::MakePlatformFont(const gfxProxyFontEntry *aProxyEntry,
|
||||
const uint8_t *aFontData,
|
||||
gfxPlatform::MakePlatformFont(const nsAString& aFontName,
|
||||
uint16_t aWeight,
|
||||
int16_t aStretch,
|
||||
bool aItalic,
|
||||
const uint8_t* aFontData,
|
||||
uint32_t aLength)
|
||||
{
|
||||
// Default implementation does not handle activating downloaded fonts;
|
||||
|
@ -31,7 +31,6 @@ class gfxFontGroup;
|
||||
struct gfxFontStyle;
|
||||
class gfxUserFontSet;
|
||||
class gfxFontEntry;
|
||||
class gfxProxyFontEntry;
|
||||
class gfxPlatformFontList;
|
||||
class gfxTextRun;
|
||||
class nsIURI;
|
||||
@ -320,8 +319,10 @@ public:
|
||||
* Ownership of the returned gfxFontEntry is passed to the caller,
|
||||
* who must either AddRef() or delete.
|
||||
*/
|
||||
virtual gfxFontEntry* LookupLocalFont(const gfxProxyFontEntry *aProxyEntry,
|
||||
const nsAString& aFontName)
|
||||
virtual gfxFontEntry* LookupLocalFont(const nsAString& aFontName,
|
||||
uint16_t aWeight,
|
||||
int16_t aStretch,
|
||||
bool aItalic)
|
||||
{ return nullptr; }
|
||||
|
||||
/**
|
||||
@ -332,8 +333,11 @@ public:
|
||||
* Ownership of the returned gfxFontEntry is passed to the caller,
|
||||
* who must either AddRef() or delete.
|
||||
*/
|
||||
virtual gfxFontEntry* MakePlatformFont(const gfxProxyFontEntry *aProxyEntry,
|
||||
const uint8_t *aFontData,
|
||||
virtual gfxFontEntry* MakePlatformFont(const nsAString& aFontName,
|
||||
uint16_t aWeight,
|
||||
int16_t aStretch,
|
||||
bool aItalic,
|
||||
const uint8_t* aFontData,
|
||||
uint32_t aLength);
|
||||
|
||||
/**
|
||||
|
@ -149,13 +149,18 @@ public:
|
||||
virtual gfxFontFamily* GetDefaultFont(const gfxFontStyle* aStyle) = 0;
|
||||
|
||||
// look up a font by name on the host platform
|
||||
virtual gfxFontEntry* LookupLocalFont(const gfxProxyFontEntry *aProxyEntry,
|
||||
const nsAString& aFontName) = 0;
|
||||
virtual gfxFontEntry* LookupLocalFont(const nsAString& aFontName,
|
||||
uint16_t aWeight,
|
||||
int16_t aStretch,
|
||||
bool aItalic) = 0;
|
||||
|
||||
// create a new platform font from downloaded data (@font-face)
|
||||
// this method is responsible to ensure aFontData is NS_Free()'d
|
||||
virtual gfxFontEntry* MakePlatformFont(const gfxProxyFontEntry *aProxyEntry,
|
||||
const uint8_t *aFontData,
|
||||
virtual gfxFontEntry* MakePlatformFont(const nsAString& aFontName,
|
||||
uint16_t aWeight,
|
||||
int16_t aStretch,
|
||||
bool aItalic,
|
||||
const uint8_t* aFontData,
|
||||
uint32_t aLength) = 0;
|
||||
|
||||
// get the standard family name on the platform for a given font name
|
||||
|
@ -164,18 +164,26 @@ gfxPlatformGtk::CreateFontGroup(const FontFamilyList& aFontFamilyList,
|
||||
}
|
||||
|
||||
gfxFontEntry*
|
||||
gfxPlatformGtk::LookupLocalFont(const gfxProxyFontEntry *aProxyEntry,
|
||||
const nsAString& aFontName)
|
||||
gfxPlatformGtk::LookupLocalFont(const nsAString& aFontName,
|
||||
uint16_t aWeight,
|
||||
int16_t aStretch,
|
||||
bool aItalic)
|
||||
{
|
||||
return gfxPangoFontGroup::NewFontEntry(*aProxyEntry, aFontName);
|
||||
return gfxPangoFontGroup::NewFontEntry(aFontName, aWeight,
|
||||
aStretch, aItalic);
|
||||
}
|
||||
|
||||
gfxFontEntry*
|
||||
gfxPlatformGtk::MakePlatformFont(const gfxProxyFontEntry *aProxyEntry,
|
||||
const uint8_t *aFontData, uint32_t aLength)
|
||||
gfxPlatformGtk::MakePlatformFont(const nsAString& aFontName,
|
||||
uint16_t aWeight,
|
||||
int16_t aStretch,
|
||||
bool aItalic,
|
||||
const uint8_t* aFontData,
|
||||
uint32_t aLength)
|
||||
{
|
||||
// passing ownership of the font data to the new font entry
|
||||
return gfxPangoFontGroup::NewFontEntry(*aProxyEntry,
|
||||
return gfxPangoFontGroup::NewFontEntry(aFontName, aWeight,
|
||||
aStretch, aItalic,
|
||||
aFontData, aLength);
|
||||
}
|
||||
|
||||
|
@ -51,15 +51,20 @@ public:
|
||||
* Look up a local platform font using the full font face name (needed to
|
||||
* support @font-face src local() )
|
||||
*/
|
||||
virtual gfxFontEntry* LookupLocalFont(const gfxProxyFontEntry *aProxyEntry,
|
||||
const nsAString& aFontName);
|
||||
virtual gfxFontEntry* LookupLocalFont(const nsAString& aFontName,
|
||||
uint16_t aWeight,
|
||||
int16_t aStretch,
|
||||
bool aItalic);
|
||||
|
||||
/**
|
||||
* Activate a platform font (needed to support @font-face src url() )
|
||||
*
|
||||
*/
|
||||
virtual gfxFontEntry* MakePlatformFont(const gfxProxyFontEntry *aProxyEntry,
|
||||
const uint8_t *aFontData,
|
||||
virtual gfxFontEntry* MakePlatformFont(const nsAString& aFontName,
|
||||
uint16_t aWeight,
|
||||
int16_t aStretch,
|
||||
bool aItalic,
|
||||
const uint8_t* aFontData,
|
||||
uint32_t aLength);
|
||||
|
||||
/**
|
||||
|
@ -129,21 +129,32 @@ gfxPlatformMac::CreateFontGroup(const FontFamilyList& aFontFamilyList,
|
||||
|
||||
// these will move to gfxPlatform once all platforms support the fontlist
|
||||
gfxFontEntry*
|
||||
gfxPlatformMac::LookupLocalFont(const gfxProxyFontEntry *aProxyEntry,
|
||||
const nsAString& aFontName)
|
||||
gfxPlatformMac::LookupLocalFont(const nsAString& aFontName,
|
||||
uint16_t aWeight,
|
||||
int16_t aStretch,
|
||||
bool aItalic)
|
||||
{
|
||||
return gfxPlatformFontList::PlatformFontList()->LookupLocalFont(aProxyEntry,
|
||||
aFontName);
|
||||
return gfxPlatformFontList::PlatformFontList()->LookupLocalFont(aFontName,
|
||||
aWeight,
|
||||
aStretch,
|
||||
aItalic);
|
||||
}
|
||||
|
||||
gfxFontEntry*
|
||||
gfxPlatformMac::MakePlatformFont(const gfxProxyFontEntry *aProxyEntry,
|
||||
const uint8_t *aFontData, uint32_t aLength)
|
||||
gfxPlatformMac::MakePlatformFont(const nsAString& aFontName,
|
||||
uint16_t aWeight,
|
||||
int16_t aStretch,
|
||||
bool aItalic,
|
||||
const uint8_t* aFontData,
|
||||
uint32_t aLength)
|
||||
{
|
||||
// Ownership of aFontData is received here, and passed on to
|
||||
// gfxPlatformFontList::MakePlatformFont(), which must ensure the data
|
||||
// is released with NS_Free when no longer needed
|
||||
return gfxPlatformFontList::PlatformFontList()->MakePlatformFont(aProxyEntry,
|
||||
return gfxPlatformFontList::PlatformFontList()->MakePlatformFont(aFontName,
|
||||
aWeight,
|
||||
aStretch,
|
||||
aItalic,
|
||||
aFontData,
|
||||
aLength);
|
||||
}
|
||||
|
@ -39,13 +39,18 @@ public:
|
||||
const gfxFontStyle *aStyle,
|
||||
gfxUserFontSet *aUserFontSet);
|
||||
|
||||
virtual gfxFontEntry* LookupLocalFont(const gfxProxyFontEntry *aProxyEntry,
|
||||
const nsAString& aFontName);
|
||||
virtual gfxFontEntry* LookupLocalFont(const nsAString& aFontName,
|
||||
uint16_t aWeight,
|
||||
int16_t aStretch,
|
||||
bool aItalic);
|
||||
|
||||
virtual gfxPlatformFontList* CreatePlatformFontList();
|
||||
|
||||
virtual gfxFontEntry* MakePlatformFont(const gfxProxyFontEntry *aProxyEntry,
|
||||
const uint8_t *aFontData,
|
||||
virtual gfxFontEntry* MakePlatformFont(const nsAString& aFontName,
|
||||
uint16_t aWeight,
|
||||
int16_t aStretch,
|
||||
bool aItalic,
|
||||
const uint8_t* aFontData,
|
||||
uint32_t aLength);
|
||||
|
||||
bool IsFontFormatSupported(nsIURI *aFontURI, uint32_t aFormatFlags);
|
||||
|
@ -131,18 +131,26 @@ gfxQtPlatform::CreateFontGroup(const FontFamilyList& aFontFamilyList,
|
||||
}
|
||||
|
||||
gfxFontEntry*
|
||||
gfxQtPlatform::LookupLocalFont(const gfxProxyFontEntry *aProxyEntry,
|
||||
const nsAString& aFontName)
|
||||
gfxQtPlatform::LookupLocalFont(const nsAString& aFontName,
|
||||
uint16_t aWeight,
|
||||
int16_t aStretch,
|
||||
bool aItalic)
|
||||
{
|
||||
return gfxPangoFontGroup::NewFontEntry(*aProxyEntry, aFontName);
|
||||
return gfxPangoFontGroup::NewFontEntry(aFontName, aWeight,
|
||||
aStretch, aItalic);
|
||||
}
|
||||
|
||||
gfxFontEntry*
|
||||
gfxQtPlatform::MakePlatformFont(const gfxProxyFontEntry *aProxyEntry,
|
||||
const uint8_t *aFontData, uint32_t aLength)
|
||||
gfxQtPlatform::MakePlatformFont(const nsAString& aFontName,
|
||||
uint16_t aWeight,
|
||||
int16_t aStretch,
|
||||
bool aItalic,
|
||||
const uint8_t* aFontData,
|
||||
uint32_t aLength)
|
||||
{
|
||||
// passing ownership of the font data to the new font entry
|
||||
return gfxPangoFontGroup::NewFontEntry(*aProxyEntry,
|
||||
return gfxPangoFontGroup::NewFontEntry(aFontName, aWeight,
|
||||
aStretch, aItalic,
|
||||
aFontData, aLength);
|
||||
}
|
||||
|
||||
|
@ -49,15 +49,20 @@ public:
|
||||
* Look up a local platform font using the full font face name (needed to
|
||||
* support @font-face src local() )
|
||||
*/
|
||||
virtual gfxFontEntry* LookupLocalFont(const gfxProxyFontEntry *aProxyEntry,
|
||||
const nsAString& aFontName) MOZ_OVERRIDE;
|
||||
virtual gfxFontEntry* LookupLocalFont(const nsAString& aFontName,
|
||||
uint16_t aWeight,
|
||||
int16_t aStretch,
|
||||
bool aItalic) MOZ_OVERRIDE;
|
||||
|
||||
/**
|
||||
* Activate a platform font (needed to support @font-face src url() )
|
||||
*
|
||||
*/
|
||||
virtual gfxFontEntry* MakePlatformFont(const gfxProxyFontEntry *aProxyEntry,
|
||||
const uint8_t *aFontData,
|
||||
virtual gfxFontEntry* MakePlatformFont(const nsAString& aFontName,
|
||||
uint16_t aWeight,
|
||||
int16_t aStretch,
|
||||
bool aItalic,
|
||||
const uint8_t* aFontData,
|
||||
uint32_t aLength) MOZ_OVERRIDE;
|
||||
|
||||
/**
|
||||
|
@ -338,8 +338,10 @@ gfxProxyFontEntry::LoadNext(gfxMixedFontFamily *aFamily,
|
||||
|
||||
if (currSrc.mIsLocal) {
|
||||
gfxFontEntry *fe =
|
||||
gfxPlatform::GetPlatform()->LookupLocalFont(this,
|
||||
currSrc.mLocalName);
|
||||
gfxPlatform::GetPlatform()->LookupLocalFont(currSrc.mLocalName,
|
||||
mWeight,
|
||||
mStretch,
|
||||
mItalic);
|
||||
aLocalRulesUsed = true;
|
||||
if (fe) {
|
||||
LOG(("fontset (%p) [src %d] loaded local: (%s) for (%s) gen: %8.8x\n",
|
||||
@ -468,7 +470,7 @@ gfxProxyFontEntry::LoadNext(gfxMixedFontFamily *aFamily,
|
||||
|
||||
gfxFontEntry*
|
||||
gfxProxyFontEntry::LoadFont(gfxMixedFontFamily *aFamily,
|
||||
const uint8_t *aFontData, uint32_t &aLength)
|
||||
const uint8_t* aFontData, uint32_t &aLength)
|
||||
{
|
||||
gfxFontEntry *fe = nullptr;
|
||||
|
||||
@ -501,7 +503,11 @@ gfxProxyFontEntry::LoadFont(gfxMixedFontFamily *aFamily,
|
||||
originalFullName);
|
||||
// Here ownership of saneData is passed to the platform,
|
||||
// which will delete it when no longer required
|
||||
fe = gfxPlatform::GetPlatform()->MakePlatformFont(this,
|
||||
|
||||
fe = gfxPlatform::GetPlatform()->MakePlatformFont(mName,
|
||||
mWeight,
|
||||
mStretch,
|
||||
mItalic,
|
||||
saneData,
|
||||
saneLen);
|
||||
if (!fe) {
|
||||
@ -746,7 +752,7 @@ gfxUserFontSet::FindFontEntry(gfxFontFamily *aFamily,
|
||||
bool
|
||||
gfxUserFontSet::OnLoadComplete(gfxMixedFontFamily *aFamily,
|
||||
gfxProxyFontEntry *aProxy,
|
||||
const uint8_t *aFontData, uint32_t aLength,
|
||||
const uint8_t* aFontData, uint32_t aLength,
|
||||
nsresult aDownloadStatus)
|
||||
{
|
||||
// forget about the loader, as we no longer potentially need to cancel it
|
||||
|
@ -258,7 +258,7 @@ public:
|
||||
// ensure that it is eventually deleted with NS_Free().
|
||||
bool OnLoadComplete(gfxMixedFontFamily *aFamily,
|
||||
gfxProxyFontEntry *aProxy,
|
||||
const uint8_t *aFontData, uint32_t aLength,
|
||||
const uint8_t* aFontData, uint32_t aLength,
|
||||
nsresult aDownloadStatus);
|
||||
|
||||
// Replace a proxy with a real fontEntry; this is implemented in
|
||||
@ -570,7 +570,7 @@ protected:
|
||||
// Ownership of aFontData is passed in here; the font must
|
||||
// ensure that it is eventually deleted with NS_Free().
|
||||
gfxFontEntry* LoadFont(gfxMixedFontFamily *aFamily,
|
||||
const uint8_t *aFontData, uint32_t &aLength);
|
||||
const uint8_t* aFontData, uint32_t &aLength);
|
||||
|
||||
// store metadata and src details for current src into aFontEntry
|
||||
void StoreUserFontData(gfxFontEntry* aFontEntry,
|
||||
|
@ -910,18 +910,29 @@ gfxWindowsPlatform::CreateFontGroup(const FontFamilyList& aFontFamilyList,
|
||||
}
|
||||
|
||||
gfxFontEntry*
|
||||
gfxWindowsPlatform::LookupLocalFont(const gfxProxyFontEntry *aProxyEntry,
|
||||
const nsAString& aFontName)
|
||||
gfxWindowsPlatform::LookupLocalFont(const nsAString& aFontName,
|
||||
uint16_t aWeight,
|
||||
int16_t aStretch,
|
||||
bool aItalic)
|
||||
{
|
||||
return gfxPlatformFontList::PlatformFontList()->LookupLocalFont(aProxyEntry,
|
||||
aFontName);
|
||||
return gfxPlatformFontList::PlatformFontList()->LookupLocalFont(aFontName,
|
||||
aWeight,
|
||||
aStretch,
|
||||
aItalic);
|
||||
}
|
||||
|
||||
gfxFontEntry*
|
||||
gfxWindowsPlatform::MakePlatformFont(const gfxProxyFontEntry *aProxyEntry,
|
||||
const uint8_t *aFontData, uint32_t aLength)
|
||||
gfxWindowsPlatform::MakePlatformFont(const nsAString& aFontName,
|
||||
uint16_t aWeight,
|
||||
int16_t aStretch,
|
||||
bool aItalic,
|
||||
const uint8_t* aFontData,
|
||||
uint32_t aLength)
|
||||
{
|
||||
return gfxPlatformFontList::PlatformFontList()->MakePlatformFont(aProxyEntry,
|
||||
return gfxPlatformFontList::PlatformFontList()->MakePlatformFont(aFontName,
|
||||
aWeight,
|
||||
aStretch,
|
||||
aItalic,
|
||||
aFontData,
|
||||
aLength);
|
||||
}
|
||||
|
@ -199,14 +199,19 @@ public:
|
||||
/**
|
||||
* Look up a local platform font using the full font face name (needed to support @font-face src local() )
|
||||
*/
|
||||
virtual gfxFontEntry* LookupLocalFont(const gfxProxyFontEntry *aProxyEntry,
|
||||
const nsAString& aFontName);
|
||||
virtual gfxFontEntry* LookupLocalFont(const nsAString& aFontName,
|
||||
uint16_t aWeight,
|
||||
int16_t aStretch,
|
||||
bool aItalic);
|
||||
|
||||
/**
|
||||
* Activate a platform font (needed to support @font-face src url() )
|
||||
*/
|
||||
virtual gfxFontEntry* MakePlatformFont(const gfxProxyFontEntry *aProxyEntry,
|
||||
const uint8_t *aFontData,
|
||||
virtual gfxFontEntry* MakePlatformFont(const nsAString& aFontName,
|
||||
uint16_t aWeight,
|
||||
int16_t aStretch,
|
||||
bool aItalic,
|
||||
const uint8_t* aFontData,
|
||||
uint32_t aLength);
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user