QGIS API Documentation  2.6.0-Brighton
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Static Public Member Functions | List of all members
QgsFontUtils Class Reference

#include <qgsfontutils.h>

Static Public Member Functions

static bool fontMatchOnSystem (const QFont &f)
 Check whether exact font is on system.
static bool fontFamilyOnSystem (const QString &family)
 Check whether font family is on system in a quick manner, which does not compare [foundry].
static bool fontFamilyHasStyle (const QString &family, const QString &style)
 Check whether font family on system has specific style.
static bool fontFamilyMatchOnSystem (const QString &family, QString *chosen=0, bool *match=0)
 Check whether font family is on system.
static bool updateFontViaStyle (QFont &f, const QString &fontstyle, bool fallback=false)
 Updates font with named style and retain all font properties.
static QString standardTestFontFamily ()
 Get standard test font family.
static bool loadStandardTestFonts (QStringList loadstyles)
 Loads standard test fonts from filesystem or qrc resource.
static QFont getStandardTestFont (const QString &style="Roman", int pointsize=12)
 Get standard test font with specific style.

Member Function Documentation

bool QgsFontUtils::fontFamilyHasStyle ( const QString &  family,
const QString &  style 
)
static

Check whether font family on system has specific style.

Parameters
familyThe family to test
styleThe style to test for
Returns
Whether family has style
Note
Added in QGIS 2.1
bool QgsFontUtils::fontFamilyMatchOnSystem ( const QString &  family,
QString *  chosen = 0,
bool *  match = 0 
)
static

Check whether font family is on system.

Parameters
familyThe family to test
chosenThe actual family (possibly from different foundry) returned by system
matchWhether the family [foundry] returned by system is a match
Returns
Whether family was found on system
bool QgsFontUtils::fontFamilyOnSystem ( const QString &  family)
static

Check whether font family is on system in a quick manner, which does not compare [foundry].

Parameters
familyThe family to test
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
bool QgsFontUtils::fontMatchOnSystem ( const QFont &  f)
static

Check whether exact font is on system.

Parameters
fThe font to test for match
QFont QgsFontUtils::getStandardTestFont ( const QString &  style = "Roman",
int  pointsize = 12 
)
static

Get standard test font with specific style.

Parameters
styleStyle to load, e.g. Roman, Oblique, Bold, Bold Oblique
pointsizeFont point size to set
Returns
QFont
Note
Added in QGIS 2.1
bool QgsFontUtils::loadStandardTestFonts ( QStringList  loadstyles)
static

Loads standard test fonts from filesystem or qrc resource.

Parameters
loadstylesList 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
QString QgsFontUtils::standardTestFontFamily ( )
static

Get standard test font family.

Note
Added in QGIS 2.1
bool QgsFontUtils::updateFontViaStyle ( QFont &  f,
const QString &  fontstyle,
bool  fallback = false 
)
static

Updates font with named style and retain all font properties.

Parameters
fThe font to update
fontstyleThe style to try and switch the font to
fallbackIf 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 )

The documentation for this class was generated from the following files: