#include <qgsfontutils.h>
|
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=0, bool *match=0) |
| 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 23 of file qgsfontutils.h.
bool QgsFontUtils::fontFamilyHasStyle |
( |
const QString & |
family, |
|
|
const QString & |
style |
|
) |
| |
|
static |
Check whether font family on system has specific style.
- Parameters
-
family | The family to test |
style | The style to test for |
- Returns
- Whether family has style
- Note
- Added in QGIS 2.1
Definition at line 42 of file qgsfontutils.cpp.
bool QgsFontUtils::fontFamilyMatchOnSystem |
( |
const QString & |
family, |
|
|
QString * |
chosen = 0 , |
|
|
bool * |
match = 0 |
|
) |
| |
|
static |
Check whether font family is on system.
- Parameters
-
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 |
- Returns
- Whether family was found on system
Definition at line 66 of file qgsfontutils.cpp.
bool QgsFontUtils::fontFamilyOnSystem |
( |
const QString & |
family | ) |
|
|
static |
Check whether font family is on system in a quick manner, which does not compare [foundry].
- Parameters
-
- Returns
- Whether family was found on system
- Note
- This is good for use in loops of large lists, e.g. registering many features for labeling
Definition at line 35 of file qgsfontutils.cpp.
bool QgsFontUtils::fontMatchOnSystem |
( |
const QFont & |
f | ) |
|
|
static |
Check whether exact font is on system.
- Parameters
-
f | The font to test for match |
Definition at line 29 of file qgsfontutils.cpp.
QFont QgsFontUtils::getStandardTestFont |
( |
const QString & |
style = "Roman" , |
|
|
int |
pointsize = 12 |
|
) |
| |
|
static |
Get standard test font with specific style.
- Parameters
-
style | Style to load, e.g. Roman, Oblique, Bold, Bold Oblique |
pointsize | Font point size to set |
- Returns
- QFont
- Note
- Added in QGIS 2.1
Definition at line 285 of file qgsfontutils.cpp.
bool QgsFontUtils::loadStandardTestFonts |
( |
const QStringList & |
loadstyles | ) |
|
|
static |
Loads standard test fonts from filesystem or qrc resource.
- Parameters
-
loadstyles | List of styles to load, e.g. All, Roman, Oblique, Bold, Bold Oblique |
- Returns
- Whether any font was loaded
- Note
- Done by default on debug app/server startup to ensure fonts available for unit tests (Roman and Bold)
-
Added in QGIS 2.1
Definition at line 221 of file qgsfontutils.cpp.
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.
- Parameters
-
font | font to update |
element | DOM element |
childNode | name of child node |
- Returns
- true if child node exists and properties were successfully read from node
- Note
- added in QGIS 2.10
- See also
- setFromXmlElement
-
toXmlElement
Definition at line 346 of file qgsfontutils.cpp.
bool QgsFontUtils::setFromXmlElement |
( |
QFont & |
font, |
|
|
const QDomElement & |
element |
|
) |
| |
|
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.
- Parameters
-
font | font to update |
element | DOM element |
- Returns
- true if properties were successfully read from element
- Note
- added in QGIS 2.10
- See also
- toXmlElement
-
setFromXmlChildNode
Definition at line 330 of file qgsfontutils.cpp.
QString QgsFontUtils::standardTestFontFamily |
( |
| ) |
|
|
static |
Get standard test font family.
- Note
- Added in QGIS 2.1
Definition at line 216 of file qgsfontutils.cpp.
Returns a DOM element containing the properties of the font.
- Parameters
-
font | font |
document | DOM document |
elementName | name for DOM element |
- Returns
- DOM element containing font settings
- Note
- added in QGIS 2.10
- See also
- setFromXmlElement
Definition at line 322 of file qgsfontutils.cpp.
QString QgsFontUtils::translateNamedStyle |
( |
const QString & |
namedStyle | ) |
|
|
static |
Returns the localized named style of a font, if such a translation is available.
- Parameters
-
namedStyle | a named style, i.e. "Bold", "Italic", etc |
- Returns
- The localized named style
- Note
- added in QGIS 2.12
- See also
- untranslateNamedStyle
Definition at line 376 of file qgsfontutils.cpp.
QString QgsFontUtils::untranslateNamedStyle |
( |
const QString & |
namedStyle | ) |
|
|
static |
Returns the english named style of a font, if possible.
- Parameters
-
namedStyle | a localized named style, i.e. "Fett", "Kursiv", etc |
- Returns
- The english named style
- Note
- added in QGIS 2.12
- See also
- translateNamedStyle
Definition at line 386 of file qgsfontutils.cpp.
bool QgsFontUtils::updateFontViaStyle |
( |
QFont & |
f, |
|
|
const QString & |
fontstyle, |
|
|
bool |
fallback = false |
|
) |
| |
|
static |
Updates font with named style and retain all font properties.
- Parameters
-
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 |
- Returns
- Whether the font was updated (also returns true if the requested style matches font's current style)
- Note
- This is a more featured replacement for a Qt 4.8+ function: void QFont::setStyleName ( const QString & styleName )
Definition at line 119 of file qgsfontutils.cpp.
The documentation for this class was generated from the following files: