From 40a7f2c6469e1702e791c66414051fed385a7930 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Thu, 15 Aug 2019 08:55:49 +0200 Subject: 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 --- src/distancefieldgenerator/mainwindow.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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(&glyphRecord), sizeof(QtdfGlyphRecord)); int expectedWidth = qCeil(glyphData.texCoord.width + glyphData.texCoord.xMargin * 2); -- cgit v1.2.3