Flutter Engine
The Flutter Engine
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
Public Member Functions | Static Public Member Functions | List of all members
SkOTUtils::LocalizedStrings_NameTable Class Reference

#include <SkOTUtils.h>

Inheritance diagram for SkOTUtils::LocalizedStrings_NameTable:
SkTypeface::LocalizedStrings

Public Member Functions

 LocalizedStrings_NameTable (std::unique_ptr< uint8_t[]> nameTableData, size_t size, SK_OT_USHORT types[], int typesCount)
 
bool next (SkTypeface::LocalizedString *localizedString) override
 
- Public Member Functions inherited from SkTypeface::LocalizedStrings
 LocalizedStrings ()=default
 
virtual ~LocalizedStrings ()
 
virtual bool next (LocalizedString *localizedString)=0
 
void unref ()
 

Static Public Member Functions

static sk_sp< LocalizedStrings_NameTableMake (const SkTypeface &typeface, SK_OT_USHORT types[], int typesCount)
 
static sk_sp< LocalizedStrings_NameTableMakeForFamilyNames (const SkTypeface &typeface)
 

Detailed Description

An implementation of LocalizedStrings which obtains it's data from a 'name' table.

Definition at line 44 of file SkOTUtils.h.

Constructor & Destructor Documentation

◆ LocalizedStrings_NameTable()

SkOTUtils::LocalizedStrings_NameTable::LocalizedStrings_NameTable ( std::unique_ptr< uint8_t[]>  nameTableData,
size_t  size,
SK_OT_USHORT  types[],
int  typesCount 
)
inline

Takes ownership of the nameTableData and will free it with SK_DELETE.

Definition at line 47 of file SkOTUtils.h.

50 : fTypes(types), fTypesCount(typesCount), fTypesIndex(0)
51 , fNameTableData(std::move(nameTableData))
52 , fFamilyNameIter(fNameTableData.get(), size, fTypes[fTypesIndex])
53 { }
it will be possible to load the file into Perfetto s trace viewer disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive keep the shell running after the Dart script has completed enable serial On low power devices with low core running concurrent GC tasks on threads can cause them to contend with the UI thread which could potentially lead to jank This option turns off all concurrent GC activities domain network JSON encoded network policy per domain This overrides the DisallowInsecureConnections switch Embedder can specify whether to allow or disallow insecure connections at a domain level old gen heap size
Definition: switches.h:259

Member Function Documentation

◆ Make()

sk_sp< SkOTUtils::LocalizedStrings_NameTable > SkOTUtils::LocalizedStrings_NameTable::Make ( const SkTypeface typeface,
SK_OT_USHORT  types[],
int  typesCount 
)
static

Creates an iterator over all data in the 'name' table of a typeface. If no valid 'name' table can be found, returns nullptr.

Definition at line 170 of file SkOTUtils.cpp.

173{
174 static const SkFontTableTag nameTag = SkSetFourByteTag('n','a','m','e');
175 size_t nameTableSize = typeface.getTableSize(nameTag);
176 if (0 == nameTableSize) {
177 return nullptr;
178 }
179 std::unique_ptr<uint8_t[]> nameTableData(new uint8_t[nameTableSize]);
180 size_t copied = typeface.getTableData(nameTag, 0, nameTableSize, nameTableData.get());
181 if (copied != nameTableSize) {
182 return nullptr;
183 }
184
186 new SkOTUtils::LocalizedStrings_NameTable(std::move(nameTableData), nameTableSize,
187 types, typesCount));
188}
uint32_t SkFontTableTag
Definition: SkTypeface.h:41
static constexpr SkFourByteTag SkSetFourByteTag(char a, char b, char c, char d)
Definition: SkTypes.h:167
size_t getTableSize(SkFontTableTag) const
Definition: SkTypeface.cpp:309
size_t getTableData(SkFontTableTag tag, size_t offset, size_t length, void *data) const
Definition: SkTypeface.cpp:313

◆ MakeForFamilyNames()

sk_sp< SkOTUtils::LocalizedStrings_NameTable > SkOTUtils::LocalizedStrings_NameTable::MakeForFamilyNames ( const SkTypeface typeface)
static

Creates an iterator over all the family names in the 'name' table of a typeface. If no valid 'name' table can be found, returns nullptr.

Definition at line 191 of file SkOTUtils.cpp.

191 {
192 return Make(typeface,
193 SkOTUtils::LocalizedStrings_NameTable::familyNameTypes,
194 std::size(SkOTUtils::LocalizedStrings_NameTable::familyNameTypes));
195}
static sk_sp< LocalizedStrings_NameTable > Make(const SkTypeface &typeface, SK_OT_USHORT types[], int typesCount)
Definition: SkOTUtils.cpp:170

◆ next()

bool SkOTUtils::LocalizedStrings_NameTable::next ( SkTypeface::LocalizedString localizedString)
overridevirtual

Implements SkTypeface::LocalizedStrings.

Definition at line 197 of file SkOTUtils.cpp.

197 {
198 do {
200 if (fFamilyNameIter.next(record)) {
201 localizedString->fString = record.name;
202 localizedString->fLanguage = record.language;
203 return true;
204 }
205 if (fTypesCount == fTypesIndex + 1) {
206 return false;
207 }
208 ++fTypesIndex;
209 fFamilyNameIter.reset(fTypes[fTypesIndex]);
210 } while (true);
211}
void reset(SK_OT_USHORT type)

The documentation for this class was generated from the following files: