diff options
author | Konstantin Ritt <ritt.ks@gmail.com> | 2013-03-09 19:28:20 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-03-12 18:13:37 +0100 |
commit | f69c9059d6c0bfb911bf0bdcec1e7470c38fa7e2 (patch) | |
tree | d2ec791666f98347c8ef83eb1aeb47b37321c94a /src/gui/text/qtextengine_p.h | |
parent | b047f48612e2ba38ff63979bd60e0f203d77ceb3 (diff) |
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>
Diffstat (limited to 'src/gui/text/qtextengine_p.h')
-rw-r--r-- | src/gui/text/qtextengine_p.h | 42 |
1 files changed, 28 insertions, 14 deletions
diff --git a/src/gui/text/qtextengine_p.h b/src/gui/text/qtextengine_p.h index 93e92e7ca8..88bc5dcc4c 100644 --- a/src/gui/text/qtextengine_p.h +++ b/src/gui/text/qtextengine_p.h @@ -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]; |