7 #include "fml/logging.h"
21 std::shared_ptr<TypographerContext> typographer_context)
22 : typographer_context_(
std::move(typographer_context)),
23 alpha_context_(typographer_context_
24 ? typographer_context_->CreateGlyphAtlasContext(
27 color_context_(typographer_context_
28 ? typographer_context_->CreateGlyphAtlasContext(
38 std::optional<GlyphProperties> properties) {
39 frame->SetPerFrameData(scale, offset,
transform, properties);
40 FML_DCHECK(alpha_atlas_ ==
nullptr && color_atlas_ ==
nullptr);
42 alpha_text_frames_.push_back(frame);
44 color_text_frames_.push_back(frame);
49 alpha_text_frames_.clear();
50 color_text_frames_.clear();
68 if (!typographer_context_) {
69 VALIDATION_LOG <<
"Unable to render text because a TypographerContext has "
73 if (!typographer_context_->IsValid()) {
75 <<
"Unable to render text because the TypographerContext is invalid.";
81 const std::shared_ptr<GlyphAtlasContext>& atlas_context =
83 std::shared_ptr<GlyphAtlas> atlas = typographer_context_->CreateGlyphAtlas(
84 context,
type, host_buffer, atlas_context, glyph_map);
85 if (!atlas || !atlas->IsValid()) {
90 alpha_atlas_ = std::move(atlas);
94 color_atlas_ = std::move(atlas);
To do anything rendering related with Impeller, you need a context.
A texture containing the bitmap representation of glyphs in different fonts along with the ability to...
Type
Describes how the glyphs are represented in the texture.
const std::shared_ptr< GlyphAtlas > & CreateOrGetGlyphAtlas(Context &context, HostBuffer &host_buffer, GlyphAtlas::Type type) const
LazyGlyphAtlas(std::shared_ptr< TypographerContext > typographer_context)
void AddTextFrame(const std::shared_ptr< TextFrame > &frame, Rational scale, Point offset, const Matrix &transform, std::optional< GlyphProperties > properties)
static const std::shared_ptr< GlyphAtlas > kNullGlyphAtlas
A 4x4 matrix using column-major storage.