RAMSES Documentation  27.0.130
Information for RAMSES users and developers
TextCache.h
Go to the documentation of this file.
1 // -------------------------------------------------------------------------
2 // Copyright (C) 2018 BMW Car IT GmbH
3 // -------------------------------------------------------------------------
4 // This Source Code Form is subject to the terms of the Mozilla Public
5 // License, v. 2.0. If a copy of the MPL was not distributed with this
6 // file, You can obtain one at https://mozilla.org/MPL/2.0/.
7 // -------------------------------------------------------------------------
8 
9 #ifndef RAMSES_TEXTCACHE_H
10 #define RAMSES_TEXTCACHE_H
11 
14 #include <string>
15 
16 namespace ramses
17 {
18  class Scene;
19  class Effect;
20  class IFontAccessor;
21  class TextCacheImpl;
22 
84  {
85  public:
98  TextCache(Scene& scene, IFontAccessor& fontAccessor, uint32_t atlasTextureWidth, uint32_t atlasTextureHeight);
99 
106 
121  GlyphMetricsVector getPositionedGlyphs(const std::u32string& str, FontInstanceId font);
122 
135  GlyphMetricsVector getPositionedGlyphs(const std::u32string& str, const FontInstanceOffsets& fontOffsets);
136 
155  TextLineId createTextLine(const GlyphMetricsVector& glyphs, const Effect& effect);
156 
162  TextLine const* getTextLine(TextLineId textId) const;
163 
170 
177 
185  static bool ContainsRenderableGlyphs(const GlyphMetricsVector& glyphMetrics);
186 
200  static void ApplyTrackingToGlyphs(GlyphMetricsVector& glyphMetrics, int32_t trackingFactor, int32_t fontSize);
201 
205  class TextCacheImpl* impl;
206 
211  TextCache(const TextCache& other) = delete;
212 
218  TextCache& operator=(const TextCache& other) = delete;
219  };
220 }
221 
222 #endif
#define RAMSES_API
Definition: APIExport.h:35
An effect describes how an object will be rendered to the screen.
Definition: Effect.h:26
Interface for getting font instances using font instance ids.
Definition: IFontAccessor.h:27
The Scene holds a scene graph. It is the essential class for distributing content to the ramses syste...
Definition: Scene.h:83
Stores text data - texture atlas, meshes, glyph bitmap data. It is a cache because the content can be...
Definition: TextCache.h:84
TextCache & operator=(const TextCache &other)=delete
Deleted copy assignment.
~TextCache()
Destructor for text cache that cleans up any objects created using the text cache....
static void ApplyTrackingToGlyphs(GlyphMetricsVector &glyphMetrics, int32_t trackingFactor, int32_t fontSize)
Apply character tracking (positive or negative) to each glyph in provided GlyphMetricsVector....
bool deleteTextLine(TextLineId textId)
Delete an existing text line object.
TextLineId createTextLine(const GlyphMetricsVector &glyphs, const Effect &effect)
Create the scene objects, e.g., mesh and appearance...etc, needed for rendering a text line (represen...
TextLine const * getTextLine(TextLineId textId) const
Get a const pointer to a (previously created) text line object.
TextCache(Scene &scene, IFontAccessor &fontAccessor, uint32_t atlasTextureWidth, uint32_t atlasTextureHeight)
Constructor for text cache.
GlyphMetricsVector getPositionedGlyphs(const std::u32string &str, const FontInstanceOffsets &fontOffsets)
Create and get glyph metrics for a string using a list of font instances and offsets.
GlyphMetricsVector getPositionedGlyphs(const std::u32string &str, FontInstanceId font)
Create and get glyph metrics for a string using a font instance.
TextCache(const TextCache &other)=delete
Deleted copy constructor.
class TextCacheImpl * impl
Definition: TextCache.h:205
TextLine * getTextLine(TextLineId textId)
Get a (non-const) pointer to a (previously created) text line object.
static bool ContainsRenderableGlyphs(const GlyphMetricsVector &glyphMetrics)
Check if provided GlyphMetricsVector contains at least one renderable glyph If this functions returns...
The RAMSES namespace contains all client side objects and functions used to implement RAMSES applicat...
Definition: AnimatedProperty.h:15
std::vector< FontInstanceOffset > FontInstanceOffsets
Vector of FontInstanceOffset elements.
Definition: FontInstanceOffsets.h:34
std::vector< GlyphMetrics > GlyphMetricsVector
Vector of GlyphMetrics elements.
Definition: GlyphMetrics.h:42
Groups the scene objects needed to render a text line.
Definition: TextLine.h:34