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