Flutter Engine
The Flutter Engine
Public Member Functions | List of all members
SkAutoToGlyphs Class Reference

#include <SkFontPriv.h>

Public Member Functions

 SkAutoToGlyphs (const SkFont &font, const void *text, size_t length, SkTextEncoding encoding)
 
int count () const
 
const uint16_t * glyphs () const
 

Detailed Description

Definition at line 93 of file SkFontPriv.h.

Constructor & Destructor Documentation

◆ SkAutoToGlyphs()

SkAutoToGlyphs::SkAutoToGlyphs ( const SkFont font,
const void *  text,
size_t  length,
SkTextEncoding  encoding 
)
inline

Definition at line 95 of file SkFontPriv.h.

95 {
96 if (encoding == SkTextEncoding::kGlyphID || length == 0) {
97 fGlyphs = reinterpret_cast<const uint16_t*>(text);
98 fCount = SkToInt(length >> 1);
99 } else {
100 fCount = font.countText(text, length, encoding);
101 if (fCount < 0) {
102 fCount = 0;
103 }
104 fStorage.reset(fCount);
105 font.textToGlyphs(text, length, encoding, fStorage.get(), fCount);
106 fGlyphs = fStorage.get();
107 }
108 }
@ kGlyphID
uses two byte words to represent glyph indices
constexpr int SkToInt(S x)
Definition: SkTo.h:29
void reset(int count)
Definition: SkTemplates.h:195
size_t length
std::u16string text
font
Font Metadata and Metrics.

Member Function Documentation

◆ count()

int SkAutoToGlyphs::count ( ) const
inline

Definition at line 110 of file SkFontPriv.h.

110{ return fCount; }

◆ glyphs()

const uint16_t * SkAutoToGlyphs::glyphs ( ) const
inline

Definition at line 111 of file SkFontPriv.h.

111{ return fGlyphs; }

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