Qt 4.8
Public Functions | Properties | Friends | List of all members
QFontEngineBox Class Reference

#include <qfontengine_p.h>

Inheritance diagram for QFontEngineBox:
QFontEngine QObject QTestFontEngine

Public Functions

virtual void addOutlineToPath (qreal x, qreal y, const QGlyphLayout &glyphs, QPainterPath *path, QTextItem::RenderFlags flags)
 
virtual QImage alphaMapForGlyph (glyph_t)
 
virtual QFixed ascent () const
 
virtual glyph_metrics_t boundingBox (const QGlyphLayout &glyphs)
 
virtual glyph_metrics_t boundingBox (glyph_t glyph)
 
virtual bool canRender (const QChar *string, int len)
 
int cmap () const
 
virtual QFixed descent () const
 
virtual QFixed leading () const
 
virtual qreal maxCharWidth () const
 
virtual qreal minLeftBearing () const
 
virtual qreal minRightBearing () const
 
virtual const char * name () const
 
 QFontEngineBox (int size)
 
virtual void recalcAdvances (QGlyphLayout *, QTextEngine::ShaperFlags) const
 
int size () const
 
virtual bool stringToCMap (const QChar *str, int len, QGlyphLayout *glyphs, int *nglyphs, QTextEngine::ShaperFlags flags) const
 
virtual Type type () const
 
 ~QFontEngineBox ()
 
- Public Functions inherited from QFontEngine
void addBitmapFontToPath (qreal x, qreal y, const QGlyphLayout &, QPainterPath *, QTextItem::RenderFlags)
 
virtual void addGlyphsToPath (glyph_t *glyphs, QFixedPoint *positions, int nglyphs, QPainterPath *path, QTextItem::RenderFlags flags)
 
virtual glyph_metrics_t alphaMapBoundingBox (glyph_t glyph, QFixed, const QTransform &matrix, GlyphFormat)
 
virtual QImage alphaMapForGlyph (glyph_t glyph, QFixed subPixelPosition)
 
virtual QImage alphaMapForGlyph (glyph_t, const QTransform &t)
 
virtual QImage alphaMapForGlyph (glyph_t, QFixed subPixelPosition, const QTransform &t)
 
virtual QImage alphaRGBMapForGlyph (glyph_t, QFixed subPixelPosition, int margin, const QTransform &t)
 
virtual QFixed averageCharWidth () const
 
virtual glyph_metrics_t boundingBox (glyph_t glyph, const QTransform &matrix)
 
virtual QFontEnginecloneWithSize (qreal) const
 
virtual void doKerning (QGlyphLayout *, QTextEngine::ShaperFlags) const
 
virtual QFixed emSquareSize () const
 
virtual FaceId faceId () const
 
virtual void getGlyphBearings (glyph_t glyph, qreal *leftBearing=0, qreal *rightBearing=0)
 
void getGlyphPositions (const QGlyphLayout &glyphs, const QTransform &matrix, QTextItem::RenderFlags flags, QVarLengthArray< glyph_t > &glyphs_out, QVarLengthArray< QFixedPoint > &positions)
 
virtual HB_Error getPointInOutline (HB_Glyph glyph, int flags, hb_uint32 point, HB_Fixed *xpos, HB_Fixed *ypos, hb_uint32 *nPoints)
 
QByteArray getSfntTable (uint) const
 
virtual bool getSfntTableData (uint, uchar *, uint *) const
 
virtual void getUnscaledGlyph (glyph_t glyph, QPainterPath *path, glyph_metrics_t *metrics)
 
QFontEngineGlyphCacheglyphCache (void *key, QFontEngineGlyphCache::Type type, const QTransform &transform) const
 
virtual int glyphCount () const
 
HB_Face harfbuzzFace () const
 
HB_Font harfbuzzFont () const
 
virtual QFixed lineThickness () const
 
void loadKerningPairs (QFixed scalingFactor)
 
virtual Properties properties () const
 
 QFontEngine ()
 
virtual void removeGlyphFromCache (glyph_t)
 
