class
AbstractFontConverterBase for font converter plugins.
Contents
Provides functionality for converting arbitrary font to different format. See Loading and using plugins for more information and *FontConverter
classes in Text namespace for available font converter plugins.
You can use the magnum-fontconverter utility to do font conversion on command-line.
Subclassing
Plugin implements doFeatures() and one or more of exportTo*()
/ importFrom*()
functions based on what features are supported. Characters passed to font exporting functions are converted to list of unique UTF-32 characters.
You don't need to do most of the redundant sanity checks, these things are checked by the implementation:
- Functions
doExportFontTo*()
are called only if Feature::ExportFont is supported, functions doExportGlyphCacheTo*()
are called only if Feature::ExportGlyphCache is supported. - Functions
doImportGlyphCacheFrom*()
are called only if Feature::ImportGlyphCache is supported. - Functions
doExport*To*Data()
anddoImport*From*Data()
are called only if Feature::ConvertData is supported. - Function
doImport*FromData()
is called only if there is at least one data array passed.
Derived classes
- class MagnumFontConverter
- MagnumFont converter plugin.
Public types
- enum class Feature: UnsignedByte { ExportFont = 1 << 0, ExportGlyphCache = 1 << 1, ImportGlyphCache = 1 << 2, ConvertData = 1 << 4, MultiFile = 1 << 5 }
- Features supported by this converter.
-
using Features = Containers::
EnumSet<Feature> - Features supported by this converter.
Public static functions
-
static auto pluginInterface() -> std::
string - Plugin interface.
-
static auto pluginSearchPaths() -> std::
vector<std:: string> - Plugin search paths.
Constructors, destructors, conversion operators
- AbstractFontConverter() explicit
- Default constructor.
-
AbstractFontConverter(PluginManager::
AbstractManager& manager, const std:: string& plugin) explicit - Plugin manager constructor.
Public functions
- auto features() const -> Features
- Features supported by this converter.
-
auto exportFontToData(AbstractFont& font,
GlyphCache& cache,
const std::
string& filename, const std:: string& characters) const -> std:: vector<std:: pair<std:: string, Containers:: Array<char>>> - Export font to raw data.
-
auto exportFontToSingleData(AbstractFont& font,
GlyphCache& cache,
const std::
string& characters) const -> Containers:: Array<char> - Export font to single raw data.
-
auto exportFontToFile(AbstractFont& font,
GlyphCache& cache,
const std::
string& filename, const std:: string& characters) const -> bool - Export font to file.
-
auto exportGlyphCacheToData(GlyphCache& cache,
const std::
string& filename) const -> std:: vector<std:: pair<std:: string, Containers:: Array<char>>> - Export glyph cache to raw data.
-
auto exportGlyphCacheToSingleData(GlyphCache& cache) const -> Containers::
Array<char> - Export glyph cache to single raw data.
-
auto exportGlyphCacheToFile(GlyphCache& cache,
const std::
string& filename) const -> bool - Export glyph cache to file.
-
auto importGlyphCacheFromData(const std::
vector<std:: pair<std:: string, Containers:: ArrayView<const char>>>& data) const -> std:: unique_ptr<GlyphCache> - Import glyph cache from raw data.
-
auto importGlyphCacheFromSingleData(Containers::
ArrayView<const char> data) const -> std:: unique_ptr<GlyphCache> - Import glyph cache from single raw data.
-
auto importGlyphCacheFromFile(const std::
string& filename) const -> std:: unique_ptr<GlyphCache> - Import glyph cache from file.
Protected functions
- auto doFeatures() const -> Features pure virtual
- Implementation for features()
-
auto doExportFontToData(AbstractFont& font,
GlyphCache& cache,
const std::
string& filename, const std:: u32string& characters) const -> std:: vector<std:: pair<std:: string, Containers:: Array<char>>> virtual - Implementation for exportFontToData()
-
auto doExportFontToSingleData(AbstractFont& font,
GlyphCache& cache,
const std::
u32string& characters) const -> Containers:: Array<char> virtual - Implementation for exportFontToSingleData()
-
auto doExportFontToFile(AbstractFont& font,
GlyphCache& cache,
const std::
string& filename, const std:: u32string& characters) const -> bool virtual - Implementation for exportFontToFile()
-
auto doExportGlyphCacheToData(GlyphCache& cache,
const std::
string& filename) const -> std:: vector<std:: pair<std:: string, Containers:: Array<char>>> virtual - Implementation for exportGlyphCacheToData()
-
auto doExportGlyphCacheToSingleData(GlyphCache& cache) const -> Containers::
Array<char> virtual - Implementation for exportGlyphCacheToSingleData()
-
auto doExportGlyphCacheToFile(GlyphCache& cache,
const std::
string& filename) const -> bool virtual - Implementation for exportGlyphCacheToFile()
-
auto doImportGlyphCacheFromData(const std::
vector<std:: pair<std:: string, Containers:: ArrayView<const char>>>& data) const -> std:: unique_ptr<GlyphCache> virtual - Implementation for importGlyphCacheFromData()
-
auto doImportGlyphCacheFromSingleData(Containers::
ArrayView<const char> data) const -> std:: unique_ptr<GlyphCache> virtual - Implementation for importGlyphCacheFromSingleData()
-
auto doImportGlyphCacheFromFile(const std::
string& filename) const -> std:: unique_ptr<GlyphCache> virtual - Implementation for importGlyphCacheFromFile()
Enum documentation
enum class Magnum:: Text:: AbstractFontConverter:: Feature: UnsignedByte
Features supported by this converter.
Enumerators | |
---|---|
ExportFont |
Exporting font using exportFontToFile(), exportFontToData() or exportFontToSingleData() |
ExportGlyphCache |
Export glyph cache using exportGlyphCacheToFile(), exportGlyphCacheToData() or exportGlyphCacheToSingleData() |
ImportGlyphCache |
Import glyph cache using importGlyphCacheFromFile(), importGlyphCacheFromData() or importGlyphCacheFromSingleData() |
ConvertData |
Convert from/to data using exportFontToData(), exportFontToSingleData(), exportGlyphCacheToData(), exportGlyphCacheToSingleData(), importGlyphCacheFromData() or importGlyphCacheFromSingleData() |
MultiFile |
The format is multi-file, thus exportFontToSingleData(), exportGlyphCacheToSingleData() and importGlyphCacheFromSingleData() convenience functions cannot be used. |
Typedef documentation
typedef Containers:: EnumSet<Feature> Magnum:: Text:: AbstractFontConverter:: Features
Features supported by this converter.
Function documentation
static std:: string Magnum:: Text:: AbstractFontConverter:: pluginInterface()
Plugin interface.
"cz.mosra.magnum.Text.AbstractFontConverter/0.1.2"
static std:: vector<std:: string> Magnum:: Text:: AbstractFontConverter:: pluginSearchPaths()
Plugin search paths.
First looks in magnum/fontconverters/
or magnum-d/fontconverters/
next to the executable and as a fallback in magnum/fontconverters/
or magnum-d/fontconverters/
in the runtime install location (lib[64]/
on Unix-like systems, bin/
on Windows). The system-wide plugin search directory is configurable using the MAGNUM_PLUGINS_DIR
CMake variables, see Downloading and building for more information.
Not defined on platforms without dynamic plugin support.
std:: vector<std:: pair<std:: string, Containers:: Array<char>>> Magnum:: Text:: AbstractFontConverter:: exportFontToData(AbstractFont& font,
GlyphCache& cache,
const std:: string& filename,
const std:: string& characters) const
Export font to raw data.
Parameters | |
---|---|
font | Opened font |
cache | Populated glyph cache |
filename | Output filename |
characters | Characters to export |
Available only if Feature::filename
. If the plugin doesn't have Feature::
Containers:: Array<char> Magnum:: Text:: AbstractFontConverter:: exportFontToSingleData(AbstractFont& font,
GlyphCache& cache,
const std:: string& characters) const
Export font to single raw data.
Available only if Feature::
bool Magnum:: Text:: AbstractFontConverter:: exportFontToFile(AbstractFont& font,
GlyphCache& cache,
const std:: string& filename,
const std:: string& characters) const
Export font to file.
Available only if Feature::filename
. Returns true
on success, false
otherwise. See exportFontToData() for more information.
std:: vector<std:: pair<std:: string, Containers:: Array<char>>> Magnum:: Text:: AbstractFontConverter:: exportGlyphCacheToData(GlyphCache& cache,
const std:: string& filename) const
Export glyph cache to raw data.
Parameters | |
---|---|
cache | Populated glyph cache |
filename | Output filename |
Available only if Feature::filename
. If the plugin doesn't have Feature::
All glyphs from given cache will be exported. If you want to export smaller subset, fill the cache with less characters.
Containers:: Array<char> Magnum:: Text:: AbstractFontConverter:: exportGlyphCacheToSingleData(GlyphCache& cache) const
Export glyph cache to single raw data.
Available only if Feature::
bool Magnum:: Text:: AbstractFontConverter:: exportGlyphCacheToFile(GlyphCache& cache,
const std:: string& filename) const
Export glyph cache to file.
Available only if Feature::filename
. Returns true
on success, false
otherwise.
std:: unique_ptr<GlyphCache> Magnum:: Text:: AbstractFontConverter:: importGlyphCacheFromData(const std:: vector<std:: pair<std:: string, Containers:: ArrayView<const char>>>& data) const
Import glyph cache from raw data.
Parameters | |
---|---|
data | Pairs of filename and file data |
Available only if Feature::nullptr
otherwise. If the plugin doesn't have Feature::
std:: unique_ptr<GlyphCache> Magnum:: Text:: AbstractFontConverter:: importGlyphCacheFromSingleData(Containers:: ArrayView<const char> data) const
Import glyph cache from single raw data.
Available only if Feature::nullptr
otherwise. See importGlyphCacheFromData() for multi-file conversion.
std:: unique_ptr<GlyphCache> Magnum:: Text:: AbstractFontConverter:: importGlyphCacheFromFile(const std:: string& filename) const
Import glyph cache from file.
Available only if Feature::filename
. Returns imported cache on success, nullptr
otherwise.
std:: vector<std:: pair<std:: string, Containers:: Array<char>>> Magnum:: Text:: AbstractFontConverter:: doExportFontToData(AbstractFont& font,
GlyphCache& cache,
const std:: string& filename,
const std:: u32string& characters) const virtual protected
Implementation for exportFontToData()
If the plugin doesn't have Feature::
bool Magnum:: Text:: AbstractFontConverter:: doExportFontToFile(AbstractFont& font,
GlyphCache& cache,
const std:: string& filename,
const std:: u32string& characters) const virtual protected
Implementation for exportFontToFile()
If Feature::
std:: vector<std:: pair<std:: string, Containers:: Array<char>>> Magnum:: Text:: AbstractFontConverter:: doExportGlyphCacheToData(GlyphCache& cache,
const std:: string& filename) const virtual protected
Implementation for exportGlyphCacheToData()
If the plugin doesn't have Feature::
bool Magnum:: Text:: AbstractFontConverter:: doExportGlyphCacheToFile(GlyphCache& cache,
const std:: string& filename) const virtual protected
Implementation for exportGlyphCacheToFile()
If Feature::
std:: unique_ptr<GlyphCache> Magnum:: Text:: AbstractFontConverter:: doImportGlyphCacheFromData(const std:: vector<std:: pair<std:: string, Containers:: ArrayView<const char>>>& data) const virtual protected
Implementation for importGlyphCacheFromData()
If the plugin doesn't have Feature::
std:: unique_ptr<GlyphCache> Magnum:: Text:: AbstractFontConverter:: doImportGlyphCacheFromFile(const std:: string& filename) const virtual protected
Implementation for importGlyphCacheFromFile()
If Feature::