Bug 761895; Fixed Azure/Cairo canvas font support on gtk and android. r=karl

This commit is contained in:
Anthony Jones 2012-07-24 22:18:39 +12:00
parent 84e07e74a9
commit 261a342f09
5 changed files with 21 additions and 13 deletions

View File

@ -261,7 +261,9 @@ Factory::CreateScaledFontForNativeFont(const NativeFont &aNativeFont, Float aSiz
#ifdef USE_CAIRO
case NATIVE_FONT_CAIRO_FONT_FACE:
{
return new ScaledFontBase(aSize);
ScaledFontBase* fontBase = new ScaledFontBase(aSize);
fontBase->SetCairoScaledFont(static_cast<cairo_scaled_font_t*>(aNativeFont.mFont));
return fontBase;
}
#endif
default:

View File

@ -163,14 +163,17 @@ gfxAndroidPlatform::MakePlatformFont(const gfxProxyFontEntry *aProxyEntry,
RefPtr<ScaledFont>
gfxAndroidPlatform::GetScaledFontForFont(DrawTarget* aTarget, gfxFont *aFont)
{
NS_ASSERTION(aFont->GetType() == gfxFont::FONT_TYPE_FT2, "Expecting Freetype font");
NativeFont nativeFont;
if (aTarget->GetType() == BACKEND_CAIRO) {
nativeFont.mType = NATIVE_FONT_CAIRO_FONT_FACE;
nativeFont.mFont = NULL;
return Factory::CreateScaledFontWithCairo(nativeFont, aFont->GetAdjustedSize(), aFont->GetCairoScaledFont());
}
NS_ASSERTION(aFont->GetType() == gfxFont::FONT_TYPE_FT2, "Expecting Freetype font");
nativeFont.mType = NATIVE_FONT_SKIA_FONT_FACE;
nativeFont.mFont = static_cast<gfxFT2FontBase*>(aFont)->GetFontOptions();
RefPtr<ScaledFont> scaledFont =
Factory::CreateScaledFontForNativeFont(nativeFont, aFont->GetAdjustedSize());
return scaledFont;
return Factory::CreateScaledFontForNativeFont(nativeFont, aFont->GetAdjustedSize());
}
bool

View File

@ -1547,7 +1547,8 @@ public:
FONT_TYPE_GDI,
FONT_TYPE_FT2,
FONT_TYPE_MAC,
FONT_TYPE_OS2
FONT_TYPE_OS2,
FONT_TYPE_CAIRO
} FontType;
virtual FontType GetType() const = 0;

View File

@ -606,7 +606,7 @@ gfxPlatform::GetScaledFontForFont(DrawTarget* aTarget, gfxFont *aFont)
{
NativeFont nativeFont;
nativeFont.mType = NATIVE_FONT_CAIRO_FONT_FACE;
nativeFont.mFont = aFont;
nativeFont.mFont = aFont->GetCairoScaledFont();
RefPtr<ScaledFont> scaledFont =
Factory::CreateScaledFontForNativeFont(nativeFont,
aFont->GetAdjustedSize());

View File

@ -732,14 +732,16 @@ gfxPlatformGtk::GetGdkDrawable(gfxASurface *target)
RefPtr<ScaledFont>
gfxPlatformGtk::GetScaledFontForFont(DrawTarget* aTarget, gfxFont *aFont)
{
NS_ASSERTION(aFont->GetType() == gfxFont::FONT_TYPE_FT2, "Expecting Freetype font");
NativeFont nativeFont;
if (aTarget->GetType() == BACKEND_CAIRO) {
nativeFont.mType = NATIVE_FONT_CAIRO_FONT_FACE;
nativeFont.mFont = NULL;
return Factory::CreateScaledFontWithCairo(nativeFont, aFont->GetAdjustedSize(), aFont->GetCairoScaledFont());
}
NS_ASSERTION(aFont->GetType() == gfxFont::FONT_TYPE_FT2, "Expecting Freetype font");
nativeFont.mType = NATIVE_FONT_SKIA_FONT_FACE;
nativeFont.mFont = static_cast<gfxFT2FontBase*>(aFont)->GetFontOptions();
RefPtr<ScaledFont> scaledFont =
Factory::CreateScaledFontForNativeFont(nativeFont, aFont->GetAdjustedSize());
return scaledFont;
return Factory::CreateScaledFontForNativeFont(nativeFont, aFont->GetAdjustedSize());
}
bool