RAMSES Documentation  27.0.130
Information for RAMSES users and developers
IFontInstance.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_TEXT_IFONTINSTANCE_H
10 #define RAMSES_TEXT_IFONTINSTANCE_H
11 
13 #include <stdint.h>
14 #include <string>
15 #include <unordered_set>
16 
17 namespace ramses
18 {
23  {
24  public:
28  virtual ~IFontInstance() = default;
29 
35  virtual bool supportsCharacter(char32_t character) const = 0;
36 
41  virtual std::unordered_set<unsigned long> getAllSupportedCharacters() = 0;
42 
47  virtual int getHeight() const = 0;
48 
53  virtual int getAscender() const = 0;
54 
59  virtual int getDescender() const = 0;
60 
67  virtual void loadAndAppendGlyphMetrics(std::u32string::const_iterator charsBegin, std::u32string::const_iterator charsEnd, GlyphMetricsVector& positionedGlyphs) = 0;
68 
76  virtual GlyphData loadGlyphBitmapData(GlyphId glyphId, uint32_t& sizeX, uint32_t& sizeY) = 0;
77  };
78 }
79 
80 #endif
#define RAMSES_API
Definition: APIExport.h:35
Interface for font instance that can be used to query glyph metadata and bitmaps.
Definition: IFontInstance.h:23
virtual int getAscender() const =0
Get the line ascender of the font instance (see Freetype2 docs)
virtual GlyphData loadGlyphBitmapData(GlyphId glyphId, uint32_t &sizeX, uint32_t &sizeY)=0
Load the glyph data for a specific glyph id.
virtual bool supportsCharacter(char32_t character) const =0
Check if font instance supports a char using it's UTF32 char code and cache the result.
virtual int getDescender() const =0
Get the line descender of the font instance (see Freetype2 docs)
virtual int getHeight() const =0
Get the line height of the font instance.
virtual void loadAndAppendGlyphMetrics(std::u32string::const_iterator charsBegin, std::u32string::const_iterator charsEnd, GlyphMetricsVector &positionedGlyphs)=0
Load the glyphs metrics for all characters in a string and appends them to the provided vector of GLY...
virtual ~IFontInstance()=default
Empty destructor.
virtual std::unordered_set< unsigned long > getAllSupportedCharacters()=0
Get all characters that are supported (mapped to a glyph) by IFontInstance.
The RAMSES namespace contains all client side objects and functions used to implement RAMSES applicat...
Definition: AnimatedProperty.h:15
std::vector< uint8_t > GlyphData
Stores 2-dimensional glyph pixel data as a flat memory array.
Definition: Glyph.h:23
std::vector< GlyphMetrics > GlyphMetricsVector
Vector of GlyphMetrics elements.
Definition: GlyphMetrics.h:42