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_SFNTData_h
8 #define mozilla_gfx_SFNTData_h
10 #include "mozilla/UniquePtr.h"
11 #include "mozilla/Vector.h"
16 class SFNTData final
{
19 * Creates an SFNTData if the header is a format that we understand and
20 * aDataLength is sufficient for the length information in the header data.
21 * Note that the data is NOT copied, so must exist the SFNTData's lifetime.
23 * @param aFontData the SFNT data.
24 * @param aDataLength length
25 * @return UniquePtr to a SFNTData or nullptr if the header is invalid.
27 static UniquePtr
<SFNTData
> Create(const uint8_t* aFontData
,
28 uint32_t aDataLength
);
31 * Creates a unique key for the given font data and variation settings.
33 * @param aFontData the SFNT data
34 * @param aDataLength length
35 * @return unique key to be used for caching
37 static uint64_t GetUniqueKey(const uint8_t* aFontData
, uint32_t aDataLength
,
38 uint32_t aVarDataSize
, const void* aVarData
);
45 bool AddFont(const uint8_t* aFontData
, uint32_t aDataLength
,
48 uint32_t HashHeadAndCmapTables();
50 // Internal representation of single font in font file.
57 } // namespace mozilla
59 #endif // mozilla_gfx_SFNTData_h