Line data Source code
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 : #include "mozilla/gfx/UnscaledFontFreeType.h"
14 :
15 : class gfxFT2FontBase : public gfxFont {
16 : public:
17 : gfxFT2FontBase(const RefPtr<mozilla::gfx::UnscaledFontFreeType>& aUnscaledFont,
18 : cairo_scaled_font_t *aScaledFont,
19 : gfxFontEntry *aFontEntry,
20 : const gfxFontStyle *aFontStyle);
21 : virtual ~gfxFT2FontBase();
22 :
23 : uint32_t GetGlyph(uint32_t aCharCode);
24 : void GetGlyphExtents(uint32_t aGlyph,
25 : cairo_text_extents_t* aExtents);
26 : virtual uint32_t GetSpaceGlyph() override;
27 2 : virtual bool ProvidesGetGlyph() const override { return true; }
28 : virtual uint32_t GetGlyph(uint32_t unicode,
29 : uint32_t variation_selector) override;
30 267 : virtual bool ProvidesGlyphWidths() const override { return true; }
31 : virtual int32_t GetGlyphWidth(DrawTarget& aDrawTarget,
32 : uint16_t aGID) override;
33 :
34 861 : cairo_scaled_font_t *CairoScaledFont() { return mScaledFont; };
35 : virtual bool SetupCairoFont(DrawTarget* aDrawTarget) override;
36 :
37 0 : virtual FontType GetType() const override { return FONT_TYPE_FT2; }
38 :
39 : protected:
40 : virtual const Metrics& GetHorizontalMetrics() override;
41 :
42 : uint32_t mSpaceGlyph;
43 : bool mHasMetrics;
44 : Metrics mMetrics;
45 : };
46 :
47 : #endif /* GFX_FT2FONTBASE_H */
|