no bug - Import translations from android-l10n r=release a=l10n CLOSED TREE
[gecko.git] / gfx / 2d / NativeFontResourceGDI.h
blob7f71e8d28ddd0dd151959b40b81844c554113678
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_NativeFontResourceGDI_h
8 #define mozilla_gfx_NativeFontResourceGDI_h
10 #include <windows.h>
12 #include "2D.h"
13 #include "mozilla/AlreadyAddRefed.h"
14 #include "mozilla/Vector.h"
16 namespace mozilla {
17 namespace gfx {
19 class NativeFontResourceGDI final : public NativeFontResource {
20 public:
21 MOZ_DECLARE_REFCOUNTED_VIRTUAL_TYPENAME(NativeFontResourceGDI, override)
23 /**
24 * Creates a NativeFontResourceGDI if data is valid. Note aFontData will be
25 * copied if required and so can be released after calling.
27 * @param aFontData the SFNT data.
28 * @param aDataLength length of data.
29 * @return Referenced NativeFontResourceGDI or nullptr if invalid.
31 static already_AddRefed<NativeFontResourceGDI> Create(uint8_t* aFontData,
32 uint32_t aDataLength);
34 virtual ~NativeFontResourceGDI();
36 already_AddRefed<UnscaledFont> CreateUnscaledFont(
37 uint32_t aIndex, const uint8_t* aInstanceData,
38 uint32_t aInstanceDataLength) final;
40 private:
41 explicit NativeFontResourceGDI(HANDLE aFontResourceHandle, size_t aDataLength)
42 : NativeFontResource(aDataLength),
43 mFontResourceHandle(aFontResourceHandle) {}
45 HANDLE mFontResourceHandle;
48 } // namespace gfx
49 } // namespace mozilla
51 #endif // mozilla_gfx_NativeFontResourceGDI_h