File indexing completed on 2024-05-05 16:39:35
0001 /* 0002 SPDX-FileCopyrightText: 2007 Pino Toscano <pino@kde.org> 0003 0004 SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 0007 #ifndef _OKULAR_FONTINFO_H_ 0008 #define _OKULAR_FONTINFO_H_ 0009 0010 #include <QList> 0011 #include <QMetaType> 0012 #include <QSharedDataPointer> 0013 #include <QString> 0014 0015 #include "okularcore_export.h" 0016 0017 namespace Okular 0018 { 0019 class FontInfoPrivate; 0020 0021 /** 0022 * @short A small class that represents the information of a font. 0023 */ 0024 class OKULARCORE_EXPORT FontInfo 0025 { 0026 public: 0027 typedef QVector<FontInfo> List; 0028 0029 /** 0030 * The possible kinds of fonts. 0031 */ 0032 enum FontType { 0033 Unknown, 0034 Type1, 0035 Type1C, 0036 Type1COT, 0037 Type3, 0038 TrueType, 0039 TrueTypeOT, 0040 CIDType0, 0041 CIDType0C, 0042 CIDType0COT, 0043 CIDTrueType, 0044 CIDTrueTypeOT, 0045 TeXPK, ///< @since 0.10 (KDE 4.4) 0046 TeXVirtual, ///< @since 0.10 (KDE 4.4) 0047 TeXFontMetric, ///< @since 0.10 (KDE 4.4) 0048 TeXFreeTypeHandled ///< @since 0.10 (KDE 4.4) 0049 }; 0050 0051 /** 0052 * The possible kinds of embed. 0053 */ 0054 enum EmbedType { NotEmbedded, EmbeddedSubset, FullyEmbedded }; 0055 0056 /** 0057 * Construct a new empty font info. 0058 */ 0059 FontInfo(); 0060 /** 0061 * Copy constructor. 0062 */ 0063 FontInfo(const FontInfo &fi); 0064 /** 0065 * Destructor. 0066 */ 0067 ~FontInfo(); 0068 0069 /** 0070 * Returns the name of the font. 0071 */ 0072 QString name() const; 0073 /** 0074 * Sets a new name for the font. 0075 */ 0076 void setName(const QString &name); 0077 0078 /** 0079 * Returns the substitute name for the font. 0080 */ 0081 QString substituteName() const; 0082 0083 /** 0084 * Sets a new substitute name for the font. 0085 */ 0086 void setSubstituteName(const QString &substituteName); 0087 0088 /** 0089 * Returns the type of the font. 0090 */ 0091 FontType type() const; 0092 /** 0093 * Change the type of the font. 0094 */ 0095 void setType(FontType type); 0096 0097 /** 0098 * Returns the type of font embedding. 0099 */ 0100 EmbedType embedType() const; 0101 /** 0102 * Sets the type of font embedding. 0103 */ 0104 void setEmbedType(EmbedType type); 0105 0106 /** 0107 * In case of not embedded font, returns the path of the font that 0108 * represents this font. 0109 */ 0110 QString file() const; 0111 void setFile(const QString &file); 0112 0113 /** 0114 * In case of embedded fonts, returns if the font can be extracted into a QByteArray 0115 * 0116 * @since 0.8 (KDE 4.2) 0117 */ 0118 bool canBeExtracted() const; 0119 0120 /** 0121 * Sets if a font can be extracted or not. False by default 0122 */ 0123 void setCanBeExtracted(bool extractable); 0124 0125 /** 0126 * Sets the "native" @p id of the font info. 0127 * 0128 * This is for use of the Generator, that can optionally store an 0129 * handle (a pointer, an identifier, etc) of the "native" font 0130 * object, if any. 0131 * 0132 * @since 0.8 (KDE 4.2) 0133 */ 0134 void setNativeId(const QVariant &id); 0135 0136 /** 0137 * Returns the "native" id of the font info. 0138 * 0139 * @since 0.8 (KDE 4.2) 0140 */ 0141 QVariant nativeId() const; 0142 0143 FontInfo &operator=(const FontInfo &fi); 0144 0145 /** 0146 * Comparison operator. 0147 */ 0148 bool operator==(const FontInfo &fi) const; 0149 0150 bool operator!=(const FontInfo &fi) const; 0151 0152 private: 0153 /// @cond PRIVATE 0154 friend class FontInfoPrivate; 0155 /// @endcond 0156 QSharedDataPointer<FontInfoPrivate> d; 0157 }; 0158 0159 } 0160 0161 Q_DECLARE_METATYPE(Okular::FontInfo) 0162 0163 #endif