Bug 1634272 - Don't use DocumentChannel for about:newtab r=mattwoodrow
[gecko.git] / gfx / 2d / NativeFontResourceMac.h
blob9b04c9097e12fdda021ae15e487f42e2c82435db
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_NativeFontResourceMac_h
8 #define mozilla_gfx_NativeFontResourceMac_h
10 #include "2D.h"
11 #include "mozilla/AlreadyAddRefed.h"
12 #include "ScaledFontMac.h"
14 namespace mozilla {
15 namespace gfx {
17 class NativeFontResourceMac final : public NativeFontResource {
18 public:
19 MOZ_DECLARE_REFCOUNTED_VIRTUAL_TYPENAME(NativeFontResourceMac, override)
21 static already_AddRefed<NativeFontResourceMac> Create(uint8_t* aFontData,
22 uint32_t aDataLength);
24 already_AddRefed<UnscaledFont> CreateUnscaledFont(
25 uint32_t aIndex, const uint8_t* aInstanceData,
26 uint32_t aInstanceDataLength) final;
28 ~NativeFontResourceMac() { CFRelease(mFontRef); }
30 private:
31 explicit NativeFontResourceMac(CGFontRef aFontRef, size_t aDataLength)
32 : NativeFontResource(aDataLength), mFontRef(aFontRef) {}
34 CGFontRef mFontRef;
37 } // namespace gfx
38 } // namespace mozilla
40 #endif // mozilla_gfx_NativeFontResourceMac_h