📄 qabstractfontengine_qws.cpp
字号:
/******************************************************************************** Copyright (C) 1992-2007 Trolltech ASA. All rights reserved.**** This file is part of the QtGui module of the Qt Toolkit.**** This file may be used under the terms of the GNU General Public** License version 2.0 as published by the Free Software Foundation** and appearing in the file LICENSE.GPL included in the packaging of** this file. Please review the following information to ensure GNU** General Public Licensing requirements will be met:** http://trolltech.com/products/qt/licenses/licensing/opensource/**** If you are unsure which license is appropriate for your use, please** review the following information:** http://trolltech.com/products/qt/licenses/licensing/licensingoverview** or contact the sales department at sales@trolltech.com.**** In addition, as a special exception, Trolltech gives you certain** additional rights. These rights are described in the Trolltech GPL** Exception version 1.0, which can be found at** http://www.trolltech.com/products/qt/gplexception/ and in the file** GPL_EXCEPTION.txt in this package.**** In addition, as a special exception, Trolltech, as the sole copyright** holder for Qt Designer, grants users of the Qt/Eclipse Integration** plug-in the right for the Qt/Eclipse Integration to link to** functionality provided by Qt Designer and its related libraries.**** Trolltech reserves all rights not expressly granted herein.**** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.******************************************************************************/#include "qabstractfontengine_qws.h"#include "qabstractfontengine_p.h"#include <private/qtextengine_p.h>#include <private/qpaintengine_raster_p.h>class QFontEngineInfoPrivate{public: inline QFontEngineInfoPrivate() : pixelSize(0), weight(QFont::Normal), style(QFont::StyleNormal) {} QString family; qreal pixelSize; int weight; QFont::Style style; QList<QFontDatabase::WritingSystem> writingSystems;};/*! \class QFontEngineInfo \preliminary \brief The QFontEngineInfo class describes a specific font provided by a font engine plugin. \since 4.3 \ingroup qws \tableofcontents QFontEngineInfo is used to describe a request of a font to a font engine plugin as well as to describe the actual fonts a plugin provides. \sa QAbstractFontEngine, QFontEnginePlugin*//*! Constructs a new empty QFontEngineInfo.*/QFontEngineInfo::QFontEngineInfo(){ d = new QFontEngineInfoPrivate;}/*! Constructs a new QFontEngineInfo with the specified \a family. The resulting object represents a freely scalable font with normal weight and style.*/QFontEngineInfo::QFontEngineInfo(const QString &family){ d = new QFontEngineInfoPrivate; d->family = family;}/*! Creates a new font engine info object with the same attributes as \a other.*/QFontEngineInfo::QFontEngineInfo(const QFontEngineInfo &other) : d(new QFontEngineInfoPrivate(*other.d)){}/*! Assigns \a other to this font engine info object, and returns a reference to this.*/QFontEngineInfo &QFontEngineInfo::operator=(const QFontEngineInfo &other){ *d = *other.d; return *this;}/*! Destroys this QFontEngineInfo object.*/QFontEngineInfo::~QFontEngineInfo(){ delete d;}/*! \property QFontEngineInfo::family the family name of the font*/void QFontEngineInfo::setFamily(const QString &family){ d->family = family;}QString QFontEngineInfo::family() const{ return d->family;}/*! \property QFontEngineInfo::pixelSize the pixel size of the font A pixel size of 0 represents a freely scalable font.*/void QFontEngineInfo::setPixelSize(qreal size){ d->pixelSize = size;}qreal QFontEngineInfo::pixelSize() const{ return d->pixelSize;}/*! \property QFontEngineInfo::weight the weight of the font The value should be from the \l{QFont::Weight} enumeration.*/void QFontEngineInfo::setWeight(int weight){ d->weight = weight;}int QFontEngineInfo::weight() const{ return d->weight;}/*! \property QFontEngineInfo::style the style of the font*/void QFontEngineInfo::setStyle(QFont::Style style){ d->style = style;}QFont::Style QFontEngineInfo::style() const{ return d->style;}/*! \property QFontEngineInfo::writingSystems the writing systems supported by the font An empty list means that any writing system is supported.*/QList<QFontDatabase::WritingSystem> QFontEngineInfo::writingSystems() const{ return d->writingSystems;}void QFontEngineInfo::setWritingSystems(const QList<QFontDatabase::WritingSystem> &writingSystems){ d->writingSystems = writingSystems;}class QFontEnginePluginPrivate : public QObjectPrivate{ Q_DECLARE_PUBLIC(QFontEnginePlugin) QString foundry;};/*! \class QFontEnginePlugin \preliminary \brief The QFontEnginePlugin class is the base class for font engine factory plugins in Qtopia Core. \since 4.3 \ingroup qws \tableofcontents QFontEnginePlugin is provided by font engine plugins to create instances of subclasses of QAbstractFontEngine. The following functions need to be implemented: create() and availableFontEngines(). \sa QAbstractFontEngine, QFontEngineInfo*//*! Creates a font engine plugin that creates font engines with the specified \a foundry and \a parent.*/QFontEnginePlugin::QFontEnginePlugin(const QString &foundry, QObject *parent) : QObject(*new QFontEnginePluginPrivate, parent){ Q_D(QFontEnginePlugin); d->foundry = foundry;}/*! Destroys this font engine plugin.*/QFontEnginePlugin::~QFontEnginePlugin(){}/*! Returns a list of foundries the font engine plugin provides. The default implementation returns the foundry specified with the constructor.*/QStringList QFontEnginePlugin::keys() const{ Q_D(const QFontEnginePlugin); return QStringList(d->foundry);}/*! \fn QAbstractFontEngine *QFontEnginePlugin::create(const QFontEngineInfo &info) Implemented in subclasses to create a new font engine that provides a font that matches \a info.*//*! \fn QList<QFontEngineInfo> QFontEnginePlugin::availableFontEngines() const Implemented in subclasses to return a list of QFontEngineInfo objects that represents all font engines the plugin can create.*/class QAbstractFontEnginePrivate : public QObjectPrivate{ Q_DECLARE_PUBLIC(QAbstractFontEngine)public:};//The <classname> class is|provides|contains|specifies.../*! \class QAbstractFontEngine \preliminary \brief The QAbstractFontEngine class is the base class for font engine plugins in Qtopia Core. \since 4.3 \ingroup qws \tableofcontents QAbstractFontEngine is implemented by font engine plugins through QFontEnginePlugin. \sa QFontEnginePlugin, QFontEngineInfo*//*! \enum QAbstractFontEngine::Capability This enum describes the capabilities of a font engine. \value CanRenderGlyphs_Gray The font engine can render individual glyphs into 8 bpp images. \value CanRenderGlyphs_Mono The font engine can render individual glyphs into 1 bpp images. \value CanRenderGlyphs The font engine can render individual glyphs into images. \value CanOutlineGlyphs The font engine can convert glyphs to painter paths.*//*! \enum QAbstractFontEngine::FontProperty This enum describes the properties of a font provided by a font engine. \value Ascent The ascent of the font, specified as a 26.6 fixed point value. \value Descent The descent of the font, specified as a 26.6 fixed point value. \value Leading The leading of the font, specified as a 26.6 fixed point value. \value XHeight The 'x' height of the font, specified as a 26.6 fixed point value. \value AverageCharWidth The average character width of the font, specified as a 26.6 fixed point value. \value LineThickness The thickness of the underline and strikeout lines for the font, specified as a 26.6 fixed point value. \value UnderlinePosition The distance from the base line to the underline position for the font, specified as a 26.6 fixed point value. \value MaxCharWidth The width of the widest character in the font, specified as a 26.6 fixed point value. \value MinLeftBearing The minimum left bearing of the font, specified as a 26.6 fixed point value. \value MinRightBearing The maximum right bearing of the font, specified as a 26.6 fixed point value. \value GlyphCount The number of glyphs in the font, specified as an integer value. \value CacheGlyphsHint A boolean value specifying whether rendered glyphs should be cached by Qt. \value OutlineGlyphsHint A boolean value specifying whether the font engine prefers outline drawing over image rendering for uncached glyphs.*//*! \enum QAbstractFontEngine::TextShapingFlag This enum describes flags controlling conversion of characters to glyphs and their metrics. \value RightToLeft The text is used in a right-to-left context. \value ReturnDesignMetrics Return font design metrics instead of pixel metrics.*//*! \typedef QAbstractFontEngine::Fixed This type is \c int, interpreted as a 26.6 fixed point value.*//*! \class QAbstractFontEngine::GlyphMetrics \brief QAbstractFontEngine::GlyphMetrics defines the metrics of a single glyph. \preliminary \since 4.3*//*! \variable QAbstractFontEngine::GlyphMetrics::x The horizontal offset from the origin.*//*! \fn QAbstractFontEngine::GlyphMetrics::GlyphMetrics() Constructs an empty glyph metrics object with all values set to zero.*//*! \variable QAbstractFontEngine::GlyphMetrics::y The vertical offset from the origin (baseline).*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -