|
| 1 | +class QgsFontUtils |
| 2 | +{ |
| 3 | +%TypeHeaderCode |
| 4 | +#include <qgsfontutils.h> |
| 5 | +%End |
| 6 | + public: |
| 7 | + /** Check whether exact font is on system |
| 8 | + * @param f The font to test for match |
| 9 | + */ |
| 10 | + static bool fontMatchOnSystem( const QFont& f ); |
| 11 | + |
| 12 | + /** Check whether font family is on system in a quick manner, which does not compare [foundry] |
| 13 | + * @param family The family to test |
| 14 | + * @returns Whether family was found on system |
| 15 | + * @note This is good for use in loops of large lists, e.g. registering many features for labeling |
| 16 | + */ |
| 17 | + static bool fontFamilyOnSystem( const QString& family ); |
| 18 | + |
| 19 | + /** Check whether font family is on system |
| 20 | + * @param family The family to test |
| 21 | + * @param chosen The actual family (possibly from different foundry) returned by system |
| 22 | + * @param match Whether the family [foundry] returned by system is a match |
| 23 | + * @returns Whether family was found on system |
| 24 | + */ |
| 25 | + static bool fontFamilyMatchOnSystem( const QString& family, QString* chosen = 0, bool* match = 0 ); |
| 26 | + |
| 27 | + /** Updates font with named style and retain all font properties |
| 28 | + * @param f The font to update |
| 29 | + * @param fontstyle The style to try and switch the font to |
| 30 | + * @param fallback If no matching fontstyle found for font, assign most similar or first style found to font |
| 31 | + * @returns Whether the font was updated (also returns true if the requested style matches font's current style) |
| 32 | + * @note This is a more featured replacement for a Qt 4.8+ function: void QFont::setStyleName ( const QString & styleName ) |
| 33 | + */ |
| 34 | + static bool updateFontViaStyle( QFont& f, const QString& fontstyle, bool fallback = false ); |
| 35 | + |
| 36 | +}; |
0 commit comments