Okular

fontinfo.cpp
1/*
2 SPDX-FileCopyrightText: 2007 Pino Toscano <pino@kde.org>
3
4 SPDX-License-Identifier: GPL-2.0-or-later
5*/
6
7// local includes
8#include "fontinfo.h"
9
10#include <QVariant>
11
12using namespace Okular;
13
14class Okular::FontInfoPrivate : public QSharedData
15{
16public:
17 FontInfoPrivate()
18 : type(FontInfo::Unknown)
19 , embedType(FontInfo::NotEmbedded)
20 , canBeExtracted(false)
21 {
22 }
23
24 bool operator==(const FontInfoPrivate &rhs) const
25 {
26 return name == rhs.name && substituteName == rhs.substituteName && type == rhs.type && embedType == rhs.embedType && file == rhs.file && canBeExtracted == rhs.canBeExtracted;
27 }
28
29 QString name;
30 QString substituteName;
32 FontInfo::EmbedType embedType;
33 bool canBeExtracted;
34 QString file;
35 QVariant nativeId;
36};
37
39 : d(new FontInfoPrivate)
40{
41}
42
44 : d(fi.d)
45{
46}
47
51
53{
54 return d->name;
55}
56
57void FontInfo::setName(const QString &name)
58{
59 d->name = name;
60}
61
63{
64 return d->substituteName;
65}
66
67void FontInfo::setSubstituteName(const QString &substituteName)
68{
69 d->substituteName = substituteName;
70}
71
73{
74 return d->type;
75}
76
78{
79 d->type = type;
80}
81
83{
84 return d->embedType;
85}
86
88{
89 d->embedType = type;
90}
91
93{
94 return d->file;
95}
96
97void FontInfo::setFile(const QString &file)
98{
99 d->file = file;
100}
101
103{
104 return d->canBeExtracted;
105}
106
107void FontInfo::setCanBeExtracted(bool extractable)
108{
109 d->canBeExtracted = extractable;
110}
111
113{
114 d->nativeId = id;
115}
116
118{
119 return d->nativeId;
120}
121
122bool FontInfo::operator==(const FontInfo &fi) const
123{
124 return *d == *fi.d;
125}
126
127bool FontInfo::operator!=(const FontInfo &fi) const
128{
129 return !operator==(fi);
130}
131
132FontInfo &FontInfo::operator=(const FontInfo &fi)
133{
134 if (this == &fi) {
135 return *this;
136 }
137
138 d = fi.d;
139 return *this;
140}
A small class that represents the information of a font.
Definition fontinfo.h:25
QString substituteName() const
Returns the substitute name for the font.
Definition fontinfo.cpp:62
FontInfo()
Construct a new empty font info.
Definition fontinfo.cpp:38
void setType(FontType type)
Change the type of the font.
Definition fontinfo.cpp:77
void setCanBeExtracted(bool extractable)
Sets if a font can be extracted or not.
Definition fontinfo.cpp:107
EmbedType
The possible kinds of embed.
Definition fontinfo.h:54
FontType type() const
Returns the type of the font.
Definition fontinfo.cpp:72
void setNativeId(const QVariant &id)
Sets the "native" id of the font info.
Definition fontinfo.cpp:112
FontType
The possible kinds of fonts.
Definition fontinfo.h:32
~FontInfo()
Destructor.
Definition fontinfo.cpp:48
bool canBeExtracted() const
In case of embedded fonts, returns if the font can be extracted into a QByteArray.
Definition fontinfo.cpp:102
void setName(const QString &name)
Sets a new name for the font.
Definition fontinfo.cpp:57
QString file() const
In case of not embedded font, returns the path of the font that represents this font.
Definition fontinfo.cpp:92
QVariant nativeId() const
Returns the "native" id of the font info.
Definition fontinfo.cpp:117
bool operator==(const FontInfo &fi) const
Comparison operator.
Definition fontinfo.cpp:122
EmbedType embedType() const
Returns the type of font embedding.
Definition fontinfo.cpp:82
QString name() const
Returns the name of the font.
Definition fontinfo.cpp:52
void setSubstituteName(const QString &substituteName)
Sets a new substitute name for the font.
Definition fontinfo.cpp:67
void setEmbedType(EmbedType type)
Sets the type of font embedding.
Definition fontinfo.cpp:87
global.h
Definition action.h:17
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Dec 21 2024 16:58:33 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.