Qt 4.8
Public Functions | Public Variables | List of all members
QFontEngineQPF1 Class Reference

#include <qfontengine_p.h>

Inheritance diagram for QFontEngineQPF1:
QFontEngine QObject

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)
 
virtual QFixed descent () const
 
virtual void draw (QPaintEngine *p, qreal x, qreal y, const QTextItemInt &si)
 
virtual QFixed leading () const
 
virtual QFixed lineThickness () const
 
virtual qreal maxCharWidth () const
 
virtual qreal minLeftBearing () const
 
virtual qreal minRightBearing () const
 
const char * name () const
 
 QFontEngineQPF1 (const QFontDef &, const QString &fn)
 
virtual void recalcAdvances (QGlyphLayout *, QTextEngine::ShaperFlags) const
 
virtual bool stringToCMap (const QChar *str, int len, QGlyphLayout *glyphs, int *nglyphs, QTextEngine::ShaperFlags flags) const
 
virtual Type type () const
 
virtual QFixed underlinePosition () const
 
 ~QFontEngineQPF1 ()
 
- 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
 
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 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...
 

Public Variables

QFontEngineQPF1Datad
 
- 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
 

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)
 
- 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 311 of file qfontengine_p.h.

Constructors and Destructors

◆ QFontEngineQPF1()

QFontEngineQPF1::QFontEngineQPF1 ( const QFontDef ,
const QString fn 
)

Definition at line 303 of file qfontengine_qws.cpp.

304 {
305  cache_cost = 1;
306 
307  int fd = QT_OPEN(QFile::encodeName(fn).constData(), O_RDONLY, 0);
308  if (fd == -1)
309  qFatal("Failed to open '%s'", QFile::encodeName(fn).constData());
310 
311  QT_STATBUF st;
312  if (QT_FSTAT(fd, &st) != 0)
313  qFatal("Failed to stat '%s'", QFile::encodeName(fn).constData());
314 
315  d = new QFontEngineQPF1Data;
316  d->mmapStart = 0;
317  d->mmapLength = st.st_size;
318 
319 #ifdef QT_USE_MMAP
320  d->used_mmap = true;
321  d->mmapStart = (uchar *)::mmap(0, st.st_size, // any address, whole file
322  PROT_READ, // read-only memory
323  MAP_FILE | MAP_PRIVATE, // swap-backed map from file
324  fd, 0); // from offset 0 of fd
325  if (d->mmapStart == (uchar *)MAP_FAILED)
326  d->mmapStart = 0;
327 #endif
328 
329  if (!d->mmapStart) {
330 #ifdef QT_USE_MMAP
331  d->used_mmap = false;
332 #endif
333  d->mmapStart = new uchar[d->mmapLength];
334  if (QT_READ(fd, d->mmapStart, d->mmapLength) != (qint64)d->mmapLength)
335  qFatal("Failed to read '%s'", QFile::encodeName(fn).constData());
336  }
337  QT_CLOSE(fd);
338 
339  if (d->mmapStart) {
340  uchar* data = d->mmapStart;
341 
342  memcpy(reinterpret_cast<char*>(&d->fm), data, sizeof(d->fm));
343  data += sizeof(d->fm);
344 
345  d->tree = new QPFGlyphTree(data);
348 #if 0
349  qDebug() << "font file" << fn
350  << "ascent" << d->fm.ascent << "descent" << d->fm.descent
351  << "leftbearing" << d->fm.leftbearing
352  << "rightbearing" << d->fm.rightbearing
353  << "maxwidth" << d->fm.maxwidth
354  << "leading" << d->fm.leading
355  << "flags" << d->fm.flags
356  << "underlinepos" << d->fm.underlinepos
357  << "underlinewidth" << d->fm.underlinewidth;
358 #endif
359  }
360 }
#define O_RDONLY
#define QT_READ
Definition: qcore_unix_p.h:280
Q_CORE_EXPORT void qDebug(const char *,...)
unsigned char uchar
Definition: qglobal.h:994
#define MAP_FAILED
QFontEngineQPF1Data * d
static const char * data(const QByteArray &arr)
__int64 qint64
Definition: qglobal.h:942
Q_CORE_EXPORT void qFatal(const char *,...)
#define FM_SMOOTH
#define QT_OPEN
Definition: qcore_unix_p.h:186
#define st(var, type, card)
if(void) toggleToolbarShown
static QByteArray encodeName(const QString &fileName)
By default, this function converts fileName to the local 8-bit encoding determined by the user&#39;s loca...
Definition: qfile.cpp:528
#define MAP_FILE
#define QT_CLOSE
Definition: qcore_unix_p.h:304

