/src/mozilla-central/gfx/2d/ScaledFontFontconfig.h
Line | Count | Source (jump to first uncovered line) |
1 | | /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
2 | | /* vim: set ts=8 sts=2 et sw=2 tw=80: */ |
3 | | /* This Source Code Form is subject to the terms of the Mozilla Public |
4 | | * License, v. 2.0. If a copy of the MPL was not distributed with this |
5 | | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
6 | | |
7 | | #ifndef MOZILLA_GFX_SCALEDFONTFONTCONFIG_H_ |
8 | | #define MOZILLA_GFX_SCALEDFONTFONTCONFIG_H_ |
9 | | |
10 | | #include "ScaledFontBase.h" |
11 | | |
12 | | #include <cairo-ft.h> |
13 | | |
14 | | namespace mozilla { |
15 | | namespace gfx { |
16 | | |
17 | | class NativeFontResourceFontconfig; |
18 | | class UnscaledFontFontconfig; |
19 | | |
20 | | class ScaledFontFontconfig : public ScaledFontBase |
21 | | { |
22 | | public: |
23 | | MOZ_DECLARE_REFCOUNTED_VIRTUAL_TYPENAME(ScaledFontFontconfig, override) |
24 | | ScaledFontFontconfig(cairo_scaled_font_t* aScaledFont, FcPattern* aPattern, |
25 | | const RefPtr<UnscaledFont>& aUnscaledFont, Float aSize); |
26 | | ~ScaledFontFontconfig(); |
27 | | |
28 | 0 | FontType GetType() const override { return FontType::FONTCONFIG; } |
29 | | |
30 | | #ifdef USE_SKIA |
31 | | SkTypeface* CreateSkTypeface() override; |
32 | | #endif |
33 | | |
34 | 0 | bool CanSerialize() override { return true; } |
35 | | |
36 | | bool GetFontInstanceData(FontInstanceDataOutput aCb, void* aBaton) override; |
37 | | |
38 | | bool GetWRFontInstanceOptions(Maybe<wr::FontInstanceOptions>* aOutOptions, |
39 | | Maybe<wr::FontInstancePlatformOptions>* aOutPlatformOptions, |
40 | | std::vector<FontVariation>* aOutVariations) override; |
41 | | |
42 | | bool HasVariationSettings() override; |
43 | | |
44 | | private: |
45 | | friend class NativeFontResourceFontconfig; |
46 | | friend class UnscaledFontFontconfig; |
47 | | |
48 | | struct InstanceData |
49 | | { |
50 | | enum { |
51 | | ANTIALIAS = 1 << 0, |
52 | | AUTOHINT = 1 << 1, |
53 | | EMBEDDED_BITMAP = 1 << 2, |
54 | | EMBOLDEN = 1 << 3, |
55 | | VERTICAL_LAYOUT = 1 << 4, |
56 | | HINT_METRICS = 1 << 5 |
57 | | }; |
58 | | |
59 | | InstanceData(cairo_scaled_font_t* aScaledFont, FcPattern* aPattern); |
60 | | InstanceData(const wr::FontInstanceOptions* aOptions, |
61 | | const wr::FontInstancePlatformOptions* aPlatformOptions); |
62 | | |
63 | | void SetupPattern(FcPattern* aPattern) const; |
64 | | void SetupFontOptions(cairo_font_options_t* aFontOptions) const; |
65 | | |
66 | | uint8_t mFlags; |
67 | | uint8_t mHintStyle; |
68 | | uint8_t mSubpixelOrder; |
69 | | uint8_t mLcdFilter; |
70 | | }; |
71 | | |
72 | | FcPattern* mPattern; |
73 | | }; |
74 | | |
75 | | } |
76 | | } |
77 | | |
78 | | #endif /* MOZILLA_GFX_SCALEDFONTFONTCONFIG_H_ */ |