diff options
author | Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io> | 2019-08-15 08:55:49 +0200 |
---|---|---|
committer | Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io> | 2019-08-15 11:33:49 +0200 |
commit | 40a7f2c6469e1702e791c66414051fed385a7930 (patch) | |
tree | b1cdc48a770abebcdbad892e39ca10841df5bf67 | |
parent | a690022b7e56b2e36a95ef22b854af4c82c5fdc8 (diff) |
distancefieldgenerator: Fix garbled text with large fonts on little endian
When writing the texture index of each glyph into the font, we would
first do toBigEndian() on an int and then truncate this to quint16,
causing the texture index to be 0 for all glyphs on little endian
systems.
This would cause glyphs that were not located in the first texture to be
garbled in the output.
[ChangeLog][distancefieldgenerator] Fixed broken text rendering when generating
large glyph sets.
Task-number: QTBUG-77501
Change-Id: I7c2d31a6e57182f440d7f78bd6305109846ccb75
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
-rw-r--r-- | src/distancefieldgenerator/mainwindow.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/distancefieldgenerator/mainwindow.cpp b/src/distancefieldgenerator/mainwindow.cpp index 3717330b4..ee4475ada 100644 --- a/src/distancefieldgenerator/mainwindow.cpp +++ b/src/distancefieldgenerator/mainwindow.cpp @@ -551,7 +551,7 @@ QByteArray MainWindow::createSfntTable() glyphRecord.boundingRectY = qToBigEndian(TO_FIXED_POINT(glyphData.boundingRect.y())); glyphRecord.boundingRectWidth = qToBigEndian(TO_FIXED_POINT(glyphData.boundingRect.width())); glyphRecord.boundingRectHeight = qToBigEndian(TO_FIXED_POINT(glyphData.boundingRect.height())); - glyphRecord.textureIndex = qToBigEndian(glyphData.textureIndex); + glyphRecord.textureIndex = qToBigEndian(quint16(glyphData.textureIndex)); buffer.write(reinterpret_cast<char *>(&glyphRecord), sizeof(QtdfGlyphRecord)); int expectedWidth = qCeil(glyphData.texCoord.width + glyphData.texCoord.xMargin * 2); |