Magnum::Text namespace

Text rendering.

Contents

Font texture creation and text layout.

This library is built if WITH_TEXT is enabled when building Magnum. To use this library with CMake, request the Text component of the Magnum package and link to the Magnum::Text target:

find_package(Magnum REQUIRED Text)

# ...
target_link_libraries(your-app PRIVATE Magnum::Text)

Additional plugins and utilities are built separately. See particular *Font and *FontConverter class documentation, the magnum-fontconverter utility documentation, Downloading and building, Downloading and building plugins, Usage with CMake, Plugin usage with CMake and Loading and using plugins for more information.

Classes

class AbstractFont
Base for font plugins.
class AbstractFontConverter
Base for font converter plugins.
class AbstractGlyphCache new in 2019.10
Base for glyph caches.
class AbstractLayouter
Base for text layouters.
class AbstractRenderer
Base for text renderers.
class DistanceFieldGlyphCache
Glyph cache with distance field rendering.
class FreeTypeFont
FreeType font plugin.
class GlyphCache
Glyph cache.
class HarfBuzzFont
HarfBuzz font plugin.
class MagnumFont
Simple bitmap font plugin.
class MagnumFontConverter
MagnumFont converter plugin.
template<UnsignedInt dimensions>
class Renderer
Text renderer.
class StbTrueTypeFont
TrueType font plugin using stb_truetype.

Enums

enum class FontFeature: UnsignedByte { OpenData = 1 << 0, FileCallback = 1 << 1 new in 2019.10, MultiFile = FileCallback deprecated in 2019.10, PreparedGlyphCache = 1 << 2 } new in Git master
Features supported by a font implementation.
enum class FontConverterFeature: UnsignedByte { ExportFont = 1 << 0, ExportGlyphCache = 1 << 1, ImportGlyphCache = 1 << 2, ConvertData = 1 << 4, MultiFile = 1 << 5 } new in Git master
Features supported by a font converter.
enum class GlyphCacheFeature: UnsignedByte { ImageDownload = 1 << 0 } new in 2019.10
Features supported by a particular glyph cache implementation.
enum class Alignment: UnsignedByte { LineLeft = Implementation::AlignmentLine|Implementation::AlignmentLeft, LineCenter = Implementation::AlignmentLine|Implementation::AlignmentCenter, LineRight = Implementation::AlignmentLine|Implementation::AlignmentRight, MiddleLeft = Implementation::AlignmentMiddle|Implementation::AlignmentLeft, MiddleCenter = Implementation::AlignmentMiddle|Implementation::AlignmentCenter, MiddleRight = Implementation::AlignmentMiddle|Implementation::AlignmentRight, TopLeft = Implementation::AlignmentTop|Implementation::AlignmentLeft, TopCenter = Implementation::AlignmentTop|Implementation::AlignmentCenter, TopRight = Implementation::AlignmentTop|Implementation::AlignmentRight, LineCenterIntegral = Implementation::AlignmentLine|Implementation::AlignmentCenter|Implementation::AlignmentIntegral, MiddleLeftIntegral = Implementation::AlignmentMiddle|Implementation::AlignmentLeft|Implementation::AlignmentIntegral, MiddleCenterIntegral = Implementation::AlignmentMiddle|Implementation::AlignmentCenter|Implementation::AlignmentIntegral, MiddleRightIntegral = Implementation::AlignmentMiddle|Implementation::AlignmentRight|Implementation::AlignmentIntegral }
Text rendering alignment.

Typedefs

using FontFeatures = Containers::EnumSet<FontFeature> new in Git master
Set of features supported by a font implementation.
using FontConverterFeatures = Containers::EnumSet<FontConverterFeature> new in Git master
Features supported by a font converter.
using GlyphCacheFeatures = Containers::EnumSet<GlyphCacheFeature> new in 2019.10
Set of features supported by a glyph cache.
using Renderer2D = Renderer<2>
Two-dimensional text renderer.
using Renderer3D = Renderer<3>
Three-dimensional text renderer.

Functions

auto operator<<(Debug& debug, FontFeature value) -> Debug&
Debug output operator.
auto operator<<(Debug& debug, FontFeatures value) -> Debug&
Debug output operator.
auto operator<<(Debug& debug, FontConverterFeature value) -> Debug&
Debug output operator.
auto operator<<(Debug& debug, FontConverterFeatures value) -> Debug&
Debug output operator.

