26 return height_adjustment_;
35 int64_t height_adjustment) {
36 atlas_ = std::move(
atlas);
38 height_adjustment_ = height_adjustment;
42 std::shared_ptr<RectanglePacker> rect_packer) {
43 rect_packer_ = std::move(rect_packer);
70 std::make_pair(position,
bounds);
75 const auto& found = font_atlas_map_.find(pair.
scaled_font);
76 if (found == font_atlas_map_.end()) {
79 return found->second.FindGlyphBounds(pair.
glyph);
85 if (found == font_atlas_map_.end()) {
88 return &found->second;
92 return std::accumulate(font_atlas_map_.begin(), font_atlas_map_.end(), 0,
93 [](
const int a,
const auto&
b) {
94 return a + b.second.positions_.size();
101 const Rect&
rect)>& iterator)
const {
107 for (
const auto& font_value : font_atlas_map_) {
108 for (
const auto& glyph_value : font_value.second.positions_) {
110 if (!iterator(font_value.first, glyph_value.first,
111 glyph_value.second.first)) {
121 const auto& found = positions_.find(glyph);
122 if (found == positions_.end()) {
125 return found->second;
An object that can look up glyph locations within the GlyphAtlas for a particular typeface.
std::optional< std::pair< Rect, Rect > > FindGlyphBounds(const SubpixelGlyph &glyph) const
Find the location of a glyph in the atlas.
Describes a typeface along with any modifications to its intrinsic properties.
GlyphAtlasContext(GlyphAtlas::Type type)
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.
int64_t GetHeightAdjustment() const
A y-coordinate shift that must be applied to glyphs appended to the atlas.
virtual ~GlyphAtlasContext()
void UpdateGlyphAtlas(std::shared_ptr< GlyphAtlas > atlas, ISize size, int64_t height_adjustment_)
Update the context with a newly constructed glyph atlas.
A texture containing the bitmap representation of glyphs in different fonts along with the ability to...
GlyphAtlas(Type type)
Create an empty glyph atlas.
std::optional< std::pair< Rect, 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
Describes how the glyphs are represented in the texture.
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 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.
void AddTypefaceGlyphPositionAndBounds(const FontGlyphPair &pair, Rect position, Rect bounds)
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.
Dart_NativeFunction function
sk_sp< const SkImage > atlas
Optional< SkRect > bounds
sk_sp< SkBlender > blender SkRect rect
it will be possible to load the file into Perfetto s trace viewer disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive keep the shell running after the Dart script has completed enable serial On low power devices with low core running concurrent GC tasks on threads can cause them to contend with the UI thread which could potentially lead to jank This option turns off all concurrent GC activities domain network JSON encoded network policy per domain This overrides the DisallowInsecureConnections switch Embedder can specify whether to allow or disallow insecure connections at a domain level old gen heap size
font
Font Metadata and Metrics.
A font along with a glyph in that font rendered at a particular scale and subpixel position.
const SubpixelGlyph & glyph
const ScaledFont & scaled_font
A font and a scale. Used as a key that represents a typeface within a glyph atlas.
A glyph and its subpixel position.