Bug 792207 - Part 3: Add UserData to ScaledFont. r=jrmuizel

This commit is contained in:
Bas Schouten 2012-09-24 15:02:49 +00:00
parent 97f01fd610
commit 8cf02dc4f8
2 changed files with 27 additions and 0 deletions

View File

@ -476,8 +476,17 @@ public:
virtual bool GetFontFileData(FontFileDataOutput, void *) { return false; }
void AddUserData(UserDataKey *key, void *userData, void (*destroy)(void*)) {
mUserData.Add(key, userData, destroy);
}
void *GetUserData(UserDataKey *key) {
return mUserData.Get(key);
}
protected:
ScaledFont() {}
UserData mUserData;
};
#ifdef MOZ_ENABLE_FREETYPE

View File

@ -284,6 +284,24 @@ Factory::CreateScaledFontForNativeFont(const NativeFont &aNativeFont, Float aSiz
}
}
TemporaryRef<ScaledFont>
Factory::CreateScaledFontForTrueTypeData(uint8_t *aData, uint32_t aSize,
uint32_t aFaceIndex, Float aGlyphSize,
FontType aType)
{
switch (aType) {
#ifdef WIN32
case FONT_DWRITE:
{
return new ScaledFontDWrite(aData, aSize, aFaceIndex, aGlyphSize);
}
#endif
default:
gfxWarning() << "Unable to create requested font type from truetype data";
return nullptr;
}
}
TemporaryRef<ScaledFont>
Factory::CreateScaledFontWithCairo(const NativeFont& aNativeFont, Float aSize, cairo_scaled_font_t* aScaledFont)
{