File indexing completed on 2024-04-28 04:32:42

0001 /*
0002     SPDX-FileCopyrightText: 2007 Pino Toscano <pino@kde.org>
0003 
0004     SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 // local includes
0008 #include "fontinfo.h"
0009 
0010 #include <QVariant>
0011 
0012 using namespace Okular;
0013 
0014 class Okular::FontInfoPrivate : public QSharedData
0015 {
0016 public:
0017     FontInfoPrivate()
0018         : type(FontInfo::Unknown)
0019         , embedType(FontInfo::NotEmbedded)
0020         , canBeExtracted(false)
0021     {
0022     }
0023 
0024     bool operator==(const FontInfoPrivate &rhs) const
0025     {
0026         return name == rhs.name && substituteName == rhs.substituteName && type == rhs.type && embedType == rhs.embedType && file == rhs.file && canBeExtracted == rhs.canBeExtracted;
0027     }
0028 
0029     QString name;
0030     QString substituteName;
0031     FontInfo::FontType type;
0032     FontInfo::EmbedType embedType;
0033     bool canBeExtracted;
0034     QString file;
0035     QVariant nativeId;
0036 };
0037 
0038 FontInfo::FontInfo()
0039     : d(new FontInfoPrivate)
0040 {
0041 }
0042 
0043 FontInfo::FontInfo(const FontInfo &fi)
0044     : d(fi.d)
0045 {
0046 }
0047 
0048 FontInfo::~FontInfo()
0049 {
0050 }
0051 
0052 QString FontInfo::name() const
0053 {
0054     return d->name;
0055 }
0056 
0057 void FontInfo::setName(const QString &name)
0058 {
0059     d->name = name;
0060 }
0061 
0062 QString FontInfo::substituteName() const
0063 {
0064     return d->substituteName;
0065 }
0066 
0067 void FontInfo::setSubstituteName(const QString &substituteName)
0068 {
0069     d->substituteName = substituteName;
0070 }
0071 
0072 FontInfo::FontType FontInfo::type() const
0073 {
0074     return d->type;
0075 }
0076 
0077 void FontInfo::setType(FontInfo::FontType type)
0078 {
0079     d->type = type;
0080 }
0081 
0082 FontInfo::EmbedType FontInfo::embedType() const
0083 {
0084     return d->embedType;
0085 }
0086 
0087 void FontInfo::setEmbedType(FontInfo::EmbedType type)
0088 {
0089     d->embedType = type;
0090 }
0091 
0092 QString FontInfo::file() const
0093 {
0094     return d->file;
0095 }
0096 
0097 void FontInfo::setFile(const QString &file)
0098 {
0099     d->file = file;
0100 }
0101 
0102 bool FontInfo::canBeExtracted() const
0103 {
0104     return d->canBeExtracted;
0105 }
0106 
0107 void FontInfo::setCanBeExtracted(bool extractable)
0108 {
0109     d->canBeExtracted = extractable;
0110 }
0111 
0112 void FontInfo::setNativeId(const QVariant &id)
0113 {
0114     d->nativeId = id;
0115 }
0116 
0117 QVariant FontInfo::nativeId() const
0118 {
0119     return d->nativeId;
0120 }
0121 
0122 bool FontInfo::operator==(const FontInfo &fi) const
0123 {
0124     return *d == *fi.d;
0125 }
0126 
0127 bool FontInfo::operator!=(const FontInfo &fi) const
0128 {
0129     return !operator==(fi);
0130 }
0131 
0132 FontInfo &FontInfo::operator=(const FontInfo &fi)
0133 {
0134     if (this == &fi) {
0135         return *this;
0136     }
0137 
0138     d = fi.d;
0139     return *this;
0140 }