◆ ~QFontEngineQPF1()

QFontEngineQPF1::~QFontEngineQPF1 ( )

Definition at line 362 of file qfontengine_qws.cpp.

363 {
364  if (d->mmapStart) {
365 #if defined(QT_USE_MMAP)
366  if (d->used_mmap)
367  ::munmap(d->mmapStart, d->mmapLength);
368  else
369 #endif
370  delete [] d->mmapStart;
371  }
372  delete d->tree;
373  delete d;
374 }
QFontEngineQPF1Data * d

Functions

◆ addOutlineToPath()

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

Reimplemented from QFontEngine.

Definition at line 479 of file qfontengine_qws.cpp.

480 {
481  addBitmapFontToPath(x, y, glyphs, path, flags);
482 }
void addBitmapFontToPath(qreal x, qreal y, const QGlyphLayout &, QPainterPath *, QTextItem::RenderFlags)

◆ alphaMapForGlyph()

QImage QFontEngineQPF1::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 450 of file qfontengine_qws.cpp.

451 {
452  const QPFGlyph *glyph = d->tree->get(g);
453  if (!glyph)
454  return QImage();
455 
456  int mono = !(d->fm.flags & FM_SMOOTH);
457 
458  const uchar *bits = glyph->data;//((const uchar *) glyph);
459 
460  QImage image;
461  if (mono) {
462  image = QImage((glyph->metrics->width+7)&~7, glyph->metrics->height, QImage::Format_Mono);
463  image.setColor(0, qRgba(0, 0, 0, 0));
464  image.setColor(1, qRgba(0, 0, 0, 255));
465  } else {
466  image = QImage(glyph->metrics->width, glyph->metrics->height, QImage::Format_Indexed8);
467  for (int j=0; j<256; ++j)
468  image.setColor(j, qRgba(0, 0, 0, j));
469  }
470  for (int i=0; i<glyph->metrics->height; ++i) {
471  memcpy(image.scanLine(i), bits, glyph->metrics->linestep);
472  bits += glyph->metrics->linestep;
473  }
474  return image;
475 }
QPFGlyph * get(glyph_t g)
void setColor(int i, QRgb c)
Sets the color at the given index in the color table, to the given to colorValue. ...
Definition: qimage.cpp:1850
unsigned char uchar
Definition: qglobal.h:994
Q_GUI_EXPORT_INLINE QRgb qRgba(int r, int g, int b, int a)
Definition: qrgb.h:72
QFontEngineQPF1Data * d
The QImage class provides a hardware-independent image representation that allows direct access to th...
Definition: qimage.h:87
#define FM_SMOOTH
QPFGlyphMetrics * metrics
uchar * scanLine(int)
Returns a pointer to the pixel data at the scanline with index i.
Definition: qimage.cpp:1886

◆ ascent()

QFixed QFontEngineQPF1::ascent ( ) const
virtual

Implements QFontEngine.

Definition at line 506 of file qfontengine_qws.cpp.

507 {
508  return d->fm.ascent;
509 }
QFontEngineQPF1Data * d

◆ boundingBox() [1/2]

glyph_metrics_t QFontEngineQPF1::boundingBox ( const QGlyphLayout glyphs)
virtual

Implements QFontEngine.

Definition at line 484 of file qfontengine_qws.cpp.

485 {
486  if (glyphs.numGlyphs == 0)
487  return glyph_metrics_t();
488 
489  QFixed w = 0;
490  for (int i = 0; i < glyphs.numGlyphs; ++i)
491  w += glyphs.effectiveAdvance(i);
492  return glyph_metrics_t(0, -ascent(), w - lastRightBearing(glyphs), ascent()+descent()+1, w, 0);
493 }
virtual QFixed descent() const
QFixed lastRightBearing(const QGlyphLayout &glyphs, bool round=false)
virtual QFixed ascent() const
QFixed effectiveAdvance(int item) const

