| 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 "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 GlyphAtlas::Type type) const = 0;
30
31 virtual std::shared_ptr<GlyphAtlas> CreateGlyphAtlas(
32 Context& context,
33 GlyphAtlas::Type type,
34 HostBuffer& host_buffer,
35 const std::shared_ptr<GlyphAtlasContext>& atlas_context,
36 const FontGlyphMap& font_glyph_map) const = 0;
37
38 protected:
39 //----------------------------------------------------------------------------
40 /// @brief Create a new context to render text that talks to an
41 /// underlying graphics context.
42 ///
43 TypographerContext();
44
45 private:
46 bool is_valid_ = false;
47
48 TypographerContext(const TypographerContext&) = delete;
49
50 TypographerContext& operator=(const TypographerContext&) = delete;
51 };
52
53 } // namespace impeller
54
55 #endif // FLUTTER_IMPELLER_TYPOGRAPHER_TYPOGRAPHER_CONTEXT_H_
impeller::TypographerContext
The graphics context necessary to render text.
Definition: typographer_context.h:22
impeller::HostBuffer
Definition: host_buffer.h:28
impeller::TypographerContext::CreateGlyphAtlas
virtual std::shared_ptr< GlyphAtlas > CreateGlyphAtlas(Context &context, GlyphAtlas::Type type, HostBuffer &host_buffer, 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:31
impeller::FontGlyphMap
std::unordered_map< ScaledFont, std::unordered_set< SubpixelGlyph > > FontGlyphMap
Definition: font_glyph_pair.h:54
type
GLenum type
Definition: blit_command_gles.cc:126
impeller::Context
To do anything rendering related with Impeller, you need a context.
Definition: context.h:45
context.h
glyph_atlas.h
impeller::TypographerContext::CreateGlyphAtlasContext
virtual std::shared_ptr< GlyphAtlasContext > CreateGlyphAtlasContext(GlyphAtlas::Type type) const =0
impeller
Definition: aiks_blend_unittests.cc:18
impeller::TypographerContext::IsValid
virtual bool IsValid() const
Definition: typographer_context.cc:17