Flutter Engine
The Flutter Engine
|
A texture containing the bitmap representation of glyphs in different fonts along with the ability to query the location of specific font glyphs within the texture. More...
#include <glyph_atlas.h>
Public Types | |
enum class | Type { kAlphaBitmap , kColorBitmap } |
Describes how the glyphs are represented in the texture. More... | |
Public Member Functions | |
GlyphAtlas (Type type) | |
Create an empty glyph atlas. More... | |
~GlyphAtlas () | |
bool | IsValid () const |
Type | GetType () const |
Describes how the glyphs are represented in the texture. More... | |
void | SetTexture (std::shared_ptr< Texture > texture) |
Set the texture for the glyph atlas. More... | |
const std::shared_ptr< Texture > & | GetTexture () const |
Get the texture for the glyph atlas. More... | |
void | AddTypefaceGlyphPositionAndBounds (const FontGlyphPair &pair, Rect position, Rect bounds) |
Record the location of a specific font-glyph pair within the atlas. More... | |
size_t | GetGlyphCount () const |
Get the number of unique font-glyph pairs in this atlas. More... | |
size_t | IterateGlyphs (const std::function< bool(const ScaledFont &scaled_font, const SubpixelGlyph &glyph, const Rect &rect)> &iterator) const |
Iterate of all the glyphs along with their locations in the atlas. More... | |
std::optional< std::pair< Rect, Rect > > | FindFontGlyphBounds (const FontGlyphPair &pair) const |
Find the location of a specific font-glyph pair in the atlas. More... | |
const FontGlyphAtlas * | GetFontGlyphAtlas (const Font &font, Scalar scale) const |
Obtain an interface for querying the location of glyphs in the atlas for the given font and scale. This provides a more efficient way to look up a run of glyphs in the same font. More... | |
A texture containing the bitmap representation of glyphs in different fonts along with the ability to query the location of specific font glyphs within the texture.
Definition at line 27 of file glyph_atlas.h.
|
strong |
Describes how the glyphs are represented in the texture.
Definition at line 31 of file glyph_atlas.h.
|
explicit |
Create an empty glyph atlas.
[in] | type | How the glyphs are represented in the texture. |
Definition at line 46 of file glyph_atlas.cc.
|
default |
void impeller::GlyphAtlas::AddTypefaceGlyphPositionAndBounds | ( | const FontGlyphPair & | pair, |
Rect | position, | ||
Rect | bounds | ||
) |
Record the location of a specific font-glyph pair within the atlas.
[in] | pair | The font-glyph pair |
[in] | rect | The position in the atlas |
[in] | bounds | The bounds of the glyph at scale |
Definition at line 66 of file glyph_atlas.cc.
std::optional< std::pair< Rect, Rect > > impeller::GlyphAtlas::FindFontGlyphBounds | ( | const FontGlyphPair & | pair | ) | const |
Find the location of a specific font-glyph pair in the atlas.
[in] | pair | The font-glyph pair |
std::nullopt
if the pair is not in the atlas. Definition at line 73 of file glyph_atlas.cc.
const FontGlyphAtlas * impeller::GlyphAtlas::GetFontGlyphAtlas | ( | const Font & | font, |
Scalar | scale | ||
) | const |
Obtain an interface for querying the location of glyphs in the atlas for the given font and scale. This provides a more efficient way to look up a run of glyphs in the same font.
[in] | font | The font |
[in] | scale | The scale |
Definition at line 82 of file glyph_atlas.cc.
size_t impeller::GlyphAtlas::GetGlyphCount | ( | ) | const |
Get the number of unique font-glyph pairs in this atlas.
Definition at line 91 of file glyph_atlas.cc.
const std::shared_ptr< Texture > & impeller::GlyphAtlas::GetTexture | ( | ) | const |
Get the texture for the glyph atlas.
Definition at line 58 of file glyph_atlas.cc.
GlyphAtlas::Type impeller::GlyphAtlas::GetType | ( | ) | const |
Describes how the glyphs are represented in the texture.
Definition at line 54 of file glyph_atlas.cc.
bool impeller::GlyphAtlas::IsValid | ( | ) | const |
Definition at line 50 of file glyph_atlas.cc.
size_t impeller::GlyphAtlas::IterateGlyphs | ( | const std::function< bool(const ScaledFont &scaled_font, const SubpixelGlyph &glyph, const Rect &rect)> & | iterator | ) | const |
Iterate of all the glyphs along with their locations in the atlas.
[in] | iterator | The iterator. Return false from the iterator to stop iterating. |
Definition at line 98 of file glyph_atlas.cc.
void impeller::GlyphAtlas::SetTexture | ( | std::shared_ptr< Texture > | texture | ) |
Set the texture for the glyph atlas.
[in] | texture | The texture |
Definition at line 62 of file glyph_atlas.cc.