Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
michael@0 | 1 | /* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 4 -*- |
michael@0 | 2 | * This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 3 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 4 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 5 | |
michael@0 | 6 | #ifndef GFX_FT2FONTBASE_H |
michael@0 | 7 | #define GFX_FT2FONTBASE_H |
michael@0 | 8 | |
michael@0 | 9 | #include "cairo.h" |
michael@0 | 10 | #include "gfxContext.h" |
michael@0 | 11 | #include "gfxFont.h" |
michael@0 | 12 | #include "mozilla/gfx/2D.h" |
michael@0 | 13 | |
michael@0 | 14 | class gfxFT2FontBase : public gfxFont { |
michael@0 | 15 | public: |
michael@0 | 16 | gfxFT2FontBase(cairo_scaled_font_t *aScaledFont, |
michael@0 | 17 | gfxFontEntry *aFontEntry, |
michael@0 | 18 | const gfxFontStyle *aFontStyle); |
michael@0 | 19 | virtual ~gfxFT2FontBase(); |
michael@0 | 20 | |
michael@0 | 21 | uint32_t GetGlyph(uint32_t aCharCode); |
michael@0 | 22 | void GetGlyphExtents(uint32_t aGlyph, |
michael@0 | 23 | cairo_text_extents_t* aExtents); |
michael@0 | 24 | virtual const gfxFont::Metrics& GetMetrics(); |
michael@0 | 25 | virtual uint32_t GetSpaceGlyph(); |
michael@0 | 26 | virtual bool ProvidesGetGlyph() const { return true; } |
michael@0 | 27 | virtual uint32_t GetGlyph(uint32_t unicode, uint32_t variation_selector); |
michael@0 | 28 | virtual bool ProvidesGlyphWidths() { return true; } |
michael@0 | 29 | virtual int32_t GetGlyphWidth(gfxContext *aCtx, uint16_t aGID); |
michael@0 | 30 | |
michael@0 | 31 | cairo_scaled_font_t *CairoScaledFont() { return mScaledFont; }; |
michael@0 | 32 | virtual bool SetupCairoFont(gfxContext *aContext); |
michael@0 | 33 | |
michael@0 | 34 | virtual FontType GetType() const { return FONT_TYPE_FT2; } |
michael@0 | 35 | |
michael@0 | 36 | mozilla::gfx::FontOptions* GetFontOptions() { return &mFontOptions; } |
michael@0 | 37 | protected: |
michael@0 | 38 | uint32_t mSpaceGlyph; |
michael@0 | 39 | bool mHasMetrics; |
michael@0 | 40 | Metrics mMetrics; |
michael@0 | 41 | |
michael@0 | 42 | // Azure font description |
michael@0 | 43 | mozilla::gfx::FontOptions mFontOptions; |
michael@0 | 44 | void ConstructFontOptions(); |
michael@0 | 45 | }; |
michael@0 | 46 | |
michael@0 | 47 | #endif /* GFX_FT2FONTBASE_H */ |