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_
17 class ScaledFontDWrite
;
19 class UnscaledFontDWrite final
: public UnscaledFont
{
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
);
51 RefPtr
<IDWriteFontFace
> mFontFace
;
52 RefPtr
<IDWriteFontFace
> mFontFaceBold
;
53 RefPtr
<IDWriteFont
> mFont
;
57 } // namespace mozilla
59 #endif /* MOZILLA_GFX_UNSCALEDFONTDWRITE_H_ */