Flutter Impeller
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
 
std::optional< std::pair< Rect, Rect > > FindGlyphBounds (const SubpixelGlyph &glyph) const
 Find the location of a glyph in the atlas. More...
 

Friends

class GlyphAtlas
 

Detailed Description

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

Definition at line 204 of file glyph_atlas.h.

Constructor & Destructor Documentation

◆ FontGlyphAtlas()

impeller::FontGlyphAtlas::FontGlyphAtlas ( )
default

Member Function Documentation

◆ FindGlyphBounds()

std::optional< std::pair< Rect, Rect > > 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 119 of file glyph_atlas.cc.

120  {
121  const auto& found = positions_.find(glyph);
122  if (found == positions_.end()) {
123  return std::nullopt;
124  }
125  return found->second;
126 }

Referenced by impeller::CollectNewGlyphs(), impeller::TypographerContextSTB::CreateGlyphAtlas(), and impeller::TextContents::Render().

Friends And Related Function Documentation

◆ GlyphAtlas

friend class GlyphAtlas
friend

Definition at line 220 of file glyph_atlas.h.


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