Flutter Engine
The Flutter Engine
Enumerations | Functions | Variables
SkFontDescriptor.cpp File Reference
#include "src/core/SkFontDescriptor.h"
#include "include/core/SkData.h"
#include "include/core/SkRefCnt.h"
#include "include/core/SkStream.h"
#include "include/private/base/SkAssert.h"
#include "include/private/base/SkTFitsIn.h"
#include "include/private/base/SkTo.h"
#include "src/core/SkStreamPriv.h"
#include <cstddef>
#include <cstdint>

Go to the source code of this file.

Enumerations

enum  {
  kInvalid = 0x00 , kFontFamilyName = 0x01 , kFullName = 0x04 , kPostscriptName = 0x06 ,
  kWeight = 0x10 , kWidth = 0x11 , kSlant = 0x12 , kItalic = 0x13 ,
  kPaletteIndex = 0xF8 , kPaletteEntryOverrides = 0xF9 , kFontVariation = 0xFA , kFactoryId = 0xFC ,
  kFontIndex = 0xFD , kSentinel = 0xFF
}
 

Functions

static bool read_string (SkStream *stream, SkString *string)
 
static bool write_string (SkWStream *stream, const SkString &string, uint32_t id)
 
static bool write_uint (SkWStream *stream, size_t n, uint32_t id)
 
static bool write_scalar (SkWStream *stream, SkScalar n, uint32_t id)
 
static size_t read_id (SkStream *stream)
 

Variables

static constexpr SkScalar usWidths [9]
 
static constexpr SkScalar width_for_usWidth [0x10]
 

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
kInvalid 
kFontFamilyName 
kFullName 
kPostscriptName 
kWeight 
kWidth 
kSlant 
kItalic 
kPaletteIndex 
kPaletteEntryOverrides 
kFontVariation 
kFactoryId 
kFontIndex 
kSentinel 

Definition at line 20 of file SkFontDescriptor.cpp.

20 {
21 kInvalid = 0x00,
22
23 // Related to a font request.
24 kFontFamilyName = 0x01, // int length, data[length]
25 kFullName = 0x04, // int length, data[length]
26 kPostscriptName = 0x06, // int length, data[length]
27 kWeight = 0x10, // scalar (1 - 1000)
28 kWidth = 0x11, // scalar (percentage, 100 is 'normal')
29 kSlant = 0x12, // scalar (cw angle, 14 is a normal right leaning oblique)
30 kItalic = 0x13, // scalar (0 is Roman, 1 is fully Italic)
31
32 // Related to font data. Can also be used with a requested font.
33 kPaletteIndex = 0xF8, // int
34 kPaletteEntryOverrides = 0xF9, // int count, (int, u32)[count]
35 kFontVariation = 0xFA, // int count, (u32, scalar)[count]
36
37 // Related to font data.
38 kFactoryId = 0xFC, // int
39 kFontIndex = 0xFD, // int
40 kSentinel = 0xFF, // no data
41};
@ kPaletteEntryOverrides
@ kFullName
@ kSlant
@ kWeight
@ kItalic
@ kFontFamilyName
@ kPaletteIndex
@ kInvalid
@ kWidth
@ kFontVariation
@ kFontIndex
@ kPostscriptName
@ kFactoryId
@ kSentinel

Function Documentation

◆ read_id()

static size_t read_id ( SkStream stream)
static

Definition at line 75 of file SkFontDescriptor.cpp.

75 {
76 size_t i;
77 if (!stream->readPackedUInt(&i)) { return kInvalid; }
78 return i;
79}

◆ read_string()

static bool read_string ( SkStream stream,
SkString string 
)
static

Definition at line 45 of file SkFontDescriptor.cpp.

45 {
46 size_t length;
47 if (!stream->readPackedUInt(&length)) { return false; }
48 if (length > 0) {
50 return false;
51 }
52 string->resize(length);
53 if (stream->read(string->data(), length) != length) { return false; }
54 }
55 return true;
56}
bool StreamRemainingLengthIsBelow(SkStream *stream, size_t len)
Definition: SkStream.cpp:976
const char * data() const
Definition: SkString.h:132
size_t length

◆ write_scalar()

static bool write_scalar ( SkWStream stream,
SkScalar  n,
uint32_t  id 
)
static

Definition at line 70 of file SkFontDescriptor.cpp.

70 {
71 return stream->writePackedUInt(id) &&
72 stream->writeScalar(n);
73}

◆ write_string()

static bool write_string ( SkWStream stream,
const SkString string,
uint32_t  id 
)
static

Definition at line 58 of file SkFontDescriptor.cpp.

58 {
59 if (string.isEmpty()) { return true; }
60 return stream->writePackedUInt(id) &&
61 stream->writePackedUInt(string.size()) &&
62 stream->write(string.c_str(), string.size());
63}
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

◆ write_uint()

static bool write_uint ( SkWStream stream,
size_t  n,
uint32_t  id 
)
static

Definition at line 65 of file SkFontDescriptor.cpp.

65 {
66 return stream->writePackedUInt(id) &&
67 stream->writePackedUInt(n);
68}

Variable Documentation

◆ usWidths

constexpr SkScalar usWidths[9]
staticconstexpr
Initial value:
{
1, 2, 3, 4, 5, 6, 7, 8, 9
}

Definition at line 81 of file SkFontDescriptor.cpp.

◆ width_for_usWidth

constexpr SkScalar width_for_usWidth[0x10]
staticconstexpr
Initial value:
= {
50,
50, 62.5, 75, 87.5, 100, 112.5, 125, 150, 200,
200, 200, 200, 200, 200, 200
}

Definition at line 84 of file SkFontDescriptor.cpp.