Krita Source Code Documentation
Loading...
Searching...
No Matches
KisFontFunctions Class Reference

#include <KisFontFunctions.h>

+ Inheritance diagram for KisFontFunctions:

Static Public Member Functions

static Q_INVOKABLE QVariantMap getMapFromQVariant (QVariant var)
 
static Q_INVOKABLE bool isBitmapType (int type)
 Because we can't register KoSvgText for qt 6 in this plugin, we'll test if the enum is valid here.
 
static Q_INVOKABLE bool isOpenType (int type)
 
static Q_INVOKABLE bool isPostScriptType (int type)
 
static Q_INVOKABLE QString sampleTagForQLocale (const QLocale &locale)
 Returns the sample tag for a given locale, calls KoWritingSystemUtils.
 
static Q_INVOKABLE QString wwsFontFamilyName (QString familyName)
 Returns the wwsname when present, otherwise returns the family name;.
 
static Q_INVOKABLE QVariant wwsFontFamilyNameVariant (QString familyName)
 Returns the wws name as a variant which can be invalid when not found.
 

Detailed Description

Number of functions related to handling FontFamilies inside QML. For some reason, if you have a collection of static functions, they can only be accessed via QML via an Object.

Definition at line 18 of file KisFontFunctions.h.

Member Function Documentation

◆ getMapFromQVariant()

QVariantMap KisFontFunctions::getMapFromQVariant ( QVariant var)
static

QML can only really use QVariantMaps, so if you have a potential QVariantHash, you can use this function to convert it to a QVariantMap.

Definition at line 33 of file KisFontFunctions.cpp.

34{
35 return var.toMap();
36}

◆ isBitmapType()

bool KisFontFunctions::isBitmapType ( int type)
static

Because we can't register KoSvgText for qt 6 in this plugin, we'll test if the enum is valid here.

Definition at line 38 of file KisFontFunctions.cpp.

References KoSvgText::BDFFontType.

◆ isOpenType()

bool KisFontFunctions::isOpenType ( int type)
static

Definition at line 48 of file KisFontFunctions.cpp.

References KoSvgText::OpenTypeFontType.

◆ isPostScriptType()

bool KisFontFunctions::isPostScriptType ( int type)
static

Definition at line 43 of file KisFontFunctions.cpp.

References KoSvgText::Type1FontType.

◆ sampleTagForQLocale()

QString KisFontFunctions::sampleTagForQLocale ( const QLocale & locale)
static

Returns the sample tag for a given locale, calls KoWritingSystemUtils.

Definition at line 28 of file KisFontFunctions.cpp.

29{
31}
static QString sampleTagForQLocale(const QLocale &locale)

References KoWritingSystemUtils::sampleTagForQLocale().

◆ wwsFontFamilyName()

QString KisFontFunctions::wwsFontFamilyName ( QString familyName)
static

Returns the wwsname when present, otherwise returns the family name;.

Definition at line 10 of file KisFontFunctions.cpp.

11{
12 std::optional<QString> name = KoFontRegistry::instance()->wwsNameByFamilyName(familyName);
13 if (!name) {
14 return familyName;
15 }
16 return name.value();
17}
std::optional< QString > wwsNameByFamilyName(const QString familyName) const
static KoFontRegistry * instance()
const char * name(StandardAction id)

References KoFontRegistry::instance(), and KoFontRegistry::wwsNameByFamilyName().

◆ wwsFontFamilyNameVariant()

QVariant KisFontFunctions::wwsFontFamilyNameVariant ( QString familyName)
static

Returns the wws name as a variant which can be invalid when not found.

Definition at line 19 of file KisFontFunctions.cpp.

20{
21 std::optional<QString> name = KoFontRegistry::instance()->wwsNameByFamilyName(familyName);
22 if (!name) {
23 return QVariant();
24 }
25 return name.value();
26}

References KoFontRegistry::instance(), and KoFontRegistry::wwsNameByFamilyName().


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