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

Public Member Functions

bool compareAxes (QHash< QString, KoSvgText::FontFamilyAxis > otherAxes)
 
QStringList debugInfo () const
 
 FontFamilyNode ()
 
bool hasAnyColor () const
 

Static Public Member Functions

static FontFamilyNode createWWSFamilyNode (const FontFamilyNode &child, const FontFamilyNode &typographic, QStringList existingWWSNames)
 

Public Attributes

QHash< QString, KoSvgText::FontFamilyAxisaxes
 axes While typical font-files within the same family are defined by having a single weight or width, variable fonts are defined by a range. The axis info abstracts both into a structure of a range between two values, which in turn means that if we take a family as a whole, we can combine all axes to find the total range of variations.
 
bool colorBitMap = false
 
bool colorClrV0 = false
 
bool colorClrV1 = false
 
bool colorSVG = false
 
int fileIndex = 0
 
QString fileName
 
QString fontFamily
 
QString fontStyle
 
bool isItalic = false
 
bool isOblique = false
 
bool isVariable = false
 
QDateTime lastModified
 Other files that seem related. These might be duplicate font files, or fonts where only the tech differs.
 
QHash< QLocale, QString > localizedFontFamilies
 Last time the file was modified.
 
QHash< QLocale, QString > localizedFontStyle
 
QHash< QLocale, QString > localizedFullName
 
QHash< QLocale, QString > localizedTypographicStyle
 
QHash< QLocale, QString > localizedWWSStyle
 
QStringList otherFiles
 Languages supported, according to fontconfig.
 
QHash< int, QStringListpixelSizes
 pixelSizes This is only used for bitmap fonts, when searching we try to return the files associated with the appropriate pixelsize first, so that usage wise it'll feel identical to using an opentype font with multiple bitmap strikes.
 
QHash< QString, QString > sampleStrings
 Truetype collections have indices that need to be checked against.
 
FontFamilySizeInfo sizeInfo
 sizeInfo This is only really used to ensure that sizes get sorted into different WWS families, as otherwise they're unselectable. We could take them into account when searching, but the CSS-WG hasn't explicitly requested or provided any guidance therein.
 
