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_NativeFontResourceDWrite_h
8 #define mozilla_gfx_NativeFontResourceDWrite_h
13 #include "mozilla/AlreadyAddRefed.h"
18 class NativeFontResourceDWrite final
: public NativeFontResource
{
20 MOZ_DECLARE_REFCOUNTED_VIRTUAL_TYPENAME(NativeFontResourceDWrite
, override
)
23 * Creates a NativeFontResourceDWrite if data is valid. Note aFontData will be
24 * copied if required and so can be released after calling.
26 * @param aFontData the SFNT data.
27 * @param aDataLength length of data.
28 * @return Referenced NativeFontResourceDWrite or nullptr if invalid.
30 static already_AddRefed
<NativeFontResourceDWrite
> Create(
31 uint8_t* aFontData
, uint32_t aDataLength
);
33 already_AddRefed
<UnscaledFont
> CreateUnscaledFont(
34 uint32_t aIndex
, const uint8_t* aInstanceData
,
35 uint32_t aInstanceDataLength
) final
;
38 NativeFontResourceDWrite(
39 IDWriteFactory
* aFactory
, already_AddRefed
<IDWriteFontFile
> aFontFile
,
40 already_AddRefed
<IDWriteFontFileStream
> aFontFileStream
,
41 DWRITE_FONT_FACE_TYPE aFaceType
, uint32_t aNumberOfFaces
,
43 : NativeFontResource(aDataLength
),
46 mFontFileStream(aFontFileStream
),
48 mNumberOfFaces(aNumberOfFaces
) {}
50 IDWriteFactory
* mFactory
;
51 RefPtr
<IDWriteFontFile
> mFontFile
;
52 RefPtr
<IDWriteFontFileStream
> mFontFileStream
;
53 DWRITE_FONT_FACE_TYPE mFaceType
;
54 uint32_t mNumberOfFaces
;
58 } // namespace mozilla
60 #endif // mozilla_gfx_NativeFontResourceDWrite_h