Skip to content

Commit e4b278d

Browse files
committedJun 19, 2013
add QgsFontUtils sip bindings and fix doxygen warnings
1 parent caaaa21 commit e4b278d

File tree

3 files changed

+39
-2
lines changed

3 files changed

+39
-2
lines changed
 

‎python/core/core.sip

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@
8787
%Include qgsvectorlayerjoinbuffer.sip
8888
%Include qgsvectorlayerundocommand.sip
8989
%Include qgsvectoroverlay.sip
90+
%Include qgsfontutils.sip
9091

9192
%Include composer/qgsaddremoveitemcommand.sip
9293
%Include composer/qgsaddremovemultiframecommand.sip

‎python/core/qgsfontutils.sip

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
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+
};

‎src/core/qgsfontutils.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class CORE_EXPORT QgsFontUtils
2323
{
2424
public:
2525
/** Check whether exact font is on system
26-
* @param font The font to test for match
26+
* @param f The font to test for match
2727
*/
2828
static bool fontMatchOnSystem( const QFont& f );
2929

@@ -43,7 +43,7 @@ class CORE_EXPORT QgsFontUtils
4343
static bool fontFamilyMatchOnSystem( const QString& family, QString* chosen = 0, bool* match = 0 );
4444

4545
/** Updates font with named style and retain all font properties
46-
* @param font The font to update
46+
* @param f The font to update
4747
* @param fontstyle The style to try and switch the font to
4848
* @param fallback If no matching fontstyle found for font, assign most similar or first style found to font
4949
* @returns Whether the font was updated (also returns true if the requested style matches font's current style)

0 commit comments

Comments
 (0)