class
StbTrueTypeFontTrueType font plugin using stb_truetype.
Uses the stb_*.otf
) and TrueType (*.ttf
) fonts.
This plugin provides the TrueTypeFont
and OpenTypeFont
plugins, but please note that this plugin trades the simplicity and portability for various limitations, the most visible being the lack of autohinting. That causes the rendered glyphs looking blurry compared to for example FreeTypeFont and because of that the font properties and sizes don't exactly match properties of fonts opened with FreeTypeFont using the same size.
Usage
This plugin depends on the Text library and is built if MAGNUM_WITH_STBTRUETYPEFONT
is enabled when building Magnum Plugins and depends on the Text library. To use as a dynamic plugin, load "StbTrueTypeFont"
via Corrade::
Additionally, if you're using Magnum as a CMake subproject, bundle the magnum-plugins repository and do the following:
set(MAGNUM_WITH_STBTRUETYPEFONT ON CACHE BOOL "" FORCE) add_subdirectory(magnum-plugins EXCLUDE_FROM_ALL) # So the dynamically loaded plugin gets built implicitly add_dependencies(your-app MagnumPlugins::StbTrueTypeFont)
To use as a static plugin or as a dependency of another plugin with CMake, put FindMagnumPlugins.cmake into your modules/
directory, request the StbTrueTypeFont
component of the MagnumPlugins
package and link to the MagnumPlugins::StbTrueTypeFont
target:
find_package(MagnumPlugins REQUIRED StbTrueTypeFont) # ... target_link_libraries(your-app PRIVATE MagnumPlugins::StbTrueTypeFont)
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
.
The stb_truetype library doesn't provide any advanced shaping capabilities, thus AbstractShaper::false
. You're encouraged to use the HarfBuzzFont plugin if you need these. The stb_truetype doesn't implement support for glyph name mapping, you're encouraged to use the FreeTypeFont plugin if you need to query names or look up glyphs by name.
Hinting is not implemented in stb_truetype. Compared to FreeTypeFont or HarfBuzzFont you get larger glyphs with a more blurry look.
While stb_truetype 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.
Constructors, destructors, conversion operators
- StbTrueTypeFont() deprecated in Git master explicit
- Default constructor.
-
StbTrueTypeFont(PluginManager::
AbstractManager& manager, const Containers:: StringView& plugin) explicit - Plugin manager constructor.
Function documentation
Magnum:: Text:: StbTrueTypeFont:: StbTrueTypeFont() explicit
Default constructor.