|
Krita Source Code Documentation
|
The KoFFWWSConverter class This class takes fontconfig patterns and tries to sort them into a hierarchy of typographic/wws/font files font families, as well as retrieving all sorts of information to display in the GUI. More...
#include <KoFFWWSConverter.h>
Classes | |
| struct | FontFileEntry |
| struct | Private |
Public Member Functions | |
| bool | addFontFromFile (const QString &filename, const int index, FT_LibrarySP freeTypeLibrary) |
| bool | addFontFromPattern (const FcPattern *pattern, FT_LibrarySP freeTypeLibrary) |
| Add a font from a fontconfig pattern. | |
| void | addGenericFamily (const QString &name) |
| This adds a CSS generic family. Call this before sortIntoWWSFamilies. | |
| void | addSupportedLanguagesByFile (const QString &filename, const int index, const QList< QLocale > &supportedLanguages, FcCharSet *set) |
| QVector< FontFileEntry > | candidatesForCssValues (const KoCSSFontInfo info, quint32 xRes=72, quint32 yRes=72) const |
| candidatesForCssValues Search the nodes for the most appropriate font for the given css values. We want to give these preferential treatment to whatever fontconfig matches for us. | |
| QList< KoFontFamilyWWSRepresentation > | collectFamilies () const |
| Collects all WWSFamilies (that is, CSS compatible groupings of font files) and return them. | |
| void | debugInfo () const |
| Print out the font family hierarchy into the debug output. | |
| KoFFWWSConverter () | |
| std::optional< KoFontFamilyWWSRepresentation > | representationByFamilyName (const QString &familyName) const |
| Gets a single WWSFamily representation for a given CSS Family Name, used by KoFontStorage. | |
| void | sortIntoWWSFamilies () |
| Sort any straggling fonts into WWSFamilies. | |
| std::optional< QString > | wwsNameByFamilyName (const QString familyName) const |
| Used to find the closest corresponding resource when the family name doesn't match. | |
| ~KoFFWWSConverter () | |
Private Attributes | |
| QScopedPointer< Private > | d |
The KoFFWWSConverter class This class takes fontconfig patterns and tries to sort them into a hierarchy of typographic/wws/font files font families, as well as retrieving all sorts of information to display in the GUI.
This is necessary because by default FontConfig patterns don't differentiate between fonts family names, which means that some fonts are not selectable by CSS values alone.
Definition at line 57 of file KoFFWWSConverter.h.
| KoFFWWSConverter::KoFFWWSConverter | ( | ) |
Definition at line 259 of file KoFFWWSConverter.cpp.
| KoFFWWSConverter::~KoFFWWSConverter | ( | ) |
Definition at line 265 of file KoFFWWSConverter.cpp.
| bool KoFFWWSConverter::addFontFromFile | ( | const QString & | filename, |
| const int | index, | ||
| FT_LibrarySP | freeTypeLibrary ) |
Add a font from a filename and index. This will use freetype and harfbuzz to figure out the family name(s), styles and other font features.
< twip is 'Twenty-in-point';
Definition at line 341 of file KoFFWWSConverter.cpp.
References FontFamilyNode::axes, KoSvgText::FontFamilyAxis::axisHidden, KoSvgText::BDFFontType, FontFamilyNode::colorBitMap, FontFamilyNode::colorClrV0, FontFamilyNode::colorSVG, d, KisLibraryResourcePointer< T, P >::data(), FontFamilySizeInfo::designSize, FontFamilyNode::fileIndex, FontFamilyNode::fileName, FontFamilyNode::fontFamily, FontFamilyNode::fontStyle, FontFamilySizeInfo::high, KoSvgText::FontFamilyStyleInfo::instanceCoords, FontFamilyNode::isItalic, FontFamilyNode::isOblique, FontFamilySizeInfo::isSet, FontFamilyNode::isVariable, FontFamilyNode::lastModified, length(), FontFamilyNode::localizedFontFamilies, FontFamilyNode::localizedFontStyle, FontFamilyNode::localizedFullName, FontFamilySizeInfo::localizedLabels, FontFamilyNode::localizedTypographicStyle, FontFamilyNode::localizedWWSStyle, FontFamilySizeInfo::low, KoSvgText::FontFamilyAxis::max, KoSvgText::FontFamilyAxis::min, KoSvgText::OpenTypeFontType, OS2_OBLIQUE, OS2_REGULAR, OS2_WWS, FontFamilySizeInfo::os2table, FontFamilyNode::pixelSizes, KisLibraryResourcePointer< T, P >::reset(), FontFamilyNode::sizeInfo, FontFamilyNode::styleInfo, FontFamilySizeInfo::subFamilyID, KoSvgText::FontFamilyAxis::tag, FontFamilyNode::type, KoSvgText::Type1FontType, KoSvgText::FontFamilyAxis::value, KoSvgText::FontFamilyAxis::variableAxis, WEIGHT_TAG, KoSvgText::FontFamilyAxis::weightAxis(), WIDTH_TAG, and KoSvgText::FontFamilyAxis::widthAxis().
| bool KoFFWWSConverter::addFontFromPattern | ( | const FcPattern * | pattern, |
| FT_LibrarySP | freeTypeLibrary ) |
Add a font from a fontconfig pattern.
Definition at line 283 of file KoFFWWSConverter.cpp.
References addFontFromFile(), addSupportedLanguagesByFile(), and KisLibraryResourcePointer< T, P >::data().
| void KoFFWWSConverter::addGenericFamily | ( | const QString & | name | ) |
This adds a CSS generic family. Call this before sortIntoWWSFamilies.
Definition at line 847 of file KoFFWWSConverter.cpp.
References FontFamilyNode::axes, d, FontFamilyNode::fontFamily, FontFamilyNode::fontStyle, FontFamilyNode::localizedFontFamilies, FontFamilyNode::localizedFontStyle, KoSvgText::OpenTypeFontType, KoWritingSystemUtils::samples(), FontFamilyNode::sampleStrings, KoWritingSystemUtils::sampleTagForQLocale(), FontFamilyNode::type, WEIGHT_TAG, and KoSvgText::FontFamilyAxis::weightAxis().
| void KoFFWWSConverter::addSupportedLanguagesByFile | ( | const QString & | filename, |
| const int | index, | ||
| const QList< QLocale > & | supportedLanguages, | ||
| FcCharSet * | set ) |
Definition at line 637 of file KoFFWWSConverter.cpp.
References d, and KoWritingSystemUtils::samples().
| QVector< KoFFWWSConverter::FontFileEntry > KoFFWWSConverter::candidatesForCssValues | ( | const KoCSSFontInfo | info, |
| quint32 | xRes = 72, | ||
| quint32 | yRes = 72 ) const |
candidatesForCssValues Search the nodes for the most appropriate font for the given css values. We want to give these preferential treatment to whatever fontconfig matches for us.
Definition at line 1081 of file KoFFWWSConverter.cpp.
References KoCSSFontInfo::autoSlant, d, KoCSSFontInfo::families, FontFamilyNode::fileIndex, FontFamilyNode::fileName, KoFFWWSConverter::FontFileEntry::fileName, findNodesByAxis(), KoFFWWSConverter::FontFileEntry::fontIndex, FontFamilyNode::isItalic, FontFamilyNode::isOblique, ITALIC_TAG, KoSvgText::OpenTypeFontType, FontFamilyNode::otherFiles, FontFamilyNode::pixelSizes, searchNodes(), KoCSSFontInfo::size, SLANT_TAG, KoCSSFontInfo::slantMode, KoCSSFontInfo::slantValue, FontFamilyNode::type, KoCSSFontInfo::weight, WEIGHT_TAG, KoCSSFontInfo::width, and WIDTH_TAG.
| QList< KoFontFamilyWWSRepresentation > KoFFWWSConverter::collectFamilies | ( | ) | const |
Collects all WWSFamilies (that is, CSS compatible groupings of font files) and return them.
Definition at line 945 of file KoFFWWSConverter.cpp.
References createRepresentation(), and d.
| void KoFFWWSConverter::debugInfo | ( | ) | const |
Print out the font family hierarchy into the debug output.
Definition at line 1213 of file KoFFWWSConverter.cpp.
References d, debugInfo(), KisForestDetail::Enter, KisForestDetail::Leave, and KisForestDetail::size().
| std::optional< KoFontFamilyWWSRepresentation > KoFFWWSConverter::representationByFamilyName | ( | const QString & | familyName | ) | const |
Gets a single WWSFamily representation for a given CSS Family Name, used by KoFontStorage.
Definition at line 998 of file KoFFWWSConverter.cpp.
References createRepresentation(), and d.
| void KoFFWWSConverter::sortIntoWWSFamilies | ( | ) |
Sort any straggling fonts into WWSFamilies.
Definition at line 666 of file KoFFWWSConverter.cpp.
References KisForestDetail::Forest< T >::childBegin(), KisForestDetail::Forest< T >::childEnd(), FontFamilyNode::createWWSFamilyNode(), d, KisForestDetail::Forest< T >::erase(), FontFamilyNode::fontFamily, KisForestDetail::Forest< T >::insert(), KIS_ASSERT_RECOVER_NOOP, KoSvgText::OpenTypeFontType, qFuzzyCompare(), KisForestDetail::size(), KoSvgText::Type1FontType, value(), WEIGHT_TAG, KoSvgText::FontFamilyAxis::weightAxis(), WIDTH_TAG, and KoSvgText::FontFamilyAxis::widthAxis().
| std::optional< QString > KoFFWWSConverter::wwsNameByFamilyName | ( | const QString | familyName | ) | const |
Used to find the closest corresponding resource when the family name doesn't match.
Definition at line 1014 of file KoFFWWSConverter.cpp.
References d, and searchNodes().
|
private |
Definition at line 108 of file KoFFWWSConverter.h.