summaryrefslogtreecommitdiffstats
path: root/tests/auto/gui
diff options
context:
space:
mode:
authorTor Arne Vestbø <tor.arne.vestbo@theqtcompany.com>2015-08-17 17:59:06 +0200
committerTor Arne Vestbø <tor.arne.vestbo@theqtcompany.com>2015-09-02 09:11:31 +0000
commit54dbdc26bacd3ab776c99ebef734404ef2e08ce5 (patch)
tree6c3d5614ea3beefd023ab0a259ecf207655ba2ce /tests/auto/gui
parentba94e26b8b233456b004084892464ec55b20800c (diff)
Move min left/right bearing calculations to QFontEngine baseclass
The logic used in the FreeType font engine can be generalized and move to the QFontEngine baseclass. This allows the CoreText font engine to correctly report the minimum left/right bearings, which decreases the chance that an optimization in QTextLayout's line breaking algorithm will produce wrong results. The calculation of left and right bearing has been moved to the glyph_metrics_t type to reduce code duplication. This allows us to use the with and height of the bounding box to determine if the glyph has any contours. Change-Id: I864697d3f31ed56f22f04666199b6c5023c5e585 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>
Diffstat (limited to 'tests/auto/gui')
-rw-r--r--tests/auto/gui/text/qtextlayout/tst_qtextlayout.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/tests/auto/gui/text/qtextlayout/tst_qtextlayout.cpp b/tests/auto/gui/text/qtextlayout/tst_qtextlayout.cpp
index 18da61925d..de0c2d6dbe 100644
--- a/tests/auto/gui/text/qtextlayout/tst_qtextlayout.cpp
+++ b/tests/auto/gui/text/qtextlayout/tst_qtextlayout.cpp
@@ -1985,7 +1985,12 @@ void tst_QTextLayout::textWidthVsWIdth()
"./libs -I/home/ettrich/dev/creator/tools -I../../plugins -I../../shared/scriptwrapper -I../../libs/3rdparty/botan/build -Idialogs -Iactionmanager -Ieditorma"
"nager -Iprogressmanager -Iscriptmanager -I.moc/debug-shared -I.uic -o .obj/debug-shared/sidebar.o sidebar.cpp"));
- // textWidth includes right bearing, but it should never be LARGER than width if there is space for at least one character
+ // The naturalTextWidth includes right bearing, but should never be LARGER than line width if
+ // there is space for at least one character. Unfortunately that assumption may not hold if the
+ // font engine fails to report an accurate minimum right bearing for the font, eg. when the
+ // minimum right bearing reported by the font engine doesn't cover all the glyphs in the font.
+ // The result is that this test may fail in some cases. We should fix this by running the test
+ // with a font that we know have no suprising right bearings. See qtextlayout.cpp for details.
for (int width = 100; width < 1000; ++width) {
layout.beginLayout();
QTextLine line = layout.createLine();