| 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 #pragma once
6
7 #include <memory>
8
9 #include "flutter/fml/macros.h"
10 #include "impeller/renderer/context.h"
11 #include "impeller/typographer/glyph_atlas.h"
12
13 namespace impeller {
14
15 //------------------------------------------------------------------------------
16 /// @brief The graphics context necessary to render text.
17 ///
18 /// This is necessary to create and reference resources related to
19 /// rendering text on the GPU.
20 ///
21 ///
22 class TypographerContext {
23 public:
24 virtual ~TypographerContext();
25
26 virtual bool IsValid() const;
27
28 virtual std::shared_ptr<GlyphAtlasContext> CreateGlyphAtlasContext()
29 const = 0;
30
31 // TODO(dnfield): Callers should not need to know which type of atlas to
32 // create. https://github.com/flutter/flutter/issues/111640
33
34 virtual std::shared_ptr<GlyphAtlas> CreateGlyphAtlas(
35 Context& context,
36 GlyphAtlas::Type type,
37 std::shared_ptr<GlyphAtlasContext> atlas_context,
38 const FontGlyphMap& font_glyph_map) const = 0;
39
40 protected:
41 //----------------------------------------------------------------------------
42 /// @brief Create a new context to render text that talks to an
43 /// underlying graphics context.
44 ///
45 TypographerContext();
46
47 private:
48 bool is_valid_ = false;
49
50 FML_DISALLOW_COPY_AND_ASSIGN(TypographerContext);
51 };
52
53 } // namespace impeller
impeller::TypographerContext
The graphics context necessary to render text.
Definition: typographer_context.h:22
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:28
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::CreateGlyphAtlas
virtual std::shared_ptr< GlyphAtlas > CreateGlyphAtlas(Context &context, GlyphAtlas::Type type, std::shared_ptr< GlyphAtlasContext > atlas_context, const FontGlyphMap &font_glyph_map) const =0
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:47
context.h
glyph_atlas.h
impeller
Definition: aiks_context.cc:10
impeller::TypographerContext::IsValid
virtual bool IsValid() const
Definition: typographer_context.cc:17