Enum documentation

enum class Magnum::Text::FontFeature: UnsignedByte new in Git master

Features supported by a font implementation.

Enumerators
OpenData

Opening fonts from raw data using AbstractFont::openData()

FileCallback new in 2019.10

Specifying callbacks for loading additional files referenced from the main file using AbstractFont::setFileCallback(). If the font doesn't expose this feature, the format is either single-file or loading via callbacks is not supported.

See Loading data from memory, using file callbacks and particular font plugin documentation for more information.

MultiFile

The format is multi-file, thus AbstractFont::openSingleData() convenience function cannot be used.

PreparedGlyphCache

The font contains prepared glyph cache.

enum class Magnum::Text::FontConverterFeature: UnsignedByte new in Git master

Features supported by a font converter.

Enumerators
ExportFont

Exporting font using AbstractFontConverter::exportFontToFile(), AbstractFontConverter::exportFontToData() or AbstractFontConverter::exportFontToSingleData()

ExportGlyphCache

Export glyph cache using AbstractFontConverter::exportGlyphCacheToFile(), AbstractFontConverter::exportGlyphCacheToData() or AbstractFontConverter::exportGlyphCacheToSingleData()

ImportGlyphCache

Import glyph cache using AbstractFontConverter::importGlyphCacheFromFile(), AbstractFontConverter::importGlyphCacheFromData() or AbstractFontConverter::importGlyphCacheFromSingleData()

ConvertData

Convert from/to data using AbstractFontConverter::exportFontToData(), AbstractFontConverter::exportFontToSingleData(), AbstractFontConverter::exportGlyphCacheToData(), AbstractFontConverter::exportGlyphCacheToSingleData(), AbstractFontConverter::importGlyphCacheFromData() or AbstractFontConverter::importGlyphCacheFromSingleData()

MultiFile

The format is multi-file, thus AbstractFontConverter::exportFontToSingleData(), AbstractFontConverter::exportGlyphCacheToSingleData() and AbstractFontConverter::importGlyphCacheFromSingleData() convenience functions cannot be used.

enum class Magnum::Text::GlyphCacheFeature: UnsignedByte new in 2019.10

Features supported by a particular glyph cache implementation.

Enumerators
ImageDownload

Ability to download glyph cache data using AbstractGlyphCache::image(). May not be supported by glyph caches on embedded platforms that don't have an ability to get texture data back from a GPU.

enum class Magnum::Text::Alignment: UnsignedByte

Text rendering alignment.

Enumerators
LineLeft

Text start and line is at origin

LineCenter

Text center and line is at origin

LineRight

Text end and line is at origin

MiddleLeft

Text start and vertical middle is at origin

MiddleCenter

Text center and vertical middle is at origin

MiddleRight

Text end and vertical middle is at origin

TopLeft

Text start and top is at origin

TopCenter

Text center and top is at origin

TopRight

Text end and top is at origin

LineCenterIntegral

Text center and line is at origin and alignment offset is integral

MiddleLeftIntegral

Text start and vertical middle is at origin and alignment offset is integral

MiddleCenterIntegral

Text center and vertical middle is at origin and alignment offset is integral

MiddleRightIntegral

Text end and vertical middle is at origin and alignment offset is integral

Typedef documentation

typedef Containers::EnumSet<FontFeature> Magnum::Text::FontFeatures new in Git master

Set of features supported by a font implementation.

typedef Containers::EnumSet<GlyphCacheFeature> Magnum::Text::GlyphCacheFeatures new in 2019.10

Set of features supported by a glyph cache.

typedef Renderer<2> Magnum::Text::Renderer2D

Two-dimensional text renderer.

typedef Renderer<3> Magnum::Text::Renderer3D

Three-dimensional text renderer.

Function documentation

Debug& Magnum::Text::operator<<(Debug& debug, FontFeature value)

Debug output operator.

Debug& Magnum::Text::operator<<(Debug& debug, FontFeatures value)

Debug output operator.

Debug& Magnum::Text::operator<<(Debug& debug, FontConverterFeature value)

Debug output operator.

Debug& Magnum::Text::operator<<(Debug& debug, FontConverterFeatures value)

Debug output operator.