void setGlyphCache (void *key, QFontEngineGlyphCache *data)
 
virtual bool supportsSubPixelPositions () const
 
virtual int synthesized () const
 
glyph_metrics_t tightBoundingBox (const QGlyphLayout &glyphs)
 
virtual QFixed underlinePosition () const
 
virtual QFixed xHeight () const
 
virtual ~QFontEngine ()
 
- Public Functions inherited from QObject
bool blockSignals (bool b)
 If block is true, signals emitted by this object are blocked (i.e., emitting a signal will not invoke anything connected to it). More...
 
const QObjectListchildren () const
 Returns a list of child objects. More...
 
bool connect (const QObject *sender, const char *signal, const char *member, Qt::ConnectionType type=Qt::AutoConnection) const
 
bool disconnect (const char *signal=0, const QObject *receiver=0, const char *member=0)
 
bool disconnect (const QObject *receiver, const char *member=0)
 
void dumpObjectInfo ()
 Dumps information about signal connections, etc. More...
 
void dumpObjectTree ()
 Dumps a tree of children to the debug output. More...
 
QList< QByteArraydynamicPropertyNames () const
 Returns the names of all properties that were dynamically added to the object using setProperty(). More...
 
virtual bool event (QEvent *)
 This virtual function receives events to an object and should return true if the event e was recognized and processed. More...
 
virtual bool eventFilter (QObject *, QEvent *)
 Filters events if this object has been installed as an event filter for the watched object. More...
 
template<typename T >
findChild (const QString &aName=QString()) const
 Returns the child of this object that can be cast into type T and that is called name, or 0 if there is no such object. More...
 
template<typename T >
QList< T > findChildren (const QString &aName=QString()) const
 Returns all children of this object with the given name that can be cast to type T, or an empty list if there are no such objects. More...
 
template<typename T >
QList< T > findChildren (const QRegExp &re) const
 
bool inherits (const char *classname) const
 Returns true if this object is an instance of a class that inherits className or a QObject subclass that inherits className; otherwise returns false. More...
 
void installEventFilter (QObject *)
 Installs an event filter filterObj on this object. More...
 
bool isWidgetType () const
 Returns true if the object is a widget; otherwise returns false. More...
 
void killTimer (int id)
 Kills the timer with timer identifier, id. More...
 
virtual const QMetaObjectmetaObject () const
 Returns a pointer to the meta-object of this object. More...
 
void moveToThread (QThread *thread)
 Changes the thread affinity for this object and its children. More...
 
QString objectName () const
 
QObjectparent () const
 Returns a pointer to the parent object. More...
 
QVariant property (const char *name) const
 Returns the value of the object's name property. More...
 
Q_INVOKABLE QObject (QObject *parent=0)
 Constructs an object with parent object parent. More...
 
void removeEventFilter (QObject *)
 Removes an event filter object obj from this object. More...
 
void setObjectName (const QString &name)
 
void setParent (QObject *)
 Makes the object a child of parent. More...
 
bool setProperty (const char *name, const QVariant &value)
 Sets the value of the object's name property to value. More...
 
void setUserData (uint id, QObjectUserData *data)
 
bool signalsBlocked () const
 Returns true if signals are blocked; otherwise returns false. More...
 
int startTimer (int interval)
 Starts a timer and returns a timer identifier, or returns zero if it could not start a timer. More...
 
QThreadthread () const
 Returns the thread in which the object lives. More...
 
QObjectUserDatauserData (uint id) const
 
virtual ~QObject ()
 Destroys the object, deleting all its child objects. More...
 

Properties

int _size
 

Friends

class QFontPrivate
 

Additional Inherited Members

- Public Types inherited from QFontEngine
enum  GlyphFormat {
  Format_None, Format_Render = Format_None, Format_Mono, Format_A8,
  Format_A32
}
 
enum  SynthesizedFlags { SynthesizedItalic = 0x1, SynthesizedBold = 0x2, SynthesizedStretch = 0x4 }
 
