QGIS/python/core/auto_generated/textrenderer/qgsfontmanager.sip.in
2022-06-20 13:01:55 +10:00

185 lines
6.1 KiB
Plaintext

/************************************************************************
* This file has been generated automatically from *
* *
* src/core/textrenderer/qgsfontmanager.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/
class QgsFontManager : QObject
{
%Docstring(signature="appended")
Manages available fonts and font installation for a QGIS instance.
.. note::
:py:class:`QgsFontManager` is not usually directly created, but rather accessed through :py:func:`QgsApplication.fontManager()`.
.. versionadded:: 3.28
%End
%TypeHeaderCode
#include "qgsfontmanager.h"
%End
public:
explicit QgsFontManager( QObject *parent /TransferThis/ = 0 );
%Docstring
Constructor for QgsFontManager, with the specified ``parent`` object.
.. note::
QgsFontManager is not usually directly created, but rather accessed through :py:func:`QgsApplication.fontManager()`.
%End
QMap< QString, QString > fontFamilyReplacements() const;
%Docstring
Returns the map of automatic font family replacements.
This map is used to transparently map an original font family to an alternative
font family, e.g. to permit graceful handling of opening projects which reference
fonts which are not available on the system.
The map keys are the original font family names, and the values are the alternative
replacement family to use for the font.
.. note::
This method is thread safe.
.. seealso:: :py:func:`addFontFamilyReplacement`
.. seealso:: :py:func:`setFontFamilyReplacements`
%End
void addFontFamilyReplacement( const QString &original, const QString &replacement );
%Docstring
Adds a new font replacement from the ``original`` font family to a ``replacement`` font family.
This is used to transparently map an original font family to an alternative
font family, e.g. to permit graceful handling of opening projects which reference
fonts which are not available on the system.
The replacement map is stored locally and persists across QGIS sessions.
If ``replacement`` is an empty string then any existing mapping for the ``original``
family will be removed.
.. note::
This method is thread safe.
.. seealso:: :py:func:`fontFamilyReplacements`
.. seealso:: :py:func:`setFontFamilyReplacements`
%End
void setFontFamilyReplacements( const QMap< QString, QString> &replacements );
%Docstring
Sets the map of automatic font family ``replacements``.
This map is used to transparently map an original font family to an alternative
font family, e.g. to permit graceful handling of opening projects which reference
fonts which are not available on the system.
The map keys are the original font family names, and the values are the alternative
replacement family to use for the font.
The replacement map is stored locally and persists across QGIS sessions.
.. note::
This method is thread safe.
.. seealso:: :py:func:`fontFamilyReplacements`
.. seealso:: :py:func:`addFontFamilyReplacement`
%End
QString processFontFamilyName( const QString &name ) const;
%Docstring
Processes a font family ``name``, applying any matching :py:func:`~QgsFontManager.fontFamilyReplacements`
to the name.
.. note::
This method is thread safe.
%End
void downloadAndInstallFont( const QUrl &url, const QString &identifier = QString() );
%Docstring
Downloads a font and installs in the user's profile/fonts directory as an application font.
The download will proceed in a background task.
The optional ``identifier`` string can be used to specify a user-friendly name for the download
tasks, e.g. the font family name if known.
.. seealso:: :py:func:`fontDownloaded`
.. seealso:: :py:func:`fontDownloadErrorOccurred`
%End
bool installFontsFromData( const QByteArray &data, QString &errorMessage /Out/, QStringList &families /Out/, QString &licenseDetails /Out/ );
%Docstring
Installs local user fonts from the specified raw ``data``.
The ``data`` array may correspond to the contents of a TTF or OTF font file,
or a zipped archive of font files.
:param data: raw font data or zipped font data
:return: - ``True`` if installation was successful.
- errorMessage: will be set to a descriptive error message if the installation fails
- families: will be populated with a list of font families installed from the data
- licenseDetails: will be populated with font license details, if found
%End
void setUserFontDirectory( const QString &directory );
%Docstring
Sets the ``directory`` to use for user fonts.
This directory will be scanned for any TTF or OTF font files, which will automatically be added and made
available for use in the QGIS session. Additionally, any fonts downloaded via :py:func:`~QgsFontManager.downloadAndInstallFont` will be
installed into this directory.
%End
signals:
void fontDownloaded( const QStringList &families, const QString &licenseDetails );
%Docstring
Emitted when a font has downloaded and been locally loaded.
The ``families`` list specifies the font families contained in the downloaded font.
If found, the ``licenseDetails`` string will be populated with corresponding font license details.
.. seealso:: :py:func:`downloadAndInstallFont`
.. seealso:: :py:func:`fontDownloadErrorOccurred`
%End
void fontDownloadErrorOccurred( const QUrl &url, const QString &identifier, const QString &error );
%Docstring
Emitted when an error occurs during font downloading.
.. seealso:: :py:func:`downloadAndInstallFont`
.. seealso:: :py:func:`fontDownloaded`
%End
};
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/textrenderer/qgsfontmanager.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/