class
FreeTypeFontFreeType font plugin.
Uses the FreeType library to load fonts of the following formats:
- OpenType (
*.otf
) - TrueType (
*.ttf
) - WOFF and WOFF2 (
*.woff
,*.woff2
) - Type 1 (
*.pfb
,*.pfm
,*.afm
,*.ofm
...) - Windows Font (
*.fon
,*.fnt
) - X11 PCF (
*.pcf
) - BDF (
*.bdf
) - CID, CFF
This plugin provides the TrueTypeFont
and OpenTypeFont
plugins.
Usage
This plugin depends on the Text and FreeType libraries and is built if MAGNUM_WITH_FREETYPEFONT
is enabled when building Magnum Plugins. To use as a dynamic plugin, load "FreeTypeFont"
via Corrade::
Additionally, if you're using Magnum as a CMake subproject, bundle the magnum-plugins repository and do the following. Using FreeType itself as a CMake subproject isn't tested at the moment, so you need to provide it as a system dependency and point CMAKE_PREFIX_PATH
to its installation dir if necessary.
set(MAGNUM_WITH_FREETYPEFONT ON CACHE BOOL "" FORCE) add_subdirectory(magnum-plugins EXCLUDE_FROM_ALL) # So the dynamically loaded plugin gets built implicitly add_dependencies(your-app MagnumPlugins::FreeTypeFont)
To use as a static plugin or as a dependency of another plugin with CMake, put FindMagnumPlugins.cmake into your modules/
directory, request the FreeTypeFont
component of the MagnumPlugins
package and link to the MagnumPlugins::FreeTypeFont
target:
find_package(MagnumPlugins REQUIRED FreeTypeFont) # ... target_link_libraries(your-app PRIVATE MagnumPlugins::FreeTypeFont)
See Downloading and building plugins, Plugin usage with CMake, Loading and using plugins and File format support for more information.
Behavior and limitations
The fillGlyphCache() function expects a PixelFormat::false
.
For font formats that support it, glyphName() and glyphForName() provides mapping between glyph IDs and names.
The FreeType library alone doesn't provide any advanced shaping capabilities, thus AbstractShaper::false
. You're encouraged to use the HarfBuzzFont plugin if you need these.
While FreeType provides access to font kerning tables, the plugin doesn't use them at the moment. The feature list passed to AbstractShaper::
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() deprecated in Git master explicit
- Default constructor.
-
FreeTypeFont(PluginManager::
AbstractManager& manager, const Containers:: StringView& plugin) explicit - Plugin manager constructor.
Function documentation
Magnum:: Text:: FreeTypeFont:: FreeTypeFont() explicit
Default constructor.