Magnum::Text::FreeTypeFont class

FreeType font plugin.

The font can be created either from file or from memory location of format supported by FreeType library.

This plugin depends on the Text and FreeType libraries and is built if WITH_FREETYPEFONT is enabled when building Magnum Plugins. To use as a dynamic plugin, you need to load the "FreeTypeFont" plugin from MAGNUM_PLUGINS_FONT_DIR. To use as a static plugin or as a dependency of another plugin with CMake, you need to request the FreeTypeFont component of the MagnumPlugins package and link to the MagnumPlugins::FreeTypeFont target.

This plugin provides the TrueTypeFont and OpenTypeFont plugins.

See Downloading and building plugins, Plugin usage with CMake and Loading and using plugins for more information.

Base classes

class AbstractFont
Base for font plugins.

Derived classes

class HarfBuzzFont
HarfBuzz font plugin.

Public static functions

static void initialize()
Initialize FreeType library.
static void finalize()
Finalize FreeType library.

Constructors, destructors, conversion operators

FreeTypeFont() explicit
Default constructor.
FreeTypeFont(PluginManager::AbstractManager& manager, const std::string& plugin) explicit
Plugin manager constructor.

Private functions

auto doIsOpened() const override -> bool virtual
Implementation for isOpened()
auto doOpenSingleData(Containers::ArrayView<const char> data, Float size) override -> Metrics virtual
Implementation for openSingleData()
void doClose() override virtual
Implementation for close()
auto doFeatures() const override -> Features virtual
Implementation for features()
auto doGlyphId(char32_t character) override -> UnsignedInt virtual
Implementation for glyphId()
auto doGlyphAdvance(UnsignedInt glyph) override -> Vector2 virtual
Implementation for glyphAdvance()
auto doLayout(const GlyphCache& cache, Float size, const std::string& text) override -> std::unique_ptr<AbstractLayouter> virtual
Implementation for layout()

Function documentation

Metrics Magnum::Text::FreeTypeFont::doOpenSingleData(Containers::ArrayView<const char> data, Float size) override virtual private

Implementation for openSingleData()

Return metrics of opened font on successful opening, zeros otherwise.