michael@0: /* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 4 -*- 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 GFX_FT2FONTBASE_H michael@0: #define GFX_FT2FONTBASE_H michael@0: michael@0: #include "cairo.h" michael@0: #include "gfxContext.h" michael@0: #include "gfxFont.h" michael@0: #include "mozilla/gfx/2D.h" michael@0: michael@0: class gfxFT2FontBase : public gfxFont { michael@0: public: michael@0: gfxFT2FontBase(cairo_scaled_font_t *aScaledFont, michael@0: gfxFontEntry *aFontEntry, michael@0: const gfxFontStyle *aFontStyle); michael@0: virtual ~gfxFT2FontBase(); michael@0: michael@0: uint32_t GetGlyph(uint32_t aCharCode); michael@0: void GetGlyphExtents(uint32_t aGlyph, michael@0: cairo_text_extents_t* aExtents); michael@0: virtual const gfxFont::Metrics& GetMetrics(); michael@0: virtual uint32_t GetSpaceGlyph(); michael@0: virtual bool ProvidesGetGlyph() const { return true; } michael@0: virtual uint32_t GetGlyph(uint32_t unicode, uint32_t variation_selector); michael@0: virtual bool ProvidesGlyphWidths() { return true; } michael@0: virtual int32_t GetGlyphWidth(gfxContext *aCtx, uint16_t aGID); michael@0: michael@0: cairo_scaled_font_t *CairoScaledFont() { return mScaledFont; }; michael@0: virtual bool SetupCairoFont(gfxContext *aContext); michael@0: michael@0: virtual FontType GetType() const { return FONT_TYPE_FT2; } michael@0: michael@0: mozilla::gfx::FontOptions* GetFontOptions() { return &mFontOptions; } michael@0: protected: michael@0: uint32_t mSpaceGlyph; michael@0: bool mHasMetrics; michael@0: Metrics mMetrics; michael@0: michael@0: // Azure font description michael@0: mozilla::gfx::FontOptions mFontOptions; michael@0: void ConstructFontOptions(); michael@0: }; michael@0: michael@0: #endif /* GFX_FT2FONTBASE_H */