Update configs. IGNORE BROKEN CHANGESETS CLOSED TREE NO BUG a=release ba=release
[gecko.git] / gfx / 2d / ScaledFontFreeType.h
blob5a76e8e6c076af924722a8cbfb7fcd97c9dd7081
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/. */
7 #ifndef MOZILLA_GFX_SCALEDFONTCAIRO_H_
8 #define MOZILLA_GFX_SCALEDFONTCAIRO_H_
10 #include "ScaledFontBase.h"
12 #include <cairo-ft.h>
14 namespace mozilla {
15 namespace gfx {
17 class UnscaledFontFreeType;
19 class ScaledFontFreeType : public ScaledFontBase {
20 public:
21 MOZ_DECLARE_REFCOUNTED_VIRTUAL_TYPENAME(ScaledFontFreeType, override)
23 ScaledFontFreeType(RefPtr<SharedFTFace>&& aFace,
24 const RefPtr<UnscaledFont>& aUnscaledFont, Float aSize,
25 bool aApplySyntheticBold = false);
27 FontType GetType() const override { return FontType::FREETYPE; }
29 SkTypeface* CreateSkTypeface() override;
30 void SetupSkFontDrawOptions(SkFont& aFont) override;
32 AntialiasMode GetDefaultAAMode() override { return AntialiasMode::GRAY; }
34 bool UseSubpixelPosition() const override;
36 bool CanSerialize() override { return true; }
38 bool MayUseBitmaps() override;
40 bool GetFontInstanceData(FontInstanceDataOutput aCb, void* aBaton) override;
42 bool GetWRFontInstanceOptions(
43 Maybe<wr::FontInstanceOptions>* aOutOptions,
44 Maybe<wr::FontInstancePlatformOptions>* aOutPlatformOptions,
45 std::vector<FontVariation>* aOutVariations) override;
47 bool HasVariationSettings() override;
49 protected:
50 cairo_font_face_t* CreateCairoFontFace(
51 cairo_font_options_t* aFontOptions) override;
53 private:
54 friend UnscaledFontFreeType;
56 RefPtr<SharedFTFace> mFace;
58 bool mApplySyntheticBold;
60 struct InstanceData {
61 explicit InstanceData(ScaledFontFreeType* aScaledFont)
62 : mApplySyntheticBold(aScaledFont->mApplySyntheticBold) {}
64 InstanceData(const wr::FontInstanceOptions* aOptions,
65 const wr::FontInstancePlatformOptions* aPlatformOptions);
67 bool mApplySyntheticBold;
71 } // namespace gfx
72 } // namespace mozilla
74 #endif /* MOZILLA_GFX_SCALEDFONTCAIRO_H_ */