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. | |
~GlyphAtlas () | |
bool | IsValid () const |
Type | GetType () const |
Describes how the glyphs are represented in the texture. | |
void | SetTexture (std::shared_ptr< Texture > texture) |
Set the texture for the glyph atlas. | |
const std::shared_ptr< Texture > & | GetTexture () const |
Get the texture for the glyph atlas. | |
void | AddTypefaceGlyphPosition (const FontGlyphPair &pair, Rect rect) |
Record the location of a specific font-glyph pair within the atlas. | |
size_t | GetGlyphCount () const |
Get the number of unique font-glyph pairs in this atlas. | |
size_t | IterateGlyphs (const std::function< bool(const ScaledFont &scaled_font, const Glyph &glyph, const Rect &rect)> &iterator) const |
Iterate of all the glyphs along with their locations in the atlas. | |
std::optional< Rect > | FindFontGlyphBounds (const FontGlyphPair &pair) const |
Find the location of a specific font-glyph pair in the atlas. | |
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. | |
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 28 of file glyph_atlas.h.
|
strong |
Describes how the glyphs are represented in the texture.
Definition at line 32 of file glyph_atlas.h.
|
explicit |
Create an empty glyph atlas.
[in] | type | How the glyphs are represented in the texture. |
Definition at line 41 of file glyph_atlas.cc.
|
default |
void impeller::GlyphAtlas::AddTypefaceGlyphPosition | ( | const FontGlyphPair & | pair, |
Rect | rect | ||
) |
Record the location of a specific font-glyph pair within the atlas.
[in] | pair | The font-glyph pair |
[in] | rect | The rectangle |
Definition at line 61 of file glyph_atlas.cc.
std::optional< 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 66 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 75 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 84 of file glyph_atlas.cc.
const std::shared_ptr< Texture > & impeller::GlyphAtlas::GetTexture | ( | ) | const |
Get the texture for the glyph atlas.
Definition at line 53 of file glyph_atlas.cc.
GlyphAtlas::Type impeller::GlyphAtlas::GetType | ( | ) | const |
Describes how the glyphs are represented in the texture.
Definition at line 49 of file glyph_atlas.cc.
bool impeller::GlyphAtlas::IsValid | ( | ) | const |
Definition at line 45 of file glyph_atlas.cc.
size_t impeller::GlyphAtlas::IterateGlyphs | ( | const std::function< bool(const ScaledFont &scaled_font, const Glyph &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 91 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 57 of file glyph_atlas.cc.