QGIS API Documentation 3.36.0-Maidenhead (09951dc0acf)
Loading...
Searching...
No Matches
qgsfontutils.h
Go to the documentation of this file.
1/***************************************************************************
2 qgsfontutils.h
3 ---------------------
4 begin : June 5, 2013
5 copyright : (C) 2013 by Larry Shaffer
6 email : larrys at dakotacarto dot com
7 ***************************************************************************
8 * *
9 * This program is free software; you can redistribute it and/or modify *
10 * it under the terms of the GNU General Public License as published by *
11 * the Free Software Foundation; either version 2 of the License, or *
12 * (at your option) any later version. *
13 * *
14 ***************************************************************************/
15
16#ifndef QGSFONTUTILS_H
17#define QGSFONTUTILS_H
18
19#include <QFont>
20#include <QString>
21#include <QDomElement>
22
23#include "qgis_core.h"
24#include "qgis_sip.h"
25
26class QMimeData;
27
32class CORE_EXPORT QgsFontUtils
33{
34 public:
35
40 static bool fontMatchOnSystem( const QFont &f );
41
48 static bool fontFamilyOnSystem( const QString &family );
49
56 static bool fontFamilyHasStyle( const QString &family, const QString &style );
57
69 static QString resolveFontStyleName( const QFont &font );
70
78 static bool fontFamilyMatchOnSystem( const QString &family, QString *chosen = nullptr, bool *match = nullptr );
79
88 static bool updateFontViaStyle( QFont &f, const QString &fontstyle, bool fallback = false );
89
93 static QString standardTestFontFamily();
94
101 static bool loadStandardTestFonts( const QStringList &loadstyles );
102
109 static QFont getStandardTestFont( const QString &style = "Roman", int pointsize = 12 );
110
119 static QDomElement toXmlElement( const QFont &font, QDomDocument &document, const QString &elementName );
120
130 static bool setFromXmlElement( QFont &font, const QDomElement &element );
131
142 static bool setFromXmlChildNode( QFont &font, const QDomElement &element, const QString &childNode );
143
149 static QMimeData *toMimeData( const QFont &font ) SIP_FACTORY;
150
156 static QFont fromMimeData( const QMimeData *data, bool *ok SIP_OUT = nullptr );
157
164 static QString translateNamedStyle( const QString &namedStyle );
165
172 static QString untranslateNamedStyle( const QString &namedStyle );
173
183 static QString asCSS( const QFont &font, double pointToPixelMultiplier = 1.0 );
184
189 static void addRecentFontFamily( const QString &family );
190
195 static QStringList recentFontFamilies();
196
204 static void setFontFamily( QFont &font, const QString &family );
205
213 static QFont createFont( const QString &family, int pointSize = -1, int weight = -1, bool italic = false );
214};
215
216// clazy:excludeall=qstring-allocations
217
218#endif // QGSFONTUTILS_H
#define SIP_OUT
Definition qgis_sip.h:58
#define SIP_FACTORY
Definition qgis_sip.h:76