From 49dd7a2abe189c3e2cfa016584ffca062fbb1a39 Mon Sep 17 00:00:00 2001 From: Brendan Dahl Date: Mon, 12 Nov 2012 11:35:49 -0800 Subject: [PATCH] Bug 791466 - Fix direct write cairo scaled font. r=Bas --- gfx/thebes/gfxDWriteFonts.cpp | 6 +++--- gfx/thebes/gfxDWriteFonts.h | 4 ++-- gfx/thebes/gfxFont.h | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/gfx/thebes/gfxDWriteFonts.cpp b/gfx/thebes/gfxDWriteFonts.cpp index 715eef21e3b..9a23e35f788 100644 --- a/gfx/thebes/gfxDWriteFonts.cpp +++ b/gfx/thebes/gfxDWriteFonts.cpp @@ -485,7 +485,7 @@ gfxDWriteFont::GetSpaceGlyph() bool gfxDWriteFont::SetupCairoFont(gfxContext *aContext) { - cairo_scaled_font_t *scaledFont = CairoScaledFont(); + cairo_scaled_font_t *scaledFont = GetCairoScaledFont(); if (cairo_scaled_font_status(scaledFont) != CAIRO_STATUS_SUCCESS) { // Don't cairo_set_scaled_font as that would propagate the error to // the cairo_t, precluding any further drawing. @@ -522,7 +522,7 @@ gfxDWriteFont::CairoFontFace() cairo_scaled_font_t * -gfxDWriteFont::CairoScaledFont() +gfxDWriteFont::GetCairoScaledFont() { if (!mScaledFont) { cairo_matrix_t sizeMatrix; @@ -763,7 +763,7 @@ gfxDWriteFont::GetScaledFont(mozilla::gfx::DrawTarget *aTarget) if (wantCairo) { mAzureScaledFont = Factory::CreateScaledFontWithCairo(nativeFont, GetAdjustedSize(), - CairoScaledFont()); + GetCairoScaledFont()); } else { mAzureScaledFont = Factory::CreateScaledFontForNativeFont(nativeFont, GetAdjustedSize()); diff --git a/gfx/thebes/gfxDWriteFonts.h b/gfx/thebes/gfxDWriteFonts.h index ca8042a2df0..427fb2b883c 100644 --- a/gfx/thebes/gfxDWriteFonts.h +++ b/gfx/thebes/gfxDWriteFonts.h @@ -71,6 +71,8 @@ public: virtual mozilla::TemporaryRef GetScaledFont(mozilla::gfx::DrawTarget *aTarget); + virtual cairo_scaled_font_t *GetCairoScaledFont(); + protected: friend class gfxDWriteShaper; @@ -84,8 +86,6 @@ protected: cairo_font_face_t *CairoFontFace(); - cairo_scaled_font_t *CairoScaledFont(); - gfxFloat MeasureGlyphWidth(uint16_t aGlyph); static void DestroyBlobFunc(void* userArg); diff --git a/gfx/thebes/gfxFont.h b/gfx/thebes/gfxFont.h index 152b543fd13..33a0a103910 100644 --- a/gfx/thebes/gfxFont.h +++ b/gfx/thebes/gfxFont.h @@ -1262,7 +1262,7 @@ public: const nsString& GetName() const { return mFontEntry->Name(); } const gfxFontStyle *GetStyle() const { return &mStyle; } - cairo_scaled_font_t* GetCairoScaledFont() { return mScaledFont; } + virtual cairo_scaled_font_t* GetCairoScaledFont() { return mScaledFont; } virtual gfxFont* CopyWithAntialiasOption(AntialiasOption anAAOption) { // platforms where this actually matters should override