◆ boundingBox() [2/2]

glyph_metrics_t QFontEngineQPF1::boundingBox ( glyph_t  glyph)
virtual

Implements QFontEngine.

Definition at line 495 of file qfontengine_qws.cpp.

496 {
497  const QPFGlyph *g = d->tree->get(glyph);
498  if (!g)
499  return glyph_metrics_t();
500  Q_ASSERT(g);
502  g->metrics->width, g->metrics->height,
503  g->metrics->advance, 0);
504 }
QPFGlyph * get(glyph_t g)
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
QFontEngineQPF1Data * d
QPFGlyphMetrics * metrics

◆ canRender()

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

Implements QFontEngine.

Definition at line 531 of file qfontengine_qws.cpp.

532 {
533  for(int i = 0; i < len; i++)
534  if (!d->tree->inFont(str[i].unicode()))
535  return false;
536  return true;
537 }
bool inFont(glyph_t g) const
QFontEngineQPF1Data * d

◆ descent()

QFixed QFontEngineQPF1::descent ( ) const
virtual

Implements QFontEngine.

Definition at line 511 of file qfontengine_qws.cpp.

512 {
513  return d->fm.descent;
514 }
QFontEngineQPF1Data * d

◆ draw()

void QFontEngineQPF1::draw ( QPaintEngine p,
qreal  x,
qreal  y,
const QTextItemInt si 
)
virtual

Definition at line 417 of file qfontengine_qws.cpp.

418 {
419  QPaintEngineState *pState = p->state;
420  QRasterPaintEngine *paintEngine = static_cast<QRasterPaintEngine*>(p);
421 
422  QTransform matrix = pState->transform();
423  matrix.translate(_x, _y);
424  QFixed x = QFixed::fromReal(matrix.dx());
425  QFixed y = QFixed::fromReal(matrix.dy());
426 
429  getGlyphPositions(si.glyphs, matrix, si.flags, glyphs, positions);
430  if (glyphs.size() == 0)
431  return;
432 
433  int depth = (d->fm.flags & FM_SMOOTH) ? 8 : 1;
434  for(int i = 0; i < glyphs.size(); i++) {
435  const QPFGlyph *glyph = d->tree->get(glyphs[i]);
436  if (!glyph)
437  continue;
438 
439  int bpl = glyph->metrics->linestep;
440 
441  if(glyph->data)
442  paintEngine->alphaPenBlt(glyph->data, bpl, depth,
443  qRound(positions[i].x) + glyph->metrics->bearingx,
444  qRound(positions[i].y) - glyph->metrics->bearingy,
445  glyph->metrics->width,glyph->metrics->height);
446  }
447 }
QPFGlyph * get(glyph_t g)
qreal dy() const
Returns the vertical translation factor.
Definition: qtransform.h:277
QPaintEngineState * state
Definition: qpaintengine.h:239
RenderFlags flags
QTransform transform() const
Returns the matrix in the current paint engine state.
Definition: qpainter.cpp:9377
QTransform & translate(qreal dx, qreal dy)
Moves the coordinate system dx along the x axis and dy along the y axis, and returns a reference to t...
Definition: qtransform.cpp:417
static QFixed fromReal(qreal r)
Definition: qfixed_p.h:70
QGlyphLayout glyphs
QFontEngineQPF1Data * d
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)
#define FM_SMOOTH
void alphaPenBlt(const void *src, int bpl, int depth, int rx, int ry, int w, int h)
QPFGlyphMetrics * metrics
qreal dx() const
Returns the horizontal translation factor.
Definition: qtransform.h:273
The QPaintEngineState class provides information about the active paint engine&#39;s current state...
Definition: qpaintengine.h:289
The QRasterPaintEngine class enables hardware acceleration of painting operations in Qt for Embedded ...
Q_DECL_CONSTEXPR int qRound(qreal d)
Definition: qglobal.h:1203
int size() const
The QTransform class specifies 2D transformations of a coordinate system.
Definition: qtransform.h:65

