Krita Source Code Documentation
Loading...
Searching...
No Matches
KoCSSFontInfo Struct Reference

The KoCSSFontInfo class Convenience struct to make it easier to use KoFontRegistry. This struct contains default css values and can generate the axisvalues for the given values. More...

#include <KoCSSFontInfo.h>

+ Inheritance diagram for KoCSSFontInfo:

Public Member Functions

QMap< QString, double > computedAxisSettings () const
 
bool operator== (const KoCSSFontInfo &rhs) const
 

Public Attributes

bool automaticOpticalSizing = true
 < Size in Pt.
 
bool autoSlant = true
 
QMap< QString, double > axisSettings
 
QStringList families
 
double fontSizeAdjust = 0.0
 
double size = -1
 
QFont::Style slantMode = QFont::StyleNormal
 
double slantValue = 0.0
 
double weight = 400
 
double width = 100
 

Detailed Description

The KoCSSFontInfo class Convenience struct to make it easier to use KoFontRegistry. This struct contains default css values and can generate the axisvalues for the given values.

Definition at line 21 of file KoCSSFontInfo.h.

Member Function Documentation

◆ computedAxisSettings()

QMap< QString, double > KoCSSFontInfo::computedAxisSettings ( ) const
inline

Definition at line 37 of file KoCSSFontInfo.h.

37 {
38 QMap<QString, double> settings;
39 settings.insert("wght", weight);
40 settings.insert("wdth", width);
42 settings.insert("opsz", size);
43 }
44 if (slantMode == QFont::StyleItalic) {
45 settings.insert("ital", 1);
46 } else if (slantMode == QFont::StyleOblique) {
47 settings.insert("slnt", -(autoSlant? 14.0: slantValue));
48 } else {
49 settings.insert("ital", 0);
50 }
51 for (auto it = axisSettings.begin(); it != axisSettings.end(); it++) {
52 settings.insert(it.key(), it.value());
53 }
54
55 return settings;
56 }
bool automaticOpticalSizing
< Size in Pt.
QMap< QString, double > axisSettings
QFont::Style slantMode

◆ operator==()

bool KoCSSFontInfo::operator== ( const KoCSSFontInfo & rhs) const
inline

Definition at line 58 of file KoCSSFontInfo.h.

58 {
59 bool sizeMatch = automaticOpticalSizing? true: qFuzzyCompare(size, rhs.size);
60 bool slantMatch = autoSlant == rhs.autoSlant? true: qFuzzyCompare(slantValue, rhs.slantValue);
61 return families == rhs.families
63 && sizeMatch
66 && slantMode == rhs.slantMode
67 && slantMatch
68 && axisSettings == rhs.axisSettings;
69 }
static bool qFuzzyCompare(half p1, half p2)
QStringList families

References automaticOpticalSizing, autoSlant, axisSettings, families, qFuzzyCompare(), size, slantMode, slantValue, weight, and width.

Member Data Documentation

◆ automaticOpticalSizing

bool KoCSSFontInfo::automaticOpticalSizing = true

< Size in Pt.

Definition at line 26 of file KoCSSFontInfo.h.

◆ autoSlant

bool KoCSSFontInfo::autoSlant = true

Definition at line 32 of file KoCSSFontInfo.h.

◆ axisSettings

QMap<QString, double> KoCSSFontInfo::axisSettings

Definition at line 35 of file KoCSSFontInfo.h.

◆ families

QStringList KoCSSFontInfo::families

Definition at line 23 of file KoCSSFontInfo.h.

◆ fontSizeAdjust

double KoCSSFontInfo::fontSizeAdjust = 0.0

Definition at line 27 of file KoCSSFontInfo.h.

◆ size

double KoCSSFontInfo::size = -1

Definition at line 25 of file KoCSSFontInfo.h.

◆ slantMode

QFont::Style KoCSSFontInfo::slantMode = QFont::StyleNormal

Definition at line 31 of file KoCSSFontInfo.h.

◆ slantValue

double KoCSSFontInfo::slantValue = 0.0

Definition at line 33 of file KoCSSFontInfo.h.

◆ weight

double KoCSSFontInfo::weight = 400

Definition at line 28 of file KoCSSFontInfo.h.

◆ width

double KoCSSFontInfo::width = 100

Definition at line 29 of file KoCSSFontInfo.h.


The documentation for this struct was generated from the following file: