5#ifndef FLUTTER_IMPELLER_TYPOGRAPHER_GLYPH_ATLAS_H_
6#define FLUTTER_IMPELLER_TYPOGRAPHER_GLYPH_ATLAS_H_
11#include <unordered_map>
76 const std::shared_ptr<Texture>&
GetTexture()
const;
104 const std::function<
bool(
const ScaledFont& scaled_font,
106 const Rect& rect)>& iterator)
const;
134 std::shared_ptr<Texture> texture_;
136 std::unordered_map<ScaledFont, FontGlyphAtlas> font_atlas_map_;
172 std::shared_ptr<GlyphAtlas> atlas_;
174 std::shared_ptr<RectanglePacker> rect_packer_;
201 std::unordered_map<Glyph, Rect> positions_;
An object that can look up glyph locations within the GlyphAtlas for a particular typeface.
std::optional< Rect > FindGlyphBounds(const Glyph &glyph) const
Find the location of a glyph in the atlas.
Describes a typeface along with any modifications to its intrinsic properties.
A container for caching a glyph atlas across frames.
std::shared_ptr< RectanglePacker > GetRectPacker() const
Retrieve the previous (if any) rect packer.
void UpdateRectPacker(std::shared_ptr< RectanglePacker > rect_packer)
std::shared_ptr< GlyphAtlas > GetGlyphAtlas() const
Retrieve the current glyph atlas.
const ISize & GetAtlasSize() const
Retrieve the size of the current glyph atlas.
void UpdateGlyphAtlas(std::shared_ptr< GlyphAtlas > atlas, ISize size)
Update the context with a newly constructed glyph atlas.
virtual ~GlyphAtlasContext()
A texture containing the bitmap representation of glyphs in different fonts along with the ability to...
void AddTypefaceGlyphPosition(const FontGlyphPair &pair, Rect rect)
Record the location of a specific font-glyph pair within the 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.
void SetTexture(std::shared_ptr< Texture > texture)
Set the texture for the glyph atlas.
Type GetType() const
Describes how the glyphs are represented in the texture.
const std::shared_ptr< Texture > & GetTexture() const
Get the texture for the glyph 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....
size_t GetGlyphCount() const
Get the number of unique font-glyph pairs in this atlas.
A font along with a glyph in that font rendered at a particular scale.
The glyph index in the typeface.
A font and a scale. Used as a key that represents a typeface within a glyph atlas.