◆ leading()

QFixed QFontEngineQPF1::leading ( ) const
virtual

Implements QFontEngine.

Definition at line 516 of file qfontengine_qws.cpp.

517 {
518  return d->fm.leading;
519 }
QFontEngineQPF1Data * d

◆ lineThickness()

QFixed QFontEngineQPF1::lineThickness ( ) const
virtual

Reimplemented from QFontEngine.

Definition at line 559 of file qfontengine_qws.cpp.

560 {
561  return d->fm.underlinewidth;
562 }
QFontEngineQPF1Data * d

◆ maxCharWidth()

qreal QFontEngineQPF1::maxCharWidth ( ) const
virtual

Implements QFontEngine.

Definition at line 521 of file qfontengine_qws.cpp.

522 {
523  return d->fm.maxwidth;
524 }
QFontEngineQPF1Data * d

◆ minLeftBearing()

qreal QFontEngineQPF1::minLeftBearing ( ) const
virtual

Reimplemented from QFontEngine.

Definition at line 544 of file qfontengine_qws.cpp.

545 {
546  return d->fm.leftbearing;
547 }
QFontEngineQPF1Data * d

◆ minRightBearing()

qreal QFontEngineQPF1::minRightBearing ( ) const
virtual

Reimplemented from QFontEngine.

Definition at line 549 of file qfontengine_qws.cpp.

550 {
551  return d->fm.rightbearing;
552 }
QFontEngineQPF1Data * d

◆ name()

const char* QFontEngineQPF1::name ( ) const
inlinevirtual

Implements QFontEngine.

Definition at line 338 of file qfontengine_p.h.

338 { return 0; }

◆ recalcAdvances()

void QFontEngineQPF1::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 404 of file qfontengine_qws.cpp.

405 {
406  for(int i = 0; i < glyphs->numGlyphs; i++) {
407  QPFGlyph *glyph = d->tree->get(glyphs->glyphs[i]);
408 
409  glyphs->advances_x[i] = glyph ? glyph->metrics->advance : 0;
410  glyphs->advances_y[i] = 0;
411 
412  if (!glyph)
413  glyphs->glyphs[i] = 0;
414  }
415 }
QPFGlyph * get(glyph_t g)
QFontEngineQPF1Data * d
QPFGlyphMetrics * metrics

◆ stringToCMap()

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

Implements QFontEngine.

Definition at line 377 of file qfontengine_qws.cpp.

378 {
379  if(*nglyphs < len) {
380  *nglyphs = len;
381  return false;
382  }
383  *nglyphs = 0;
384 
385  bool mirrored = flags & QTextEngine::RightToLeft;
386  for(int i = 0; i < len; i++) {
387  unsigned int uc = getChar(str, i, len);
388  if (mirrored)
389  uc = QChar::mirroredChar(uc);
390  glyphs->glyphs[*nglyphs] = uc < 0x10000 ? uc : 0;
391  ++*nglyphs;
392  }
393 
394  glyphs->numGlyphs = *nglyphs;
395 
396  if (flags & QTextEngine::GlyphIndicesOnly)
397  return true;
398 
399  recalcAdvances(glyphs, flags);
400 
401  return true;
402 }
HB_Glyph * glyphs
virtual void recalcAdvances(QGlyphLayout *, QTextEngine::ShaperFlags) const
QChar mirroredChar() const
Returns the mirrored character if this character is a mirrored character; otherwise returns the chara...
Definition: qchar.cpp:1016
static unsigned int getChar(const QChar *str, int &i, const int len)

◆ type()

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

Implements QFontEngine.

Definition at line 539 of file qfontengine_qws.cpp.

540 {
541  return QPF1;
542 }

◆ underlinePosition()

QFixed QFontEngineQPF1::underlinePosition ( ) const
virtual

Reimplemented from QFontEngine.

Definition at line 554 of file qfontengine_qws.cpp.

555 {
556  return d->fm.underlinepos;
557 }
QFontEngineQPF1Data * d

Properties

◆ d

QFontEngineQPF1Data* QFontEngineQPF1::d

Definition at line 342 of file qfontengine_p.h.


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