QGIS API Documentation
2.18.21-Las Palmas (9fba24a)
|
#include <qgsfontutils.h>
Static Public Member Functions | |
static QString | asCSS (const QFont &font, double pointToPixelMultiplier=1.0) |
Returns a CSS string representing the specified font as closely as possible. More... | |
static bool | fontFamilyHasStyle (const QString &family, const QString &style) |
Check whether font family on system has specific style. More... | |
static bool | fontFamilyMatchOnSystem (const QString &family, QString *chosen=nullptr, bool *match=nullptr) |
Check whether font family is on system. More... | |
static bool | fontFamilyOnSystem (const QString &family) |
Check whether font family is on system in a quick manner, which does not compare [foundry]. More... | |
static bool | fontMatchOnSystem (const QFont &f) |
Check whether exact font is on system. More... | |
static QFont | getStandardTestFont (const QString &style="Roman", int pointsize=12) |
Get standard test font with specific style. More... | |
static bool | loadStandardTestFonts (const QStringList &loadstyles) |
Loads standard test fonts from filesystem or qrc resource. More... | |
static bool | setFromXmlChildNode (QFont &font, const QDomElement &element, const QString &childNode) |
Sets the properties of a font to match the properties stored in an XML child node. More... | |
static bool | setFromXmlElement (QFont &font, const QDomElement &element) |
Sets the properties of a font to match the properties stored in an XML element. More... | |
static QString | standardTestFontFamily () |
Get standard test font family. More... | |
static QDomElement | toXmlElement (const QFont &font, QDomDocument &document, const QString &elementName) |
Returns a DOM element containing the properties of the font. More... | |
static QString | translateNamedStyle (const QString &namedStyle) |
Returns the localized named style of a font, if such a translation is available. More... | |
static QString | untranslateNamedStyle (const QString &namedStyle) |
Returns the english named style of a font, if possible. More... | |
static bool | updateFontViaStyle (QFont &f, const QString &fontstyle, bool fallback=false) |
Updates font with named style and retain all font properties. More... | |
Definition at line 26 of file qgsfontutils.h.
Returns a CSS string representing the specified font as closely as possible.
font | QFont to convert |
pointToPixelMultiplier | scaling factor to apply to convert point sizes to pixel font sizes. The CSS returned by this function will always use pixels for font sizes, so this parameter should be set to a suitable value to convert point sizes to pixels (eg taking into account desination DPI) |
Definition at line 403 of file qgsfontutils.cpp.
Check whether font family on system has specific style.
family | The family to test |
style | The style to test for |
Definition at line 42 of file qgsfontutils.cpp.
|
static |
Check whether font family is on system.
family | The family to test |
chosen | The actual family (possibly from different foundry) returned by system |
match | Whether the family [foundry] returned by system is a match |
Definition at line 66 of file qgsfontutils.cpp.
|
static |
Check whether font family is on system in a quick manner, which does not compare [foundry].
family | The family to test |
Definition at line 35 of file qgsfontutils.cpp.
|
static |
Check whether exact font is on system.
f | The font to test for match |
Definition at line 29 of file qgsfontutils.cpp.
|
static |
Get standard test font with specific style.
style | Style to load, e.g. Roman, Oblique, Bold, Bold Oblique |
pointsize | Font point size to set |
Definition at line 284 of file qgsfontutils.cpp.
|
static |
Loads standard test fonts from filesystem or qrc resource.
loadstyles | List of styles to load, e.g. All, Roman, Oblique, Bold, Bold Oblique |
Definition at line 221 of file qgsfontutils.cpp.
|
static |
Sets the properties of a font to match the properties stored in an XML child node.
Calling this will overwrite the current properties of the font.
font | font to update |
element | DOM element |
childNode | name of child node |
Definition at line 345 of file qgsfontutils.cpp.
|
static |
Sets the properties of a font to match the properties stored in an XML element.
Calling this will overwrite the current properties of the font.
font | font to update |
element | DOM element |
Definition at line 329 of file qgsfontutils.cpp.
|
static |
Get standard test font family.
Definition at line 216 of file qgsfontutils.cpp.
|
static |
Returns a DOM element containing the properties of the font.
font | font |
document | DOM document |
elementName | name for DOM element |
Definition at line 321 of file qgsfontutils.cpp.
Returns the localized named style of a font, if such a translation is available.
namedStyle | a named style, i.e. "Bold", "Italic", etc |
Definition at line 375 of file qgsfontutils.cpp.
Returns the english named style of a font, if possible.
namedStyle | a localized named style, i.e. "Fett", "Kursiv", etc |
Definition at line 385 of file qgsfontutils.cpp.
|
static |
Updates font with named style and retain all font properties.
f | The font to update |
fontstyle | The style to try and switch the font to |
fallback | If no matching fontstyle found for font, assign most similar or first style found to font |
Definition at line 119 of file qgsfontutils.cpp.