enum  Type {
  Box, Multi, XLFD, Win,
  Mac, Freetype, QPF1, QPF2,
  Proxy, S60FontEngine, DirectWrite, TestFontEngine = 0x1000
}
 
- Public Slots inherited from QObject
void deleteLater ()
 Schedules this object for deletion. More...
 
- Signals inherited from QObject
void destroyed (QObject *=0)
 This signal is emitted immediately before the object obj is destroyed, and can not be blocked. More...
 
- Static Public Functions inherited from QFontEngine
static QByteArray convertToPostscriptFontFamilyName (const QByteArray &fontFamily)
 
static const uchargetCMap (const uchar *table, uint tableSize, bool *isSymbolFont, int *cmapSize)
 
static quint32 getTrueTypeGlyphIndex (const uchar *cmap, uint unicode)
 
- Static Public Functions inherited from QObject
static bool connect (const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
 Creates a connection of the given type from the signal in the sender object to the method in the receiver object. More...
 
static bool connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type=Qt::AutoConnection)
 
static bool disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *member)
 Disconnects signal in object sender from method in object receiver. More...
 
static bool disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &member)
 
static uint registerUserData ()
 
static QString tr (const char *sourceText, const char *comment=0, int n=-1)
 
static QString trUtf8 (const char *sourceText, const char *comment=0, int n=-1)
 
- Public Variables inherited from QFontEngine
uint cache_cost
 
int cache_count
 
QFontDef fontDef
 
uint fsType: 16
 
int glyphFormat
 
HB_Face hbFace
 
HB_FontRec hbFont
 
QVector< KernPairkerning_pairs
 
QAtomicInt ref
 
bool symbol
 
- Static Public Variables inherited from QObject
static const QMetaObject staticMetaObject
 This variable stores the meta-object for the class. More...
 
- Protected Functions inherited from QFontEngine
QFixed lastRightBearing (const QGlyphLayout &glyphs, bool round=false)
 
- Protected Functions inherited from QObject
virtual void childEvent (QChildEvent *)
 This event handler can be reimplemented in a subclass to receive child events. More...
 
virtual void connectNotify (const char *signal)
 This virtual function is called when something has been connected to signal in this object. More...
 
virtual void customEvent (QEvent *)
 This event handler can be reimplemented in a subclass to receive custom events. More...
 
virtual void disconnectNotify (const char *signal)
 This virtual function is called when something has been disconnected from signal in this object. More...
 
 QObject (QObjectPrivate &dd, QObject *parent=0)
 
int receivers (const char *signal) const
 Returns the number of receivers connected to the signal. More...
 
QObjectsender () const
 Returns a pointer to the object that sent the signal, if called in a slot activated by a signal; otherwise it returns 0. More...
 
int senderSignalIndex () const
 
virtual void timerEvent (QTimerEvent *)
 This event handler can be reimplemented in a subclass to receive timer events for the object. More...
 
- Static Protected Functions inherited from QFontEngine
static const QVector< QRgb > & grayPalette ()
 
- Protected Variables inherited from QObject
QScopedPointer< QObjectDatad_ptr
 
- Static Protected Variables inherited from QObject
static const QMetaObject staticQtMetaObject
 

Detailed Description

Definition at line 349 of file qfontengine_p.h.

Constructors and Destructors

◆ QFontEngineBox()

QFontEngineBox::QFontEngineBox ( int  size)

Definition at line 1149 of file qfontengine.cpp.

1150  : _size(size)
1151 {
1152  cache_cost = sizeof(QFontEngineBox);
1153 }
QFontEngineBox(int size)
int size() const

◆ ~QFontEngineBox()

QFontEngineBox::~QFontEngineBox ( )

Definition at line 1155 of file qfontengine.cpp.

1156 {
1157 }

Functions

◆ addOutlineToPath()

void QFontEngineBox::addOutlineToPath ( qreal  x,
qreal  y,
const QGlyphLayout glyphs,
QPainterPath path,
QTextItem::RenderFlags  flags 
)
virtual

