Krita Source Code Documentation
Loading...
Searching...
No Matches
KoFontRegistry.h
Go to the documentation of this file.
1
/*
2
* SPDX-FileCopyrightText: 2022 Wolthera van Hövell tot Westerflier <griffinvalley@gmail.com>
3
*
4
* SPDX-License-Identifier: GPL-2.0-or-later
5
*/
6
#ifndef KOFONTREGISTRY_H
7
#define KOFONTREGISTRY_H
8
9
#include <QObject>
10
#include <QScopedPointer>
11
#include <QVector>
12
13
#include <
KoFontLibraryResourceUtils.h
>
14
#include <
KoFFWWSConverter.h
>
15
16
#include "
KoCSSFontInfo.h
"
17
#include "kritaflake_export.h"
18
30
class
KRITAFLAKE_EXPORT
KoFontRegistry
:
public
QObject
31
{
32
Q_OBJECT
33
public
:
34
KoFontRegistry
(QObject *parent =
nullptr
);
35
~KoFontRegistry
();
36
37
static
KoFontRegistry
*
instance
();
38
49
std::vector<FT_FaceSP> facesForCSSValues(
QVector<int>
&lengths,
50
KoCSSFontInfo
info =
KoCSSFontInfo
(),
51
const
QString &text =
""
,
52
quint32 xRes = 72,
53
quint32 yRes = 72,
54
bool
disableFontMatching =
false
,
55
const
QString &language = QString());
56
67
bool
configureFaces(
const
std::vector<FT_FaceSP> &faces,
68
qreal size,
69
qreal fontSizeAdjust,
70
quint32 xRes,
71
quint32 yRes,
72
const
QMap<QString, qreal> &axisSettings);
73
78
QList<KoFontFamilyWWSRepresentation>
collectRepresentations()
const
;
79
87
std::optional<KoFontFamilyWWSRepresentation> representationByFamilyName(
const
QString &familyName)
const
;
88
89
// Get the closest font family resource name for a given font family name, used by the selectors.
90
std::optional<QString> wwsNameByFamilyName(
const
QString familyName)
const
;
91
98
static
QFont::Style slantMode(
FT_FaceSP
face);
99
100
KoSvgText::FontMetrics
fontMetricsForCSSValues(
KoCSSFontInfo
info =
KoCSSFontInfo
(),
101
const
bool
isHorizontal =
true
,
102
const
KoSvgText::TextRendering
rendering =
KoSvgText::RenderingAuto
,
103
const
QString &text =
""
,
104
quint32 xRes = 72,
105
quint32 yRes = 72,
106
bool
disableFontMatching =
false
,
107
const
QString &language = QString());
108
109
static
KoSvgText::FontMetrics
generateFontMetrics(
FT_FaceSP
face,
bool
isHorizontal =
true
, QString script = QString(),
const
KoSvgText::TextRendering
rendering =
KoSvgText::RenderingAuto
);
110
111
static
int32_t loadFlagsForFace(FT_Face face,
bool
isHorizontal =
true
, int32_t loadFlags = 0,
const
KoSvgText::TextRendering
rendering =
KoSvgText::RenderingAuto
);
112
113
// For PSD we only get the postscript name, and we'll need a bit
114
// more information to get a proper css representation.
115
KoCSSFontInfo
getCssDataForPostScriptName (
const
QString postScriptName,
116
QString *foundPostScriptName);
117
private
Q_SLOTS:
121
void
updateConfig
();
122
private
:
123
class
Private
;
124
125
friend
class
TestSvgText;
126
friend
class
SvgTextCursorTest;
127
135
bool
addFontFilePathToRegistry(
const
QString &path);
136
143
bool
addFontFileDirectoryToRegistry(
const
QString &path);
144
145
QScopedPointer<Private>
d
;
146
147
Q_DISABLE_COPY
(
KoFontRegistry
);
148
};
149
150
#endif
// KOFONTREGISTRY_H
KoCSSFontInfo.h
KoFFWWSConverter.h
KoFontLibraryResourceUtils.h
instance
PythonPluginManager * instance
Definition
PythonPluginManager.cpp:37
KoFontRegistry
The KoFontRegistry class A wrapper around a freetype library.
Definition
KoFontRegistry.cpp:55
KoFontRegistry::d
QScopedPointer< Private > d
Definition
KoFontRegistry.h:145
KoFontRegistry::Q_DISABLE_COPY
Q_DISABLE_COPY(KoFontRegistry)
KoFontRegistry::updateConfig
void updateConfig()
QList
Definition
KisQStringListFwd.h:16
KoSvgText::TextRendering
TextRendering
Definition
KoSvgText.h:314
KoSvgText::RenderingAuto
@ RenderingAuto
Definition
KoSvgText.h:315
Private
Definition
SvgTransformParser.cpp:20
KisLibraryResourcePointer
Definition
KoFontLibraryResourceUtils.h:46
KoCSSFontInfo
The KoCSSFontInfo class Convenience struct to make it easier to use KoFontRegistry....
Definition
KoCSSFontInfo.h:21
KoSvgText::FontMetrics
The FontMetrics class A class to keep track of a variety of font metrics. Note that values are in Fre...
Definition
KoSvgText.h:327
libs
flake
text
KoFontRegistry.h
Generated at
2025-11-04 02:30:02+01:00
from
Krita
branch
master
, commit
c9dde2e79561a8aea4a7e8d9ac99c98a7bac9e52