|
libosmscout 0.1
|
Answers what a configured font name names: a font family to look up, or the face that a font file holds. More...
#include <FontNameResolution.h>
Classes | |
| struct | Result |
| What a configured font name names. More... | |
Public Member Functions | |
| FontNameResolution ()=delete | |
Static Public Member Functions | |
| static bool | CanReadFamilyFromFile () |
| Whether this build can read the family name out of a font file. | |
| static bool | ReadFamilyFromFile (const std::string &fontFile, std::string &family, std::string &error) |
| Read the family name stored in a font file. | |
| static Result | Resolve (const std::string &configuredName) |
| Resolve a configured font name to the face it names. | |
Answers what a configured font name names: a font family to look up, or the face that a font file holds.
A render parameter carries one font name, and a caller may configure a family name ("Liberation Sans") or the path of a font file. A backend whose text stack resolves a font by family has to serve the face the file holds and make that file resolvable to its stack, while a backend that loads a font file directly wants the path. This is the one place that decision is taken, so that every backend and both build systems agree on it.
|
delete |
|
static |
Whether this build can read the family name out of a font file.
Without the ability to read a font file, a configured file is still recognised, but the family it holds cannot be named.
Referenced by Resolve().
|
static |
Read the family name stored in a font file.
| fontFile | path to a font file |
| family | set to the family name stored in the file on success |
| error | set to a description of what went wrong on failure |
Referenced by Resolve().
|
static |
Resolve a configured font name to the face it names.
A name that is an existing font file is read for the family it holds, so that an interface resolving by family serves that face; the file is reported as well, so that a caller can make it resolvable to its text stack. Any other name is passed on unchanged.
| configuredName | font name as the render parameter carries it |
References CanReadFamilyFromFile(), osmscout::Log::Error(), osmscout::FontNameResolution::Result::fontFile, osmscout::FontNameResolution::Result::fontName, osmscout::log, ReadFamilyFromFile(), and osmscout::Log::Warn().