From 1fe7144a0746353ea629cd91b5c0d04a8434159b Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Wed, 24 Aug 2022 13:25:19 +0200 Subject: Introduce QGlyphRun::stringIndexes() This introduces a way to trace each entry in the glyph index array to a specific index in the original text passed to QTextLayout, as well as a convenience function to access the original string from the QGlyphRun. The index information is stored in the logClusters array internally in Qt, but it contains the inverse information: For each character in the output string, it contains an index into the glyph array. In order to get the string indexes for each glyph, which makes a lot more sense in the context of the QGlyphRun API, we need to do a little search to construct the data. To avoid adding unnecessary allocations, we make the new APIs opt-in. If you do not specify anything, you will only get the glyph indexes and glyph positions as before. However, you can now specify exactly which parts of the layout to extract using an optional flags parameter. This also adds a manual test which can be very handy to visualize QTextLayouts and how they are split into QGlyphRuns. Fixes: QTBUG-103932 Change-Id: Ie4288fff338b9482aba0aba29fc7e1e59fa60900 Reviewed-by: Lars Knoll --- tests/auto/gui/text/qglyphrun/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) (limited to 'tests/auto/gui/text/qglyphrun/CMakeLists.txt') diff --git a/tests/auto/gui/text/qglyphrun/CMakeLists.txt b/tests/auto/gui/text/qglyphrun/CMakeLists.txt index 4928b1c0d4..d6040ba625 100644 --- a/tests/auto/gui/text/qglyphrun/CMakeLists.txt +++ b/tests/auto/gui/text/qglyphrun/CMakeLists.txt @@ -13,6 +13,7 @@ set_source_files_properties("../../../shared/resources/test.ttf" ) set(testdata_resource_files "../../../shared/resources/test.ttf" + "Ligatures.otf" ) qt_internal_add_test(tst_qglyphrun -- cgit v1.2.3