| 1 |
// SPDX-License-Identifier: MIT OR MPL-2.0 OR LGPL-2.1-or-later OR GPL-2.0-or-later |
| 2 |
// Copyright 2010, SIL International, All rights reserved. |
| 3 |
|
| 4 |
#pragma once |
| 5 |
|
| 6 |
#include <graphite2/Segment.h> |
| 7 |
#include "inc/TtfTypes.h" |
| 8 |
#include "inc/locale2lcid.h" |
| 9 |
|
| 10 |
namespace graphite2 { |
| 11 |
|
| 12 |
class NameTable |
| 13 |
{ |
| 14 |
NameTable(const NameTable &); |
| 15 |
NameTable & operator = (const NameTable &); |
| 16 |
|
| 17 |
public: |
| 18 |
NameTable(const void * data, size_t length, uint16 platfromId=3, uint16 encodingID = 1); |
| 19 |
~NameTable() { free(const_cast<TtfUtil::Sfnt::FontNames *>(m_table)); } |
| 20 |
enum eNameFallback { |
| 21 |
eNoFallback = 0, |
| 22 |
eEnUSFallbackOnly = 1, |
| 23 |
eEnOrAnyFallback = 2 |
| 24 |
}; |
| 25 |
uint16 setPlatformEncoding(uint16 platfromId=3, uint16 encodingID = 1); |
| 26 |
void * getName(uint16 & languageId, uint16 nameId, gr_encform enc, uint32 & length); |
| 27 |
uint16 getLanguageId(const char * bcp47Locale); |
| 28 |
|
| 29 |
CLASS_NEW_DELETE |
| 30 |
private: |
| 31 |
uint16 m_platformId; |
| 32 |
uint16 m_encodingId; |
| 33 |
uint16 m_languageCount; |
| 34 |
uint16 m_platformOffset; // offset of first NameRecord with for platform 3, encoding 1 |
| 35 |
uint16 m_platformLastRecord; |
| 36 |
uint16 m_nameDataLength; |
| 37 |
const TtfUtil::Sfnt::FontNames * m_table; |
| 38 |
const uint8 * m_nameData; |
| 39 |
Locale2Lang m_locale2Lang; |
| 40 |
}; |
| 41 |
|
| 42 |
} // namespace graphite2 |