Flutter Engine
 
Loading...
Searching...
No Matches
impeller::FontGlyphAtlas Class Reference

An object that can look up glyph locations within the GlyphAtlas for a particular typeface. More...

#include <glyph_atlas.h>

Public Member Functions

 FontGlyphAtlas ()=default
 
 FontGlyphAtlas (FontGlyphAtlas &&)=default
 
std::optional< FrameBoundsFindGlyphBounds (const SubpixelGlyph &glyph) const
 Find the location of a glyph in the atlas.
 
void AppendGlyph (const SubpixelGlyph &glyph, const FrameBounds &frame_bounds)
 Append the frame bounds of a glyph to this atlas.
 

Friends

class GlyphAtlas
 

Detailed Description

An object that can look up glyph locations within the GlyphAtlas for a particular typeface.

Definition at line 229 of file glyph_atlas.h.

Constructor & Destructor Documentation

◆ FontGlyphAtlas() [1/2]

impeller::FontGlyphAtlas::FontGlyphAtlas ( )
default

◆ FontGlyphAtlas() [2/2]

impeller::FontGlyphAtlas::FontGlyphAtlas ( FontGlyphAtlas &&  )
default

Member Function Documentation

◆ AppendGlyph()

void impeller::FontGlyphAtlas::AppendGlyph ( const SubpixelGlyph glyph,
const FrameBounds frame_bounds 
)

Append the frame bounds of a glyph to this atlas.

        This may indicate a placeholder glyph location to be replaced
        at a later time, as indicated by FrameBounds.placeholder. 

Definition at line 140 of file glyph_atlas.cc.

141 {
142 positions_[glyph] = frame_bounds;
143}

◆ FindGlyphBounds()

std::optional< FrameBounds > impeller::FontGlyphAtlas::FindGlyphBounds ( const SubpixelGlyph glyph) const

Find the location of a glyph in the atlas.

Parameters
[in]glyphThe glyph
Returns
The location of the glyph in the atlas. std::nullopt if the glyph is not in the atlas.

Definition at line 131 of file glyph_atlas.cc.

132 {
133 const auto& found = positions_.find(glyph);
134 if (found == positions_.end()) {
135 return std::nullopt;
136 }
137 return found->second;
138}

Referenced by impeller::TextContents::ComputeVertexData().

Friends And Related Symbol Documentation

◆ GlyphAtlas

friend class GlyphAtlas
friend

Definition at line 252 of file glyph_atlas.h.


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