Replace HB types used in API with Qt analogs
hb_uint32 <-> quint32 HB_Glyph <-> glyph_t HB_Fixed <-> QFixed, HB_FixedPoint <-> QFixedPoint HB_GlyphAttributes <-> QGlyphAttributes Change-Id: I4338ec4ce9a9c20ea591606ab10e6ef4f19931b8 Reviewed-by: Lars Knoll <lars.knoll@digia.com>bb10
parent
b047f48612
commit
f69c9059d6
|
|
@ -74,11 +74,11 @@ QTextItemIntCopy::QTextItemIntCopy(const QTextItem &item)
|
|||
char *glyphLayoutData = new char[size];
|
||||
QGlyphLayout glyphs(glyphLayoutData, m_item.glyphs.numGlyphs);
|
||||
memcpy(glyphs.offsets, m_item.glyphs.offsets, m_item.glyphs.numGlyphs * sizeof(QFixedPoint));
|
||||
memcpy(glyphs.glyphs, m_item.glyphs.glyphs, m_item.glyphs.numGlyphs * sizeof(HB_Glyph));
|
||||
memcpy(glyphs.glyphs, m_item.glyphs.glyphs, m_item.glyphs.numGlyphs * sizeof(glyph_t));
|
||||
memcpy(glyphs.advances_x, m_item.glyphs.advances_x, m_item.glyphs.numGlyphs * sizeof(QFixed));
|
||||
memcpy(glyphs.advances_y, m_item.glyphs.advances_y, m_item.glyphs.numGlyphs * sizeof(QFixed));
|
||||
memcpy(glyphs.justifications, m_item.glyphs.justifications, m_item.glyphs.numGlyphs * sizeof(QGlyphJustification));
|
||||
memcpy(glyphs.attributes, m_item.glyphs.attributes, m_item.glyphs.numGlyphs * sizeof(HB_GlyphAttributes));
|
||||
memcpy(glyphs.attributes, m_item.glyphs.attributes, m_item.glyphs.numGlyphs * sizeof(QGlyphAttributes));
|
||||
m_item.glyphs = glyphs;
|
||||
|
||||
m_font = *m_item.f;
|
||||
|
|
|
|||
|
|
@ -5612,13 +5612,13 @@ void QPainterPrivate::drawGlyphs(const quint32 *glyphArray, QFixedPoint *positio
|
|||
|
||||
QVarLengthArray<QFixed, 128> advances(glyphCount);
|
||||
QVarLengthArray<QGlyphJustification, 128> glyphJustifications(glyphCount);
|
||||
QVarLengthArray<HB_GlyphAttributes, 128> glyphAttributes(glyphCount);
|
||||
memset(glyphAttributes.data(), 0, glyphAttributes.size() * sizeof(HB_GlyphAttributes));
|
||||
QVarLengthArray<QGlyphAttributes, 128> glyphAttributes(glyphCount);
|
||||
memset(glyphAttributes.data(), 0, glyphAttributes.size() * sizeof(QGlyphAttributes));
|
||||
memset(advances.data(), 0, advances.size() * sizeof(QFixed));
|
||||
memset(glyphJustifications.data(), 0, glyphJustifications.size() * sizeof(QGlyphJustification));
|
||||
|
||||
textItem.glyphs.numGlyphs = glyphCount;
|
||||
textItem.glyphs.glyphs = reinterpret_cast<HB_Glyph *>(const_cast<quint32 *>(glyphArray));
|
||||
textItem.glyphs.glyphs = const_cast<glyph_t *>(glyphArray);
|
||||
textItem.glyphs.offsets = positions;
|
||||
textItem.glyphs.advances_x = advances.data();
|
||||
textItem.glyphs.advances_y = advances.data();
|
||||
|
|
@ -5841,7 +5841,7 @@ void QPainter::drawText(const QPointF &p, const QString &str, int tf, int justif
|
|||
return;
|
||||
|
||||
if (tf & Qt::TextBypassShaping) {
|
||||
// Skip harfbuzz complex shaping, shape using glyph advances only
|
||||
// Skip complex shaping, shape using glyph advances only
|
||||
int len = str.length();
|
||||
int numGlyphs = len;
|
||||
QVarLengthGlyphLayoutArray glyphs(len);
|
||||
|
|
|
|||
|
|
@ -135,7 +135,7 @@ static HB_Fixed hb_getFontMetric(HB_Font font, HB_FontMetric metric)
|
|||
return 0;
|
||||
}
|
||||
|
||||
HB_Error QFontEngine::getPointInOutline(HB_Glyph glyph, int flags, hb_uint32 point, HB_Fixed *xpos, HB_Fixed *ypos, hb_uint32 *nPoints)
|
||||
int QFontEngine::getPointInOutline(glyph_t glyph, int flags, quint32 point, QFixed *xpos, QFixed *ypos, quint32 *nPoints)
|
||||
{
|
||||
Q_UNUSED(glyph)
|
||||
Q_UNUSED(flags)
|
||||
|
|
@ -149,7 +149,7 @@ HB_Error QFontEngine::getPointInOutline(HB_Glyph glyph, int flags, hb_uint32 poi
|
|||
static HB_Error hb_getPointInOutline(HB_Font font, HB_Glyph glyph, int flags, hb_uint32 point, HB_Fixed *xpos, HB_Fixed *ypos, hb_uint32 *nPoints)
|
||||
{
|
||||
QFontEngine *fe = (QFontEngine *)font->userData;
|
||||
return fe->getPointInOutline(glyph, flags, point, xpos, ypos, nPoints);
|
||||
return (HB_Error)fe->getPointInOutline(glyph, flags, point, (QFixed *)xpos, (QFixed *)ypos, (quint32 *)nPoints);
|
||||
}
|
||||
|
||||
static const HB_FontClass hb_fontClass = {
|
||||
|
|
@ -1206,7 +1206,7 @@ bool QFontEngineBox::stringToCMap(const QChar *, int len, QGlyphLayout *glyphs,
|
|||
return false;
|
||||
}
|
||||
|
||||
memset(glyphs->glyphs, 0, len * sizeof(HB_Glyph));
|
||||
memset(glyphs->glyphs, 0, len * sizeof(glyph_t));
|
||||
|
||||
*nglyphs = len;
|
||||
glyphs->numGlyphs = len;
|
||||
|
|
|
|||
|
|
@ -183,9 +183,9 @@ int QFreetypeFace::fsType() const
|
|||
return fsType;
|
||||
}
|
||||
|
||||
HB_Error QFreetypeFace::getPointInOutline(HB_Glyph glyph, int flags, hb_uint32 point, HB_Fixed *xpos, HB_Fixed *ypos, hb_uint32 *nPoints)
|
||||
int QFreetypeFace::getPointInOutline(glyph_t glyph, int flags, quint32 point, QFixed *xpos, QFixed *ypos, quint32 *nPoints)
|
||||
{
|
||||
if (HB_Error error = (HB_Error)FT_Load_Glyph(face, glyph, flags))
|
||||
if (int error = FT_Load_Glyph(face, glyph, flags))
|
||||
return error;
|
||||
|
||||
if (face->glyph->format != FT_GLYPH_FORMAT_OUTLINE)
|
||||
|
|
@ -198,8 +198,8 @@ HB_Error QFreetypeFace::getPointInOutline(HB_Glyph glyph, int flags, hb_uint32 p
|
|||
if (point > *nPoints)
|
||||
return HB_Err_Invalid_SubTable;
|
||||
|
||||
*xpos = face->glyph->outline.points[point].x;
|
||||
*ypos = face->glyph->outline.points[point].y;
|
||||
*xpos = QFixed::fromFixed(face->glyph->outline.points[point].x);
|
||||
*ypos = QFixed::fromFixed(face->glyph->outline.points[point].y);
|
||||
|
||||
return HB_Err_Ok;
|
||||
}
|
||||
|
|
@ -2029,13 +2029,13 @@ void QFontEngineFT::QGlyphSet::setGlyph(glyph_t index, QFixed subPixelPosition,
|
|||
}
|
||||
}
|
||||
|
||||
HB_Error QFontEngineFT::getPointInOutline(HB_Glyph glyph, int flags, hb_uint32 point, HB_Fixed *xpos, HB_Fixed *ypos, hb_uint32 *nPoints)
|
||||
int QFontEngineFT::getPointInOutline(glyph_t glyph, int flags, quint32 point, QFixed *xpos, QFixed *ypos, quint32 *nPoints)
|
||||
{
|
||||
lockFace();
|
||||
bool hsubpixel = true;
|
||||
int vfactor = 1;
|
||||
int load_flags = loadFlags(0, Format_A8, flags, hsubpixel, vfactor);
|
||||
HB_Error result = freetype->getPointInOutline(glyph, load_flags, point, xpos, ypos, nPoints);
|
||||
int result = freetype->getPointInOutline(glyph, load_flags, point, xpos, ypos, nPoints);
|
||||
unlockFace();
|
||||
return result;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -113,7 +113,7 @@ struct QFreetypeFace
|
|||
|
||||
int fsType() const;
|
||||
|
||||
HB_Error getPointInOutline(HB_Glyph glyph, int flags, hb_uint32 point, HB_Fixed *xpos, HB_Fixed *ypos, hb_uint32 *nPoints);
|
||||
int getPointInOutline(glyph_t glyph, int flags, quint32 point, QFixed *xpos, QFixed *ypos, quint32 *nPoints);
|
||||
|
||||
static void addGlyphToPath(FT_Face face, FT_GlyphSlot g, const QFixedPoint &point, QPainterPath *path, FT_Fixed x_scale, FT_Fixed y_scale);
|
||||
static void addBitmapToPath(FT_GlyphSlot slot, const QFixedPoint &point, QPainterPath *path, bool = false);
|
||||
|
|
@ -298,7 +298,7 @@ private:
|
|||
bool init(FaceId faceId, bool antialias, GlyphFormat format,
|
||||
QFreetypeFace *freetypeFace);
|
||||
|
||||
virtual HB_Error getPointInOutline(HB_Glyph glyph, int flags, hb_uint32 point, HB_Fixed *xpos, HB_Fixed *ypos, hb_uint32 *nPoints);
|
||||
virtual int getPointInOutline(glyph_t glyph, int flags, quint32 point, QFixed *xpos, QFixed *ypos, quint32 *nPoints);
|
||||
|
||||
|
||||
virtual void setDefaultHintStyle(HintStyle style);
|
||||
|
|
|
|||
|
|
@ -60,16 +60,12 @@
|
|||
#include "private/qtextengine_p.h"
|
||||
#include "private/qfont_p.h"
|
||||
|
||||
|
||||
#include "private/qharfbuzz_copy_p.h"
|
||||
|
||||
#include <private/qfontengineglyphcache_p.h>
|
||||
|
||||
struct glyph_metrics_t;
|
||||
typedef unsigned int glyph_t;
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class QChar;
|
||||
class QPainterPath;
|
||||
|
||||
struct QGlyphLayout;
|
||||
|
|
@ -257,7 +253,7 @@ public:
|
|||
HB_Face initializedHarfbuzzFace() const;
|
||||
bool supportsScript(QChar::Script script) const;
|
||||
|
||||
virtual HB_Error getPointInOutline(HB_Glyph glyph, int flags, hb_uint32 point, HB_Fixed *xpos, HB_Fixed *ypos, hb_uint32 *nPoints);
|
||||
virtual int getPointInOutline(glyph_t glyph, int flags, quint32 point, QFixed *xpos, QFixed *ypos, quint32 *nPoints);
|
||||
|
||||
void setGlyphCache(const void *key, QFontEngineGlyphCache *data);
|
||||
QFontEngineGlyphCache *glyphCache(const void *key, QFontEngineGlyphCache::Type type, const QTransform &transform) const;
|
||||
|
|
|
|||
|
|
@ -854,12 +854,12 @@ void QFontEngineQPF::doKerning(QGlyphLayout *g, QFontEngine::ShaperFlags flags)
|
|||
QFontEngine::doKerning(g, flags);
|
||||
}
|
||||
|
||||
HB_Error QFontEngineQPF::getPointInOutline(HB_Glyph glyph, int flags, hb_uint32 point, HB_Fixed *xpos, HB_Fixed *ypos, hb_uint32 *nPoints)
|
||||
int QFontEngineQPF::getPointInOutline(glyph_t glyph, int flags, quint32 point, QFixed *xpos, QFixed *ypos, quint32 *nPoints)
|
||||
{
|
||||
if (!freetype)
|
||||
return HB_Err_Not_Covered;
|
||||
lockFace();
|
||||
HB_Error result = freetype->getPointInOutline(glyph, flags, point, xpos, ypos, nPoints);
|
||||
int result = freetype->getPointInOutline(glyph, flags, point, xpos, ypos, nPoints);
|
||||
unlockFace();
|
||||
return result;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -208,7 +208,7 @@ public:
|
|||
FT_Face lockFace() const;
|
||||
void unlockFace() const;
|
||||
void doKerning(QGlyphLayout *g, ShaperFlags flags) const;
|
||||
virtual HB_Error getPointInOutline(HB_Glyph glyph, int flags, hb_uint32 point, HB_Fixed *xpos, HB_Fixed *ypos, hb_uint32 *nPoints);
|
||||
virtual int getPointInOutline(glyph_t glyph, int flags, quint32 point, QFixed *xpos, QFixed *ypos, quint32 *nPoints);
|
||||
virtual QFixed emSquareSize() const;
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -526,7 +526,7 @@ int QFontMetrics::width(const QString &text, int len, int flags) const
|
|||
return 0;
|
||||
|
||||
if (flags & Qt::TextBypassShaping) {
|
||||
// Skip harfbuzz complex shaping, only use advances
|
||||
// Skip complex shaping, only use advances
|
||||
int numGlyphs = len;
|
||||
QVarLengthGlyphLayoutArray glyphs(numGlyphs);
|
||||
QFontEngine *engine = d->engineForScript(QChar::Script_Common);
|
||||
|
|
|
|||
|
|
@ -535,7 +535,7 @@ bool QRawFont::advancesForGlyphIndexes(const quint32 *glyphIndexes, QPointF *adv
|
|||
return false;
|
||||
|
||||
QGlyphLayout glyphs;
|
||||
glyphs.glyphs = const_cast<HB_Glyph *>(glyphIndexes);
|
||||
glyphs.glyphs = const_cast<glyph_t *>(glyphIndexes);
|
||||
glyphs.numGlyphs = numGlyphs;
|
||||
QVarLengthArray<QFixed> advances_x(numGlyphs);
|
||||
QVarLengthArray<QFixed> advances_y(numGlyphs);
|
||||
|
|
|
|||
|
|
@ -61,6 +61,8 @@
|
|||
|
||||
#include "qfontengine_qpa_p.h"
|
||||
|
||||
#include <private/qharfbuzz_p.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
static const float smallCapsFraction = 0.7f;
|
||||
|
|
@ -836,13 +838,6 @@ void QTextEngine::bidiReorder(int numItems, const quint8 *levels, int *visualOrd
|
|||
#endif
|
||||
}
|
||||
|
||||
QT_BEGIN_INCLUDE_NAMESPACE
|
||||
|
||||
|
||||
#include <private/qharfbuzz_p.h>
|
||||
|
||||
QT_END_INCLUDE_NAMESPACE
|
||||
|
||||
// ask the font engine to find out which glyphs (as an index in the specific font) to use for the text in one item.
|
||||
static bool stringToGlyphs(HB_ShaperItem *item, QGlyphLayout *glyphs, QFontEngine *fontEngine)
|
||||
{
|
||||
|
|
@ -971,19 +966,21 @@ static inline bool hasCaseChange(const QScriptItem &si)
|
|||
static inline void moveGlyphData(const QGlyphLayout &destination, const QGlyphLayout &source, int num)
|
||||
{
|
||||
if (num > 0 && destination.glyphs != source.glyphs) {
|
||||
memmove(destination.glyphs, source.glyphs, num * sizeof(HB_Glyph));
|
||||
memmove(destination.attributes, source.attributes, num * sizeof(HB_GlyphAttributes));
|
||||
memmove(destination.advances_x, source.advances_x, num * sizeof(HB_Fixed));
|
||||
memmove(destination.offsets, source.offsets, num * sizeof(HB_FixedPoint));
|
||||
memmove(destination.glyphs, source.glyphs, num * sizeof(glyph_t));
|
||||
memmove(destination.attributes, source.attributes, num * sizeof(QGlyphAttributes));
|
||||
memmove(destination.advances_x, source.advances_x, num * sizeof(QFixed));
|
||||
memmove(destination.offsets, source.offsets, num * sizeof(QFixedPoint));
|
||||
}
|
||||
}
|
||||
|
||||
Q_STATIC_ASSERT(sizeof(HB_Glyph) == sizeof(glyph_t));
|
||||
Q_STATIC_ASSERT(sizeof(HB_GlyphAttributes) == sizeof(QGlyphAttributes));
|
||||
Q_STATIC_ASSERT(sizeof(HB_Fixed) == sizeof(QFixed));
|
||||
Q_STATIC_ASSERT(sizeof(HB_FixedPoint) == sizeof(QFixedPoint));
|
||||
|
||||
/// take the item from layoutData->items and
|
||||
void QTextEngine::shapeTextWithHarfbuzz(int item) const
|
||||
{
|
||||
Q_ASSERT(sizeof(HB_Fixed) == sizeof(QFixed));
|
||||
Q_ASSERT(sizeof(HB_FixedPoint) == sizeof(QFixedPoint));
|
||||
|
||||
QScriptItem &si = layoutData->items[item];
|
||||
|
||||
si.glyph_data_offset = layoutData->used;
|
||||
|
|
@ -1074,9 +1071,9 @@ void QTextEngine::shapeTextWithHarfbuzz(int item) const
|
|||
itemBoundaries.append(i);
|
||||
}
|
||||
lastEngine = engineIdx;
|
||||
if (HB_IsHighSurrogate(entire_shaper_item.string[charIdx])
|
||||
if (QChar::isHighSurrogate(entire_shaper_item.string[charIdx])
|
||||
&& charIdx < stringEnd - 1
|
||||
&& HB_IsLowSurrogate(entire_shaper_item.string[charIdx + 1]))
|
||||
&& QChar::isLowSurrogate(entire_shaper_item.string[charIdx + 1]))
|
||||
++charIdx;
|
||||
}
|
||||
}
|
||||
|
|
@ -1129,13 +1126,13 @@ void QTextEngine::shapeTextWithHarfbuzz(int item) const
|
|||
if (shaper_item.num_glyphs > shaper_item.item.length)
|
||||
moveGlyphData(g.mid(shaper_item.num_glyphs), g.mid(shaper_item.initialGlyphCount), remaining_glyphs);
|
||||
|
||||
shaper_item.glyphs = g.glyphs;
|
||||
shaper_item.attributes = g.attributes;
|
||||
shaper_item.glyphs = reinterpret_cast<HB_Glyph *>(g.glyphs);
|
||||
shaper_item.attributes = reinterpret_cast<HB_GlyphAttributes *>(g.attributes);
|
||||
shaper_item.advances = reinterpret_cast<HB_Fixed *>(g.advances_x);
|
||||
shaper_item.offsets = reinterpret_cast<HB_FixedPoint *>(g.offsets);
|
||||
|
||||
if (engineIdx != 0 && shaper_item.glyphIndicesPresent) {
|
||||
for (hb_uint32 i = 0; i < shaper_item.initialGlyphCount; ++i)
|
||||
for (quint32 i = 0; i < shaper_item.initialGlyphCount; ++i)
|
||||
shaper_item.glyphs[i] &= 0x00ffffff;
|
||||
}
|
||||
|
||||
|
|
@ -1147,14 +1144,14 @@ void QTextEngine::shapeTextWithHarfbuzz(int item) const
|
|||
QGlyphLayout g = availableGlyphs(&si).mid(glyph_pos, shaper_item.num_glyphs);
|
||||
moveGlyphData(g.mid(shaper_item.num_glyphs), g.mid(shaper_item.initialGlyphCount), remaining_glyphs);
|
||||
|
||||
for (hb_uint32 i = 0; i < shaper_item.item.length; ++i)
|
||||
for (quint32 i = 0; i < shaper_item.item.length; ++i)
|
||||
shaper_item.log_clusters[i] += glyph_pos;
|
||||
|
||||
if (kerningEnabled && !shaper_item.kerning_applied)
|
||||
actualFontEngine->doKerning(&g, option.useDesignMetrics() ? QFontEngine::DesignMetrics : QFontEngine::ShaperFlags(0));
|
||||
|
||||
if (engineIdx != 0) {
|
||||
for (hb_uint32 i = 0; i < shaper_item.num_glyphs; ++i)
|
||||
for (quint32 i = 0; i < shaper_item.num_glyphs; ++i)
|
||||
g.glyphs[i] |= (engineIdx << 24);
|
||||
}
|
||||
|
||||
|
|
@ -1224,7 +1221,7 @@ const QCharAttributes *QTextEngine::attributes() const
|
|||
scriptItems[i].script = si.analysis.script;
|
||||
}
|
||||
|
||||
QUnicodeTools::initCharAttributes(reinterpret_cast<const HB_UChar16 *>(layoutData->string.constData()),
|
||||
QUnicodeTools::initCharAttributes(reinterpret_cast<const ushort *>(layoutData->string.constData()),
|
||||
layoutData->string.length(),
|
||||
scriptItems.data(), scriptItems.size(),
|
||||
(QCharAttributes *)layoutData->memory);
|
||||
|
|
@ -2156,11 +2153,11 @@ void QGlyphLayout::grow(char *address, int totalGlyphs)
|
|||
|
||||
if (numGlyphs) {
|
||||
// move the existing data
|
||||
memmove(newLayout.attributes, oldLayout.attributes, numGlyphs * sizeof(HB_GlyphAttributes));
|
||||
memmove(newLayout.attributes, oldLayout.attributes, numGlyphs * sizeof(QGlyphAttributes));
|
||||
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));
|
||||
memmove(newLayout.glyphs, oldLayout.glyphs, numGlyphs * sizeof(glyph_t));
|
||||
}
|
||||
|
||||
// clear the new data
|
||||
|
|
|
|||
|
|
@ -71,8 +71,6 @@
|
|||
#include "private/qtextdocument_p.h"
|
||||
#endif
|
||||
|
||||
#include "private/qharfbuzz_copy_p.h"
|
||||
|
||||
#include "private/qfixed_p.h"
|
||||
|
||||
#include <private/qunicodetools_p.h>
|
||||
|
|
@ -89,6 +87,22 @@ class QPainter;
|
|||
|
||||
class QAbstractTextDocumentLayout;
|
||||
|
||||
typedef quint32 glyph_t;
|
||||
|
||||
#ifdef __xlC__
|
||||
typedef unsigned q_hb_bitfield;
|
||||
#else
|
||||
typedef quint8 q_hb_bitfield;
|
||||
#endif
|
||||
|
||||
typedef struct {
|
||||
q_hb_bitfield justification :4; /* Justification class */
|
||||
q_hb_bitfield clusterStart :1; /* First glyph of representation of cluster */
|
||||
q_hb_bitfield mark :1; /* needs to be positioned around base char */
|
||||
q_hb_bitfield zeroWidth :1; /* ZWJ, ZWNJ etc, with no width */
|
||||
q_hb_bitfield dontPrint :1;
|
||||
q_hb_bitfield combiningClass :8;
|
||||
} QGlyphAttributes;
|
||||
|
||||
// this uses the same coordinate system as Qt, but a different one to freetype.
|
||||
// * y is usually negative, and is equal to the ascent.
|
||||
|
|
@ -164,20 +178,20 @@ struct QGlyphLayoutInstance
|
|||
{
|
||||
QFixedPoint offset;
|
||||
QFixedPoint advance;
|
||||
HB_Glyph glyph;
|
||||
glyph_t glyph;
|
||||
QGlyphJustification justification;
|
||||
HB_GlyphAttributes attributes;
|
||||
QGlyphAttributes attributes;
|
||||
};
|
||||
|
||||
struct QGlyphLayout
|
||||
{
|
||||
// init to 0 not needed, done when shaping
|
||||
QFixedPoint *offsets; // 8 bytes per element
|
||||
HB_Glyph *glyphs; // 4 bytes per element
|
||||
glyph_t *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
|
||||
QGlyphAttributes *attributes; // 2 bytes per element
|
||||
|
||||
int numGlyphs;
|
||||
|
||||
|
|
@ -186,16 +200,16 @@ struct QGlyphLayout
|
|||
inline explicit QGlyphLayout(char *address, int totalGlyphs)
|
||||
{
|
||||
offsets = reinterpret_cast<QFixedPoint *>(address);
|
||||
int offset = totalGlyphs * sizeof(HB_FixedPoint);
|
||||
glyphs = reinterpret_cast<HB_Glyph *>(address + offset);
|
||||
offset += totalGlyphs * sizeof(HB_Glyph);
|
||||
int offset = totalGlyphs * sizeof(QFixedPoint);
|
||||
glyphs = reinterpret_cast<glyph_t *>(address + offset);
|
||||
offset += totalGlyphs * sizeof(glyph_t);
|
||||
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);
|
||||
attributes = reinterpret_cast<QGlyphAttributes *>(address + offset);
|
||||
numGlyphs = totalGlyphs;
|
||||
}
|
||||
|
||||
|
|
@ -215,7 +229,7 @@ struct QGlyphLayout
|
|||
}
|
||||
|
||||
static inline int spaceNeededForGlyphLayout(int totalGlyphs) {
|
||||
return totalGlyphs * (sizeof(HB_Glyph) + sizeof(HB_GlyphAttributes)
|
||||
return totalGlyphs * (sizeof(glyph_t) + sizeof(QGlyphAttributes)
|
||||
+ sizeof(QFixed) + sizeof(QFixed) + sizeof(QFixedPoint)
|
||||
+ sizeof(QGlyphJustification));
|
||||
}
|
||||
|
|
@ -254,11 +268,11 @@ struct QGlyphLayout
|
|||
} else {
|
||||
const int num = last - first;
|
||||
memset(offsets + first, 0, num * sizeof(QFixedPoint));
|
||||
memset(glyphs + first, 0, num * sizeof(HB_Glyph));
|
||||
memset(glyphs + first, 0, num * sizeof(glyph_t));
|
||||
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));
|
||||
memset(attributes + first, 0, num * sizeof(QGlyphAttributes));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -300,7 +314,7 @@ public:
|
|||
}
|
||||
|
||||
private:
|
||||
void *buffer[(N * (sizeof(HB_Glyph) + sizeof(HB_GlyphAttributes)
|
||||
void *buffer[(N * (sizeof(glyph_t) + sizeof(QGlyphAttributes)
|
||||
+ sizeof(QFixed) + sizeof(QFixed) + sizeof(QFixedPoint)
|
||||
+ sizeof(QGlyphJustification)))
|
||||
/ sizeof(void *) + 1];
|
||||
|
|
|
|||
|
|
@ -1134,8 +1134,8 @@ void tst_QTextScriptEngine::mirroredChars()
|
|||
s.append(QLatin1Char('('));
|
||||
s.append(QLatin1Char(')'));
|
||||
|
||||
HB_Glyph leftParenthesis;
|
||||
HB_Glyph rightParenthesis;
|
||||
glyph_t leftParenthesis;
|
||||
glyph_t rightParenthesis;
|
||||
{
|
||||
QTextLayout layout(s);
|
||||
layout.setCacheEnabled(true);
|
||||
|
|
|
|||
Loading…
Reference in New Issue