| Flutter Impeller |

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"
11 #include "impeller/renderer/context.h"
12 #include "impeller/typographer/glyph_atlas.h"
13
14 namespace 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 ///
23 class TypographerContext {
24 public:
25 virtual ~TypographerContext();
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,
37 GlyphAtlas::Type type,
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 ///
46 TypographerContext();
47
48 private:
49 bool is_valid_ = false;
50
51 TypographerContext(const TypographerContext&) = delete;
52
53 TypographerContext& operator=(const TypographerContext&) = delete;
54 };
55
56 } // namespace impeller
57
58 #endif // FLUTTER_IMPELLER_TYPOGRAPHER_TYPOGRAPHER_CONTEXT_H_
impeller::TypographerContext
The graphics context necessary to render text.
Definition: typographer_context.h:23
impeller::TypographerContext::CreateGlyphAtlasContext
virtual std::shared_ptr< GlyphAtlasContext > CreateGlyphAtlasContext() const =0
impeller::FontGlyphMap
std::unordered_map< ScaledFont, std::unordered_set< Glyph > > FontGlyphMap
Definition: font_glyph_pair.h:29
impeller::TypographerContext::CreateGlyphAtlas
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
impeller::TypographerContext::TypographerContext
TypographerContext()
Create a new context to render text that talks to an underlying graphics context.
Definition: typographer_context.cc:11
impeller::TypographerContext::~TypographerContext
virtual ~TypographerContext()
impeller::GlyphAtlas::Type
Type
Describes how the glyphs are represented in the texture.
Definition: glyph_atlas.h:32
impeller::Context
To do anything rendering related with Impeller, you need a context.
Definition: context.h:46
context.h
glyph_atlas.h
impeller
Definition: aiks_blur_unittests.cc:20
impeller::TypographerContext::IsValid
virtual bool IsValid() const
Definition: typographer_context.cc:17