michael@0: /* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*- michael@0: * This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #ifndef MOZILLA_GFX_SCALEDFONTCAIRO_H_ michael@0: #define MOZILLA_GFX_SCALEDFONTCAIRO_H_ michael@0: michael@0: #include "ScaledFontBase.h" michael@0: michael@0: #include "cairo.h" michael@0: michael@0: namespace mozilla { michael@0: namespace gfx { michael@0: michael@0: class ScaledFontCairo : public ScaledFontBase michael@0: { michael@0: public: michael@0: MOZ_DECLARE_REFCOUNTED_VIRTUAL_TYPENAME(ScaledFontCairo) michael@0: michael@0: ScaledFontCairo(cairo_scaled_font_t* aScaledFont, Float aSize); michael@0: michael@0: #if defined(USE_SKIA) && defined(MOZ_ENABLE_FREETYPE) michael@0: virtual SkTypeface* GetSkTypeface(); michael@0: #endif michael@0: }; michael@0: michael@0: // We need to be able to tell Skia whether or not to use michael@0: // hinting when rendering text, so that the glyphs it renders michael@0: // are the same as what layout is expecting. At the moment, only michael@0: // Skia uses this class when rendering with FreeType, as gfxFT2Font michael@0: // is the only gfxFont that honours gfxPlatform::FontHintingEnabled(). michael@0: class GlyphRenderingOptionsCairo : public GlyphRenderingOptions michael@0: { michael@0: public: michael@0: MOZ_DECLARE_REFCOUNTED_VIRTUAL_TYPENAME(GlyphRenderingOptionsCairo) michael@0: GlyphRenderingOptionsCairo() michael@0: : mHinting(FontHinting::NORMAL) michael@0: , mAutoHinting(false) michael@0: { michael@0: } michael@0: michael@0: void SetHinting(FontHinting aHinting) { mHinting = aHinting; } michael@0: void SetAutoHinting(bool aAutoHinting) { mAutoHinting = aAutoHinting; } michael@0: FontHinting GetHinting() const { return mHinting; } michael@0: bool GetAutoHinting() const { return mAutoHinting; } michael@0: virtual FontType GetType() const { return FontType::CAIRO; } michael@0: private: michael@0: FontHinting mHinting; michael@0: bool mAutoHinting; michael@0: }; michael@0: michael@0: } michael@0: } michael@0: michael@0: #endif /* MOZILLA_GFX_SCALEDFONTCAIRO_H_ */