Reimplemented from QFontEngine.

Definition at line 1185 of file qfontengine.cpp.

1186 {
1187  if (!glyphs.numGlyphs)
1188  return;
1189 
1191  QVarLengthArray<glyph_t> positioned_glyphs;
1192  QTransform matrix = QTransform::fromTranslate(x, y - _size);
1193  getGlyphPositions(glyphs, matrix, flags, positioned_glyphs, positions);
1194 
1195  QSize s(_size - 3, _size - 3);
1196  for (int k = 0; k < positions.size(); k++)
1197  path->addRect(QRectF(positions[k].toPointF(), s));
1198 }
The QRectF class defines a rectangle in the plane using floating point precision. ...
Definition: qrect.h:511
static const QCssKnownValue positions[NumKnownPositionModes - 1]
Definition: qcssparser.cpp:329
void getGlyphPositions(const QGlyphLayout &glyphs, const QTransform &matrix, QTextItem::RenderFlags flags, QVarLengthArray< glyph_t > &glyphs_out, QVarLengthArray< QFixedPoint > &positions)
void addRect(const QRectF &rect)
Adds the given rectangle to this path as a closed subpath.
The QSize class defines the size of a two-dimensional object using integer point precision.
Definition: qsize.h:53
static QTransform fromTranslate(qreal dx, qreal dy)
Creates a matrix which corresponds to a translation of dx along the x axis and dy along the y axis...
Definition: qtransform.cpp:462
int size() const
The QTransform class specifies 2D transformations of a coordinate system.
Definition: qtransform.h:65

◆ alphaMapForGlyph()

QImage QFontEngineBox::alphaMapForGlyph ( glyph_t  glyph)
virtual

Create a qimage with the alpha values for the glyph. Returns an image indexed_8 with index values ranging from 0=fully transparent to 255=opaque

Reimplemented from QFontEngine.

Definition at line 1288 of file qfontengine.cpp.

1289 {
1291  QVector<QRgb> colors(256);
1292  for (int i=0; i<256; ++i)
1293  colors[i] = qRgba(0, 0, 0, i);
1294  image.setColorTable(colors);
1295  image.fill(0);
1296 
1297  // can't use qpainter for index8; so use setPixel to draw our rectangle.
1298  for (int i=2; i <= _size-3; ++i) {
1299  image.setPixel(i, 2, 255);
1300  image.setPixel(i, _size-3, 255);
1301  image.setPixel(2, i, 255);
1302  image.setPixel(_size-3, i, 255);
1303  }
1304  return image;
1305 }
Q_GUI_EXPORT_INLINE QRgb qRgba(int r, int g, int b, int a)
Definition: qrgb.h:72
The QImage class provides a hardware-independent image representation that allows direct access to th...
Definition: qimage.h:87

◆ ascent()

QFixed QFontEngineBox::ascent ( ) const
virtual

Implements QFontEngine.

Definition at line 1245 of file qfontengine.cpp.

1246 {
1247  return _size;
1248 }

◆ boundingBox() [1/2]

glyph_metrics_t QFontEngineBox::boundingBox ( const QGlyphLayout glyphs)
virtual

Implements QFontEngine.

Definition at line 1200 of file qfontengine.cpp.

1201 {
1202  glyph_metrics_t overall;
1203  overall.width = _size*glyphs.numGlyphs;
1204  overall.height = _size;
1205  overall.xoff = overall.width;
1206  return overall;
1207 }

◆ boundingBox() [2/2]

glyph_metrics_t QFontEngineBox::boundingBox ( glyph_t  glyph)
virtual

Implements QFontEngine.

Definition at line 1238 of file qfontengine.cpp.

1239 {
1240  return glyph_metrics_t(0, -_size, _size, _size, _size, 0);
1241 }

◆ canRender()

bool QFontEngineBox::canRender ( const QChar string,
int  len 
)
virtual

Implements QFontEngine.

Definition at line 1278 of file qfontengine.cpp.

Referenced by QFontEngineMulti::canRender().

