Krita Source Code Documentation
Loading...
Searching...
No Matches
KoFFWWSConverter.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2024 Wolthera van Hövell tot Westerflier <griffinvalley@gmail.com>
3 *
4 * SPDX-License-Identifier: GPL-2.0-or-later
5 */
6#ifndef KOFFWWSCONVERTER_H
7#define KOFFWWSCONVERTER_H
8
9#include <QHash>
11#include "KoCSSFontInfo.h"
12#include <kritaflake_export.h>
13
14#include <KoSvgText.h>
15#include <QLocale>
16#include <QDateTime>
17
18#include <optional>
19
25
26 QHash<QLocale, QString> localizedFontFamilyNames;
27 QHash<QLocale, QString> localizedTypographicFamily;
28 QHash<QLocale, QString> localizedTypographicStyles;
29
30 QDateTime lastModified;
31
32 QHash<QString, QString> sampleStrings;
34
35 QHash<QString, KoSvgText::FontFamilyAxis> axes;
37
39 bool isVariable = false;
40 bool colorClrV0 = false;
41 bool colorClrV1 = false;
42 bool colorSVG = false;
43 bool colorBitMap = false;
44};
45
46
57class KRITAFLAKE_EXPORT KoFFWWSConverter
58{
59public:
62
64 QString fileName;
66 };
67
69 bool addFontFromPattern(const FcPattern *pattern, FT_LibrarySP freeTypeLibrary);
70
74 bool addFontFromFile(const QString &filename, const int index, FT_LibrarySP freeTypeLibrary);
75
76 void addSupportedLanguagesByFile(const QString &filename, const int index, const QList<QLocale> &supportedLanguages, FcCharSet *set);
77
79 void sortIntoWWSFamilies();
80
82 void addGenericFamily(const QString &name);
83
85 QList<KoFontFamilyWWSRepresentation> collectFamilies() const;
86
88 std::optional<KoFontFamilyWWSRepresentation> representationByFamilyName(const QString &familyName) const;
89
91 std::optional<QString> wwsNameByFamilyName(const QString familyName) const;
92
99 QVector<FontFileEntry> candidatesForCssValues(const KoCSSFontInfo info,
100 quint32 xRes = 72,
101 quint32 yRes = 72) const;
102
104 void debugInfo() const;
105
106private:
107 struct Private;
108 QScopedPointer<Private> d;
109};
110
111#endif // KOFFWWSCONVERTER_H
The KoFFWWSConverter class This class takes fontconfig patterns and tries to sort them into a hierarc...
QScopedPointer< Private > d
@ UnknownFontType
Definition KoSvgText.h:807
The KoCSSFontInfo class Convenience struct to make it easier to use KoFontRegistry....
QList< KoSvgText::FontFamilyStyleInfo > styles
QHash< QString, KoSvgText::FontFamilyAxis > axes
KoSvgText::FontFormatType type
QDateTime lastModified
Value of the most recently modified font family. Used for updates.
QHash< QLocale, QString > localizedTypographicStyles
QList< QLocale > supportedLanguages
sample string used to generate the preview;
QHash< QString, QString > sampleStrings
QHash< QLocale, QString > localizedTypographicFamily
QHash< QLocale, QString > localizedFontFamilyNames