static const bool scriptdetection = true;
if (scriptdetection) {
qreal xoffset = 0.0;
- qreal yoffset = 0.0;
QUnicodeTables::Script inheritedscript = QUnicodeTables::Common;
for (int i = 0; i < text.size(); i++) {
int nglyphs = 1;
QGlyphLayoutArray<2> glyphs;
engine->stringToCMap(textchars, nglyphs, &glyphs, &nglyphs, shaperflags);
- engine->addOutlineToPath(point.x() + xoffset, point.y() + yoffset, glyphs, this);
+ engine->addOutlineToPath(point.x() + xoffset, point.y(), glyphs, this);
xoffset += glyphs.advances_x[0].toReal();
- yoffset += glyphs.advances_y[0].toReal();
if (nglyphs == 2) {
xoffset += glyphs.advances_x[1].toReal();
- yoffset += glyphs.advances_y[1].toReal();
}
Q_ASSERT(nglyphs < 3);
}
positions[current].y = ypos + glyphs.offsets[i].y;
glyphs_out[current] = glyphs.glyphs[i];
xpos += glyphs.advances_x[i] + QFixed::fromFixed(glyphs.justifications[i].space_18d6);
- ypos += glyphs.advances_y[i];
++current;
}
++i;
positions[current].y = QFixed::fromReal(gpos.y());
glyphs_out[current] = glyphs.glyphs[i];
xpos += glyphs.advances_x[i] + QFixed::fromFixed(glyphs.justifications[i].space_18d6);
- ypos += glyphs.advances_y[i];
++current;
}
++i;
for (int i = 0; i < len; i++) {
glyphs->glyphs[i] = 0;
glyphs->advances_x[i] = _size;
- glyphs->advances_y[i] = 0;
}
*nglyphs = len;
{
for (int i = 0; i < glyphs->numGlyphs; i++) {
glyphs->advances_x[i] = _size;
- glyphs->advances_y[i] = 0;
}
}
g.glyphs[i] = glyphs[i];
if (i < nGlyphs - 1) {
g.advances_x[i] = positions[i+1].x - positions[i].x;
- g.advances_y[i] = positions[i+1].y - positions[i].y;
} else {
g.advances_x[i] = QFixed::fromReal(maxCharWidth());
- g.advances_y[i] = 0;
}
}
glyph_metrics_t metrics = boundingBox(g.glyphs[i]);
if (metrics.width.value() == 0 || metrics.height.value() == 0) {
advanceX += g.advances_x[i];
- advanceY += g.advances_y[i];
continue;
}
path->closeSubpath();
advanceX += g.advances_x[i];
- advanceY += g.advances_y[i];
}
}
: QFixed::fromFixed(metric->horiadvance);
if (fontDef.styleStrategy & QFont::ForceIntegerMetrics)
glyphs->advances_x[i] = glyphs->advances_x[i].round();
- glyphs->advances_y[i] = 0;
}
}
// move the existing data
memmove(newLayout.attributes, oldLayout.attributes, numGlyphs * sizeof(HB_GlyphAttributes));
memmove(newLayout.justifications, oldLayout.justifications, numGlyphs * sizeof(QGlyphJustification));
- memmove(newLayout.advances_y, oldLayout.advances_y, numGlyphs * sizeof(QFixed));
memmove(newLayout.advances_x, oldLayout.advances_x, numGlyphs * sizeof(QFixed));
memmove(newLayout.glyphs, oldLayout.glyphs, numGlyphs * sizeof(HB_Glyph));
}
QFixedPoint *offsets; // 8 bytes per element
HB_Glyph *glyphs; // 4 bytes per element
QFixed *advances_x; // 4 bytes per element
- QFixed *advances_y; // 4 bytes per element
QGlyphJustification *justifications; // 4 bytes per element
HB_GlyphAttributes *attributes; // 2 bytes per element
offset += totalGlyphs * sizeof(HB_Glyph);
advances_x = reinterpret_cast<QFixed *>(address + offset);
offset += totalGlyphs * sizeof(QFixed);
- advances_y = reinterpret_cast<QFixed *>(address + offset);
- offset += totalGlyphs * sizeof(QFixed);
justifications = reinterpret_cast<QGlyphJustification *>(address + offset);
offset += totalGlyphs * sizeof(QGlyphJustification);
attributes = reinterpret_cast<HB_GlyphAttributes *>(address + offset);
QGlyphLayout copy = *this;
copy.glyphs += position;
copy.advances_x += position;
- copy.advances_y += position;
copy.offsets += position;
copy.justifications += position;
copy.attributes += position;
static inline int spaceNeededForGlyphLayout(int totalGlyphs) {
return totalGlyphs * (sizeof(HB_Glyph) + sizeof(HB_GlyphAttributes)
- + sizeof(QFixed) + sizeof(QFixed) + sizeof(QFixedPoint)
+ + sizeof(QFixed) + sizeof(QFixedPoint)
+ sizeof(QGlyphJustification));
}
memset(offsets + first, 0, num * sizeof(QFixedPoint));
memset(glyphs + first, 0, num * sizeof(HB_Glyph));
memset(advances_x + first, 0, num * sizeof(QFixed));
- memset(advances_y + first, 0, num * sizeof(QFixed));
memset(justifications + first, 0, num * sizeof(QGlyphJustification));
memset(attributes + first, 0, num * sizeof(HB_GlyphAttributes));
}
private:
void *buffer[(N * (sizeof(HB_Glyph) + sizeof(HB_GlyphAttributes)
- + sizeof(QFixed) + sizeof(QFixed) + sizeof(QFixedPoint)
+ + sizeof(QFixed) + sizeof(QFixedPoint)
+ sizeof(QGlyphJustification)))
/ QT_POINTER_SIZE + 1];
};