QList< KoSvgText::FontFamilyStyleInfostyleInfo
 styleInfo This abstracts both font families that consist of many separate font-files and variable fonts with many separate instances, and the hybrid of the two (commonly, if there's an italic type, it is put into a separate variable font file from the regular type).
 
QList< QLocale > supportedLanguages
 sample string used to generate the preview;
 
KoSvgText::FontFormatType type = KoSvgText::UnknownFontType
 

Detailed Description

Definition at line 65 of file KoFFWWSConverter.cpp.

Constructor & Destructor Documentation

◆ FontFamilyNode()

FontFamilyNode::FontFamilyNode ( )
inline

Definition at line 67 of file KoFFWWSConverter.cpp.

67{}

Member Function Documentation

◆ compareAxes()

bool FontFamilyNode::compareAxes ( QHash< QString, KoSvgText::FontFamilyAxis > otherAxes)
inline

Definition at line 132 of file KoFFWWSConverter.cpp.

132 {
133 if (axes.keys() != otherAxes.keys()) {
134 return false;
135 }
136 for (int k = 0; k < axes.keys().size(); k++) {
137 KoSvgText::FontFamilyAxis a = axes.value(axes.keys().at(k));
138 KoSvgText::FontFamilyAxis b = otherAxes.value(axes.keys().at(k));
139 if (!qFuzzyCompare(a.value, b.value)) {
140 return false;
141 }
142 }
143 return true;
144 }
static bool qFuzzyCompare(half p1, half p2)
int size(const Forest< T > &forest)
Definition KisForest.h:1232
QHash< QString, KoSvgText::FontFamilyAxis > axes
axes While typical font-files within the same family are defined by having a single weight or width,...

References axes, qFuzzyCompare(), and KoSvgText::FontFamilyAxis::value.

◆ createWWSFamilyNode()

static FontFamilyNode FontFamilyNode::createWWSFamilyNode ( const FontFamilyNode & child,
const FontFamilyNode & typographic,
QStringList existingWWSNames )
inlinestatic

Definition at line 146 of file KoFFWWSConverter.cpp.

146 {
147 FontFamilyNode wwsFamily;
148 if (child.type != KoSvgText::OpenTypeFontType) {
149 if (child.fontStyle.toLower() == "regular") {
150 wwsFamily.fontFamily = child.fontFamily;
151 } else {
152 wwsFamily.fontFamily = child.fontFamily + " " + child.fontStyle;
153 }
154 wwsFamily.fontStyle = child.fontStyle;
155 } else {
156 wwsFamily.fontFamily = typographic.fontFamily;
157 if (existingWWSNames.contains(typographic.fontFamily)) {
158 wwsFamily.fontFamily = child.fontFamily;
159 if (existingWWSNames.contains(child.fontFamily)) {
160 wwsFamily.fontFamily = child.fontFamily + " " + child.fontStyle;
161 }
162 }
163 }
166 wwsFamily.isVariable = child.isVariable;
167 wwsFamily.colorBitMap = child.colorBitMap;
168 wwsFamily.colorSVG = child.colorSVG;
169 wwsFamily.colorClrV0 = child.colorClrV0;
170 wwsFamily.colorClrV1 = child.colorClrV1;
171 wwsFamily.type = child.type;
172 return wwsFamily;
173 }
@ OpenTypeFontType
Definition KoSvgText.h:810
QHash< QLocale, QString > localizedTypographicStyle
KoSvgText::FontFormatType type
QHash< QLocale, QString > localizedFontFamilies
Last time the file was modified.

References colorBitMap, colorClrV0, colorClrV1, colorSVG, fontFamily, fontStyle, isVariable, localizedFontFamilies, localizedTypographicStyle, KoSvgText::OpenTypeFontType, and type.

◆ debugInfo()

QStringList FontFamilyNode::debugInfo ( ) const

Definition at line 189 of file KoFFWWSConverter.cpp.

190{
191 const QString style = isItalic? isOblique? "Oblique": "Italic": "Roman";
192 const QString fullname = localizedFullName.empty()? "": localizedFullName.values().first();
193 QStringList debug = {QString("\'%1\' \'%2\', style: %3, type:%4, full name: %5").arg(fontFamily, fontStyle, style).arg(type).arg(fullname)};
194 debug.append(QString("Index: %1, File: %2").arg(fileIndex).arg(fileName));
195 for (int i=0; i< axes.size(); i++) {
196 KoSvgText::FontFamilyAxis axis = axes.value(axes.keys().at(i));
197 debug.append(axis.debugInfo());
198 }
199 for (int i=0; i< styleInfo.size(); i++) {
200 debug.append(styleInfo.at(i).debugInfo());
201 }
202 if (sizeInfo.low >= 0 && sizeInfo.high >= 0) {
203 debug.append(sizeInfo.debugInfo());
204 }
205 if (!pixelSizes.isEmpty()) {
206 QStringList pix;
207 for (int i=0; i< pixelSizes.size(); i++) {
208 pix.append(QString::number(pixelSizes.keys().at(i)));
209 }
210 debug.append("PixelSizes: "+pix.join(", "));
211 } else if (!otherFiles.isEmpty()) {
212 debug.append("Other files: "+otherFiles.join(", "));
213 }
214 return debug;
215}
PyObject * debug(PyObject *, PyObject *args)
QHash< int, QStringList > pixelSizes
pixelSizes This is only used for bitmap fonts, when searching we try to return the files associated w...
QList< KoSvgText::FontFamilyStyleInfo > styleInfo
styleInfo This abstracts both font families that consist of many separate font-files and variable fon...
QHash< QLocale, QString > localizedFullName
QStringList otherFiles
Languages supported, according to fontconfig.
FontFamilySizeInfo sizeInfo
sizeInfo This is only really used to ensure that sizes get sorted into different WWS families,...
QString debugInfo() const
QString debugInfo() const
Some variable fonts have axes that are not really supposed to be shown to the user.
Definition KoSvgText.h:785

References axes, FontFamilySizeInfo::debugInfo(), KoSvgText::FontFamilyAxis::debugInfo(), fileIndex, fileName, fontFamily, fontStyle, FontFamilySizeInfo::high, isItalic, isOblique, localizedFullName, FontFamilySizeInfo::low, otherFiles, pixelSizes, sizeInfo, styleInfo, type, and KoSvgText::FontFamilyAxis::value.

◆ hasAnyColor()

bool FontFamilyNode::hasAnyColor ( ) const
inline

Definition at line 182 of file KoFFWWSConverter.cpp.

182 {
183 return (colorClrV0 || colorClrV1 || colorSVG || colorBitMap);
184 }

References colorBitMap, colorClrV0, colorClrV1, and colorSVG.

Member Data Documentation

◆ axes

QHash<QString, KoSvgText::FontFamilyAxis> FontFamilyNode::axes

axes While typical font-files within the same family are defined by having a single weight or width, variable fonts are defined by a range. The axis info abstracts both into a structure of a range between two values, which in turn means that if we take a family as a whole, we can combine all axes to find the total range of variations.

Definition at line 99 of file KoFFWWSConverter.cpp.

◆ colorBitMap

bool FontFamilyNode::colorBitMap = false

Definition at line 180 of file KoFFWWSConverter.cpp.

◆ colorClrV0

bool FontFamilyNode::colorClrV0 = false

Definition at line 177 of file KoFFWWSConverter.cpp.

◆ colorClrV1

bool FontFamilyNode::colorClrV1 = false

Definition at line 178 of file KoFFWWSConverter.cpp.

◆ colorSVG

bool FontFamilyNode::colorSVG = false

Definition at line 179 of file KoFFWWSConverter.cpp.

◆ fileIndex

int FontFamilyNode::fileIndex = 0

Definition at line 72 of file KoFFWWSConverter.cpp.

◆ fileName

QString FontFamilyNode::fileName

Definition at line 71 of file KoFFWWSConverter.cpp.

◆ fontFamily

QString FontFamilyNode::fontFamily

Definition at line 69 of file KoFFWWSConverter.cpp.

◆ fontStyle

QString FontFamilyNode::fontStyle

Definition at line 70 of file KoFFWWSConverter.cpp.

◆ isItalic

bool FontFamilyNode::isItalic = false

Definition at line 129 of file KoFFWWSConverter.cpp.

◆ isOblique

bool FontFamilyNode::isOblique = false

Definition at line 130 of file KoFFWWSConverter.cpp.

◆ isVariable

bool FontFamilyNode::isVariable = false

Definition at line 176 of file KoFFWWSConverter.cpp.

◆ lastModified

QDateTime FontFamilyNode::lastModified

Other files that seem related. These might be duplicate font files, or fonts where only the tech differs.

Definition at line 78 of file KoFFWWSConverter.cpp.

◆ localizedFontFamilies

QHash<QLocale, QString> FontFamilyNode::localizedFontFamilies

Last time the file was modified.

Definition at line 82 of file KoFFWWSConverter.cpp.

◆ localizedFontStyle

QHash<QLocale, QString> FontFamilyNode::localizedFontStyle

Definition at line 85 of file KoFFWWSConverter.cpp.

◆ localizedFullName

QHash<QLocale, QString> FontFamilyNode::localizedFullName

Definition at line 90 of file KoFFWWSConverter.cpp.

◆ localizedTypographicStyle

QHash<QLocale, QString> FontFamilyNode::localizedTypographicStyle

Definition at line 86 of file KoFFWWSConverter.cpp.

◆ localizedWWSStyle

QHash<QLocale, QString> FontFamilyNode::localizedWWSStyle

Definition at line 87 of file KoFFWWSConverter.cpp.

◆ otherFiles

QStringList FontFamilyNode::otherFiles

Languages supported, according to fontconfig.

Definition at line 77 of file KoFFWWSConverter.cpp.

◆ pixelSizes

QHash<int, QStringList> FontFamilyNode::pixelSizes

pixelSizes This is only used for bitmap fonts, when searching we try to return the files associated with the appropriate pixelsize first, so that usage wise it'll feel identical to using an opentype font with multiple bitmap strikes.

int: the pixel size. QStringList: list of files associated with that pixel-size.

Definition at line 118 of file KoFFWWSConverter.cpp.

◆ sampleStrings

QHash<QString, QString> FontFamilyNode::sampleStrings

Truetype collections have indices that need to be checked against.

Definition at line 74 of file KoFFWWSConverter.cpp.

◆ sizeInfo

FontFamilySizeInfo FontFamilyNode::sizeInfo

sizeInfo This is only really used to ensure that sizes get sorted into different WWS families, as otherwise they're unselectable. We could take them into account when searching, but the CSS-WG hasn't explicitly requested or provided any guidance therein.

Definition at line 125 of file KoFFWWSConverter.cpp.

◆ styleInfo

QList<KoSvgText::FontFamilyStyleInfo> FontFamilyNode::styleInfo

styleInfo This abstracts both font families that consist of many separate font-files and variable fonts with many separate instances, and the hybrid of the two (commonly, if there's an italic type, it is put into a separate variable font file from the regular type).

Definition at line 107 of file KoFFWWSConverter.cpp.

◆ supportedLanguages

QList<QLocale> FontFamilyNode::supportedLanguages

sample string used to generate the preview;

Definition at line 75 of file KoFFWWSConverter.cpp.

◆ type

Definition at line 175 of file KoFFWWSConverter.cpp.


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