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 uint32_t GetSpaceGlyph() override;
ProvidesGetGlyph()25     virtual bool ProvidesGetGlyph() const override { return true; }
26     virtual uint32_t GetGlyph(uint32_t unicode,
27                               uint32_t variation_selector) override;
ProvidesGlyphWidths()28     virtual bool ProvidesGlyphWidths() const override { return true; }
29     virtual int32_t GetGlyphWidth(DrawTarget& aDrawTarget,
30                                   uint16_t aGID) override;
31 
CairoScaledFont()32     cairo_scaled_font_t *CairoScaledFont() { return mScaledFont; };
33     virtual bool SetupCairoFont(DrawTarget* aDrawTarget) override;
34 
GetType()35     virtual FontType GetType() const override { return FONT_TYPE_FT2; }
36 
37 protected:
38     virtual const Metrics& GetHorizontalMetrics() override;
39 
40     uint32_t mSpaceGlyph;
41     bool mHasMetrics;
42     Metrics mMetrics;
43 };
44 
45 #endif /* GFX_FT2FONTBASE_H */
46