Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
typographer_context.h
Go to the documentation of this file.
1// Copyright 2013 The Flutter Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef FLUTTER_IMPELLER_TYPOGRAPHER_TYPOGRAPHER_CONTEXT_H_
6#define FLUTTER_IMPELLER_TYPOGRAPHER_TYPOGRAPHER_CONTEXT_H_
7
8#include <memory>
9
10#include "flutter/fml/macros.h"
13
14namespace impeller {
15
16//------------------------------------------------------------------------------
17/// @brief The graphics context necessary to render text.
18///
19/// This is necessary to create and reference resources related to
20/// rendering text on the GPU.
21///
22///
24 public:
26
27 virtual bool IsValid() const;
28
29 virtual std::shared_ptr<GlyphAtlasContext> CreateGlyphAtlasContext()
30 const = 0;
31
32 // TODO(dnfield): Callers should not need to know which type of atlas to
33 // create. https://github.com/flutter/flutter/issues/111640
34
35 virtual std::shared_ptr<GlyphAtlas> CreateGlyphAtlas(
36 Context& context,
38 const std::shared_ptr<GlyphAtlasContext>& atlas_context,
39 const FontGlyphMap& font_glyph_map) const = 0;
40
41 protected:
42 //----------------------------------------------------------------------------
43 /// @brief Create a new context to render text that talks to an
44 /// underlying graphics context.
45 ///
47
48 private:
49 bool is_valid_ = false;
50
52
53 TypographerContext& operator=(const TypographerContext&) = delete;
54};
55
56} // namespace impeller
57
58#endif // FLUTTER_IMPELLER_TYPOGRAPHER_TYPOGRAPHER_CONTEXT_H_
To do anything rendering related with Impeller, you need a context.
Definition context.h:46
Type
Describes how the glyphs are represented in the texture.
Definition glyph_atlas.h:32
The graphics context necessary to render text.
virtual std::shared_ptr< GlyphAtlasContext > CreateGlyphAtlasContext() const =0
TypographerContext()
Create a new context to render text that talks to an underlying graphics context.
virtual std::shared_ptr< GlyphAtlas > CreateGlyphAtlas(Context &context, GlyphAtlas::Type type, const std::shared_ptr< GlyphAtlasContext > &atlas_context, const FontGlyphMap &font_glyph_map) const =0
std::unordered_map< ScaledFont, std::unordered_set< Glyph > > FontGlyphMap