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_NativeFontResourceFreeType_h
8 #define mozilla_gfx_NativeFontResourceFreeType_h
13 #include "mozilla/UniquePtr.h"
18 class NativeFontResourceFreeType
19 : public NativeFontResource
,
20 public SharedFTFaceRefCountedData
<NativeFontResourceFreeType
> {
22 MOZ_DECLARE_REFCOUNTED_VIRTUAL_TYPENAME(NativeFontResourceFreeType
, override
)
24 #ifdef MOZ_WIDGET_ANDROID
25 static already_AddRefed
<NativeFontResourceFreeType
> Create(
26 uint8_t* aFontData
, uint32_t aDataLength
,
27 FT_Library aFTLibrary
= nullptr);
29 already_AddRefed
<UnscaledFont
> CreateUnscaledFont(
30 uint32_t aIndex
, const uint8_t* aInstanceData
,
31 uint32_t aInstanceDataLength
) override
;
34 ~NativeFontResourceFreeType();
36 already_AddRefed
<SharedFTFace
> CloneFace(int aFaceIndex
= 0) override
;
39 NativeFontResourceFreeType(UniquePtr
<uint8_t[]>&& aFontData
,
41 FT_Library aFTLibrary
= nullptr);
44 static already_AddRefed
<T
> CreateInternal(uint8_t* aFontData
,
46 FT_Library aFTLibrary
);
48 UniquePtr
<uint8_t[]> mFontData
;
50 FT_Library mFTLibrary
;
54 class NativeFontResourceFontconfig final
: public NativeFontResourceFreeType
{
56 MOZ_DECLARE_REFCOUNTED_VIRTUAL_TYPENAME(NativeFontResourceFontconfig
,
59 static already_AddRefed
<NativeFontResourceFontconfig
> Create(
60 uint8_t* aFontData
, uint32_t aDataLength
,
61 FT_Library aFTLibrary
= nullptr);
63 already_AddRefed
<UnscaledFont
> CreateUnscaledFont(
64 uint32_t aIndex
, const uint8_t* aInstanceData
,
65 uint32_t aInstanceDataLength
) final
;
68 friend class NativeFontResourceFreeType
;
70 NativeFontResourceFontconfig(UniquePtr
<uint8_t[]>&& aFontData
,
72 FT_Library aFTLibrary
= nullptr);
77 } // namespace mozilla
79 #endif // mozilla_gfx_NativeFontResourceFreeType_h