Qt 4.8
Public Functions | Public Variables | List of all members
glyph_metrics_t Struct Reference

#include <qtextengine_p.h>

Public Functions

 glyph_metrics_t ()
 
 glyph_metrics_t (QFixed _x, QFixed _y, QFixed _width, QFixed _height, QFixed _xoff, QFixed _yoff)
 
bool isValid () const
 
glyph_metrics_t transformed (const QTransform &xform) const
 

Public Variables

QFixed height
 
QFixed width
 
QFixed x
 
QFixed xoff
 
QFixed y
 
QFixed yoff
 

Detailed Description

Definition at line 94 of file qtextengine_p.h.

Constructors and Destructors

◆ glyph_metrics_t() [1/2]

glyph_metrics_t::glyph_metrics_t ( )
inline

Definition at line 96 of file qtextengine_p.h.

97  : x(100000), y(100000) {}

◆ glyph_metrics_t() [2/2]

glyph_metrics_t::glyph_metrics_t ( QFixed  _x,
QFixed  _y,
QFixed  _width,
QFixed  _height,
QFixed  _xoff,
QFixed  _yoff 
)
inline

Definition at line 98 of file qtextengine_p.h.

99  : x(_x),
100  y(_y),
101  width(_width),
102  height(_height),
103  xoff(_xoff),
104  yoff(_yoff)
105  {}

Functions

◆ isValid()

bool glyph_metrics_t::isValid ( ) const
inline

Definition at line 114 of file qtextengine_p.h.

Referenced by QFontEngine::getGlyphBearings(), and QFontEngine::lastRightBearing().

114 {return x != 100000 && y != 100000;}

◆ transformed()

glyph_metrics_t glyph_metrics_t::transformed ( const QTransform xform) const

Definition at line 3161 of file qtextengine.cpp.

Referenced by QFontEngineWin::boundingBox(), and QFontEngine::boundingBox().

3162 {
3163  if (matrix.type() < QTransform::TxTranslate)
3164  return *this;
3165 
3166  glyph_metrics_t m = *this;
3167 
3168  qreal w = width.toReal();
3169  qreal h = height.toReal();
3170  QTransform xform = qt_true_matrix(w, h, matrix);
3171 
3172  QRectF rect(0, 0, w, h);
3173  rect = xform.mapRect(rect);
3174  m.width = QFixed::fromReal(rect.width());
3175  m.height = QFixed::fromReal(rect.height());
3176 
3177  QLineF l = xform.map(QLineF(x.toReal(), y.toReal(), xoff.toReal(), yoff.toReal()));
3178 
3179  m.x = QFixed::fromReal(l.x1());
3180  m.y = QFixed::fromReal(l.y1());
3181 
3182  // The offset is relative to the baseline which is why we use dx/dy of the line
3183  m.xoff = QFixed::fromReal(l.dx());
3184  m.yoff = QFixed::fromReal(l.dy());
3185 
3186  return m;
3187 }
double qreal
Definition: qglobal.h:1193
static QFixed fromReal(qreal r)
Definition: qfixed_p.h:70
The QLineF class provides a two-dimensional vector using floating point precision.
Definition: qline.h:212
QRect mapRect(const QRect &) const
Creates and returns a QRect object that is a copy of the given rectangle, mapped into the coordinate ...
The QRectF class defines a rectangle in the plane using floating point precision. ...
Definition: qrect.h:511
QPoint map(const QPoint &p) const
Creates and returns a QPoint object that is a copy of the given point, mapped into the coordinate sys...
QTransform qt_true_matrix(qreal w, qreal h, QTransform x)
QFactoryLoader * l
qreal toReal() const
Definition: qfixed_p.h:77
The QTransform class specifies 2D transformations of a coordinate system.
Definition: qtransform.h:65

Properties

◆ height

QFixed glyph_metrics_t::height

◆ width

QFixed glyph_metrics_t::width

◆ x

QFixed glyph_metrics_t::x

◆ xoff

QFixed glyph_metrics_t::xoff

◆ y

QFixed glyph_metrics_t::y

◆ yoff

QFixed glyph_metrics_t::yoff

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