2007-07-07 20:35:01 +00:00
|
|
|
/***************************************************************************
|
|
|
|
* Copyright (C) 2007 by Pino Toscano <pino@kde.org> *
|
|
|
|
* *
|
|
|
|
* This program is free software; you can redistribute it and/or modify *
|
|
|
|
* it under the terms of the GNU General Public License as published by *
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or *
|
|
|
|
* (at your option) any later version. *
|
|
|
|
***************************************************************************/
|
|
|
|
|
|
|
|
#ifndef _OKULAR_FONTINFO_H_
|
|
|
|
#define _OKULAR_FONTINFO_H_
|
|
|
|
|
2018-08-31 09:23:45 +00:00
|
|
|
#include <QList>
|
|
|
|
#include <QMetaType>
|
|
|
|
#include <QSharedDataPointer>
|
|
|
|
#include <QString>
|
2007-07-07 20:35:01 +00:00
|
|
|
|
2014-10-27 21:35:06 +00:00
|
|
|
#include "okularcore_export.h"
|
2007-07-07 20:35:01 +00:00
|
|
|
|
|
|
|
namespace Okular {
|
|
|
|
|
|
|
|
class FontInfoPrivate;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @short A small class that represents the information of a font.
|
|
|
|
*/
|
2014-10-27 21:35:06 +00:00
|
|
|
class OKULARCORE_EXPORT FontInfo
|
2007-07-07 20:35:01 +00:00
|
|
|
{
|
|
|
|
public:
|
2015-08-04 12:21:25 +00:00
|
|
|
typedef QVector<FontInfo> List;
|
2007-07-07 20:35:01 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* The possible kinds of fonts.
|
|
|
|
*/
|
|
|
|
enum FontType
|
|
|
|
{
|
|
|
|
Unknown,
|
|
|
|
Type1,
|
|
|
|
Type1C,
|
|
|
|
Type1COT,
|
|
|
|
Type3,
|
|
|
|
TrueType,
|
|
|
|
TrueTypeOT,
|
|
|
|
CIDType0,
|
|
|
|
CIDType0C,
|
|
|
|
CIDType0COT,
|
|
|
|
CIDTrueType,
|
2009-11-21 00:50:13 +00:00
|
|
|
CIDTrueTypeOT,
|
|
|
|
TeXPK, ///< @since 0.10 (KDE 4.4)
|
|
|
|
TeXVirtual, ///< @since 0.10 (KDE 4.4)
|
|
|
|
TeXFontMetric, ///< @since 0.10 (KDE 4.4)
|
|
|
|
TeXFreeTypeHandled ///< @since 0.10 (KDE 4.4)
|
2007-07-07 20:35:01 +00:00
|
|
|
};
|
|
|
|
|
2007-07-08 16:07:37 +00:00
|
|
|
/**
|
|
|
|
* The possible kinds of embed.
|
|
|
|
*/
|
|
|
|
enum EmbedType
|
|
|
|
{
|
|
|
|
NotEmbedded,
|
2007-07-08 16:23:07 +00:00
|
|
|
EmbeddedSubset,
|
|
|
|
FullyEmbedded
|
2007-07-08 16:07:37 +00:00
|
|
|
};
|
|
|
|
|
2007-07-07 20:35:01 +00:00
|
|
|
/**
|
|
|
|
* Construct a new empty font info.
|
|
|
|
*/
|
|
|
|
FontInfo();
|
|
|
|
/**
|
|
|
|
* Copy constructor.
|
|
|
|
*/
|
|
|
|
FontInfo( const FontInfo &fi );
|
|
|
|
/**
|
|
|
|
* Destructor.
|
|
|
|
*/
|
|
|
|
~FontInfo();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the name of the font.
|
|
|
|
*/
|
|
|
|
QString name() const;
|
|
|
|
/**
|
|
|
|
* Sets a new name for the font.
|
|
|
|
*/
|
|
|
|
void setName( const QString& name );
|
|
|
|
|
2019-08-09 23:54:25 +00:00
|
|
|
/**
|
|
|
|
* Returns the substitute name for the font.
|
|
|
|
*/
|
|
|
|
QString substituteName() const;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Sets a new substitute name for the font.
|
|
|
|
*/
|
|
|
|
void setSubstituteName( const QString& substituteName );
|
|
|
|
|
2007-07-07 20:35:01 +00:00
|
|
|
/**
|
|
|
|
* Returns the type of the font.
|
|
|
|
*/
|
|
|
|
FontType type() const;
|
|
|
|
/**
|
|
|
|
* Change the type of the font.
|
|
|
|
*/
|
|
|
|
void setType( FontType type );
|
|
|
|
|
|
|
|
/**
|
2007-07-08 16:07:37 +00:00
|
|
|
* Returns the type of font embedding.
|
2007-07-07 20:35:01 +00:00
|
|
|
*/
|
2007-07-08 16:07:37 +00:00
|
|
|
EmbedType embedType() const;
|
2007-07-07 20:35:01 +00:00
|
|
|
/**
|
2007-07-08 16:07:37 +00:00
|
|
|
* Sets the type of font embedding.
|
2007-07-07 20:35:01 +00:00
|
|
|
*/
|
2007-07-08 16:07:37 +00:00
|
|
|
void setEmbedType( EmbedType type );
|
2007-07-07 20:35:01 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* In case of not embedded font, returns the path of the font that
|
|
|
|
* represents this font.
|
|
|
|
*/
|
|
|
|
QString file() const;
|
|
|
|
void setFile( const QString& file );
|
|
|
|
|
2008-08-01 20:26:22 +00:00
|
|
|
/**
|
|
|
|
* In case of embedded fonts, returns if the font can be extracted into a QByteArray
|
|
|
|
*
|
|
|
|
* @since 0.8 (KDE 4.2)
|
|
|
|
*/
|
|
|
|
bool canBeExtracted() const;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Sets if a font can be extracted or not. False by default
|
|
|
|
*/
|
|
|
|
void setCanBeExtracted( bool extractable );
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Sets the "native" @p id of the font info.
|
|
|
|
*
|
|
|
|
* This is for use of the Generator, that can optionally store an
|
|
|
|
* handle (a pointer, an identifier, etc) of the "native" font
|
|
|
|
* object, if any.
|
|
|
|
*
|
|
|
|
* @since 0.8 (KDE 4.2)
|
|
|
|
*/
|
|
|
|
void setNativeId( const QVariant &id );
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the "native" id of the font info.
|
|
|
|
*
|
|
|
|
* @since 0.8 (KDE 4.2)
|
|
|
|
*/
|
|
|
|
QVariant nativeId() const;
|
|
|
|
|
2007-07-07 20:35:01 +00:00
|
|
|
FontInfo& operator=( const FontInfo &fi );
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Comparison operator.
|
|
|
|
*/
|
|
|
|
bool operator==( const FontInfo &fi ) const;
|
|
|
|
|
|
|
|
bool operator!=( const FontInfo &fi ) const;
|
|
|
|
|
|
|
|
private:
|
2007-09-01 22:48:28 +00:00
|
|
|
/// @cond PRIVATE
|
2007-07-07 20:35:01 +00:00
|
|
|
friend class FontInfoPrivate;
|
2007-09-01 22:48:28 +00:00
|
|
|
/// @endcond
|
2007-07-07 20:35:01 +00:00
|
|
|
QSharedDataPointer<FontInfoPrivate> d;
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
Q_DECLARE_METATYPE(Okular::FontInfo)
|
|
|
|
|
|
|
|
#endif
|