Bug 1890689 accumulate input in LargerReceiverBlockSizeThanDesiredBuffering GTest...
[gecko.git] / gfx / 2d / UnscaledFontDWrite.h
blobfeed55379031d4869dfcba32889b1b2d80c4da8f
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_UNSCALEDFONTDWRITE_H_
8 #define MOZILLA_GFX_UNSCALEDFONTDWRITE_H_
10 #include <dwrite.h>
12 #include "2D.h"
14 namespace mozilla {
15 namespace gfx {
17 class ScaledFontDWrite;
19 class UnscaledFontDWrite final : public UnscaledFont {
20 public:
21 MOZ_DECLARE_REFCOUNTED_VIRTUAL_TYPENAME(UnscaledFontDWrite, override)
22 UnscaledFontDWrite(const RefPtr<IDWriteFontFace>& aFontFace,
23 const RefPtr<IDWriteFont>& aFont)
24 : mFontFace(aFontFace), mFont(aFont) {}
26 FontType GetType() const override { return FontType::DWRITE; }
28 const RefPtr<IDWriteFontFace>& GetFontFace() const { return mFontFace; }
29 const RefPtr<IDWriteFont>& GetFont() const { return mFont; }
31 bool GetFontFileData(FontFileDataOutput aDataCallback, void* aBaton) override;
33 already_AddRefed<ScaledFont> CreateScaledFont(
34 Float aGlyphSize, const uint8_t* aInstanceData,
35 uint32_t aInstanceDataLength, const FontVariation* aVariations,
36 uint32_t aNumVariations) override;
38 already_AddRefed<ScaledFont> CreateScaledFontFromWRFont(
39 Float aGlyphSize, const wr::FontInstanceOptions* aOptions,
40 const wr::FontInstancePlatformOptions* aPlatformOptions,
41 const FontVariation* aVariations, uint32_t aNumVariations) override;
43 bool GetFontDescriptor(FontDescriptorOutput aCb, void* aBaton) override;
45 static already_AddRefed<UnscaledFont> CreateFromFontDescriptor(
46 const uint8_t* aData, uint32_t aDataLength, uint32_t aIndex);
48 private:
49 bool InitBold();
51 RefPtr<IDWriteFontFace> mFontFace;
52 RefPtr<IDWriteFontFace> mFontFaceBold;
53 RefPtr<IDWriteFont> mFont;
56 } // namespace gfx
57 } // namespace mozilla
59 #endif /* MOZILLA_GFX_UNSCALEDFONTDWRITE_H_ */