1279 {
1280  return true;
1281 }

◆ cmap()

int QFontEngineBox::cmap ( ) const

Definition at line 1267 of file qfontengine.cpp.

1268 {
1269  return -1;
1270 }

◆ descent()

QFixed QFontEngineBox::descent ( ) const
virtual

Implements QFontEngine.

Definition at line 1250 of file qfontengine.cpp.

1251 {
1252  return 0;
1253 }

◆ leading()

QFixed QFontEngineBox::leading ( ) const
virtual

Implements QFontEngine.

Definition at line 1255 of file qfontengine.cpp.

1256 {
1257  QFixed l = _size * QFixed::fromReal(qreal(0.15));
1258  return l.ceil();
1259 }
double qreal
Definition: qglobal.h:1193
static QFixed fromReal(qreal r)
Definition: qfixed_p.h:70
QFactoryLoader * l
QFixed ceil() const
Definition: qfixed_p.h:82

◆ maxCharWidth()

qreal QFontEngineBox::maxCharWidth ( ) const
virtual

Implements QFontEngine.

Definition at line 1261 of file qfontengine.cpp.

1262 {
1263  return _size;
1264 }

◆ minLeftBearing()

virtual qreal QFontEngineBox::minLeftBearing ( ) const
inlinevirtual

Reimplemented from QFontEngine.

Definition at line 370 of file qfontengine_p.h.

370 { return 0; }

◆ minRightBearing()

virtual qreal QFontEngineBox::minRightBearing ( ) const
inlinevirtual

Reimplemented from QFontEngine.

Definition at line 371 of file qfontengine_p.h.

371 { return 0; }

◆ name()

const char * QFontEngineBox::name ( ) const
virtual

Implements QFontEngine.

Definition at line 1273 of file qfontengine.cpp.

1274 {
1275  return "null";
1276 }

◆ recalcAdvances()

void QFontEngineBox::recalcAdvances ( QGlyphLayout ,
QTextEngine::ShaperFlags   
) const
virtual

This is a callback from harfbuzz. The font engine uses the font-system in use to find out the advances of each glyph and set it on the layout.

Reimplemented from QFontEngine.

Definition at line 1177 of file qfontengine.cpp.

1178 {
1179  for (int i = 0; i < glyphs->numGlyphs; i++) {
1180  glyphs->advances_x[i] = _size;
1181  glyphs->advances_y[i] = 0;
1182  }
1183 }

◆ size()

int QFontEngineBox::size ( ) const
inline

Definition at line 382 of file qfontengine_p.h.

382 { return _size; }

◆ stringToCMap()

bool QFontEngineBox::stringToCMap ( const QChar str,
int  len,
QGlyphLayout glyphs,
int *  nglyphs,
QTextEngine::ShaperFlags  flags 
) const
virtual

Implements QFontEngine.

Definition at line 1159 of file qfontengine.cpp.

Referenced by QFontEngineMulti::canRender(), and QFontEngineMulti::stringToCMap().

1160 {
1161  if (*nglyphs < len) {
1162  *nglyphs = len;
1163  return false;
1164  }
1165 
1166  for (int i = 0; i < len; i++) {
1167  glyphs->glyphs[i] = 0;
1168  glyphs->advances_x[i] = _size;
1169  glyphs->advances_y[i] = 0;
1170  }
1171 
1172  *nglyphs = len;
1173  glyphs->numGlyphs = len;
1174  return true;
1175 }
QFixed * advances_y
QFixed * advances_x
HB_Glyph * glyphs

◆ type()

QFontEngine::Type QFontEngineBox::type ( ) const
virtual

Implements QFontEngine.

Reimplemented in QTestFontEngine.

Definition at line 1283 of file qfontengine.cpp.

1284 {
1285  return Box;
1286 }

Friends and Related Functions

◆ QFontPrivate

friend class QFontPrivate
friend

Definition at line 385 of file qfontengine_p.h.

Properties

◆ _size

int QFontEngineBox::_size
private

The documentation for this class was generated from the following files: