summaryrefslogtreecommitdiffstats
path: root/src/gui/text/qtextengine.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Merge branch 'master' of scm.dev.nokia.troll.no:qt/qt-fire-staging into ↵Qt Continuous Integration System2011-07-211-2/+2
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | master-integration * 'master' of scm.dev.nokia.troll.no:qt/qt-fire-staging: Move separator skipping to proper place Skip shaping for hidden line/paragraph separators Support interface orientation for uikit. Add support for opening LinuxInput devices exclusively ('grabbing'). Fixed regression in compilerwarnings. Properly quit the input event thread in the directfb platform plugin. Apply 57993ba7 properly to 4.8 Deprecate some QPixmap functions (marked as obsolete already). Deprecate some functions in QImage (that have been obsolete since 4.1). Add QLocale::toUpper/Lower Fix warning for uninitialized variable
| * Move separator skipping to proper placeJiang Jiang2011-07-191-6/+0
| | | | | | | | | | | | So that it won't crash some places that requires shaping results. Reviewed-by: TrustMe
| * Skip shaping for hidden line/paragraph separatorsJiang Jiang2011-07-191-0/+6
| | | | | | | | | | | | | | | | | | | | Since we are not going to draw them in QTextLine::draw either, and shaping them here will cause performance issue on certain systems like Mac OS X 10.7 (most fonts don't have glyph for U+2028, while font fallback handling in Core Text slowed down a bit). Task-number: QTBUG-20252 Reviewed-by: Eskil
| * Apply 57993ba7 properly to 4.8Jiang Jiang2011-07-141-1/+1
| | | | | | | | | | | | | | Because we have moved alignLine from qtextlayout.cpp to QTextEngine, this patch has to be applied manually. Reviewed-by: TrustMe
| * Fix warning for uninitialized variableJiang Jiang2011-07-121-1/+1
| | | | | | | | Reviewed-by: Eskil
* | Merge remote-tracking branch 'origin/4.7' into qt-4.8-from-4.7Liang Qi2011-07-141-0/+1
|\ \ | |/ |/| | | | | | | Conflicts: src/s60installs/bwins/QtGuiu.def src/s60installs/eabi/QtGuiu.def
| * Fix potential crash when clicking in a text editEskil Abrahamsen Blomfeldt2011-07-131-0/+1
| | | | | | | | | | | | | | | | | | Since the attributes() call might resize the layout and therefore delete the previous data, the logClusters pointer might be dangling at this point. We need to reget it to make sure it's valid. Task-number: QTBUG-20310 Reviewed-by: Jiang Jiang
| * Check engine existence before increasing reference countJiang Jiang2011-07-121-3/+6
| | | | | | | | | | Reviewed-by: TrustMe (cherry picked from commit 244620438700464a862ceab7c881974a5b1d1fea)
| * Keep reference count for cached font engines in QTextEngineJiang Jiang2011-07-111-0/+15
| | | | | | | | | | | | | | | | | | So that if these font engines are deallocated elsewhere (by QFontCache for instance), we can still access them in QTextEngine. Task-number: QTBUG-17603 Reviewed-by: Eskil (cherry picked from commit 6e23fb69e441871829765ff512e90fed17b6798d)
| * Optimize text layout.Michael Brasser2011-07-111-19/+46
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When laying out text, a significant amount of time was being spent querying for the font engine. This patch: * changes the layout to only query for the engine when a new script item is encountered. * adds an internal cache of the previous result to QTextEngine::fontEngine(). This catches the important case of multiline text with few font engine changes. With these changes layout costs are now approximately 60% of what they were previously, as measured by the text layout benchmarks. Reviewed-by: Eskil Abrahamsen Blomfeldt (cherry picked from commit 0c56bef89b6e3fe4c9fb32eb8b51a6ea316a89fa)
| * Fix crash when app font is addedJiang Jiang2011-07-111-14/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Loading app fonts will clear the application font cache, but QFontPrivate::engineWithScript will try to load the font again, in Mac the font engine used here must be the one used for shaping, because subsequent sub font engines may be added to it during the shaping process (QCoreTextFontEngineMulti::stringToCMap). That is why we need to fetch the font engine directly from QTextEngine's fontEngine cache instead of QFontCache. Task-number: QTBUG-20250 Reviewed-by: Eskil (cherry picked from commit 1f90ae36cff8acf581d1624bf011fe3a55c623c0)
| * Fix boundry conditions for cursor hit testJiang Jiang2011-05-251-1/+1
| | | | | | | | | | | | | | Clicking at the edge of a glyph means lookup for the left glyph. Reviewed-by: TrustMe (cherry picked from commit 31110bf84bb06d57983501fa65fe0db3f7c61927)
| * Fix cursor position test on CursorOnCharacter caseJiang Jiang2011-05-251-1/+4
| | | | | | | | Reviewed-by: TrustMe
| * Support placing cursor in ligature with mouse or touchJiang Jiang2011-05-231-0/+66
| | | | | | | | | | | | | | | | | | | | | | | | We need to find out the closest element in the ligature to the point we clicked (or tapped), currently we do this by dividing the width of that ligature glyph evenly by the number of characters it covered. We only support Common and Greek script at this point, ligatures in other scripts are still handled as a whole. Task-number: QTBUG-19260 Reviewed-by: Eskil
| * Update licenseheader text in source filesJyri Tahtela2011-05-131-17/+17
| | | | | | | | | | | | | | Updated version of LGPL and FDL licenseheaders. Apply release phase licenseheaders for all source files. Reviewed-by: Trust Me
| * Let QTextLine decide its own x position in QPainterJiang Jiang2011-04-191-0/+16
| | | | | | | | | | | | | | | | | | | | So that it can take trailing space width into account when doing right aligned text drawing. Backported from master. Task-number: QTBUG-18303 Reviewed-by: Eskil
| * Make sure num_glyphs pass to HarfBuzz is large enoughJiang Jiang2011-03-241-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (Backport from master) Currently we only pass the num_glyphs for the run to HB_ShapeItem, but it can be less then the string length for this run because of Unicode surrogates. Thus, we need to pass at least the length of that run as num_glyphs to HB (given that we have enough space allocated because for the entire string), if that's still not enough, we will do ensureSpace again according to the num_glyphs returned by HB and move remaining glyphs backwards. Task-number: QTBUG-15679 Reviewed-by: Lars Knoll
* | Fix crash when app font is addedJiang Jiang2011-07-111-14/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | Loading app fonts will clear the application font cache, but QFontPrivate::engineWithScript will try to load the font again, in Mac the font engine used here must be the one used for shaping, because subsequent sub font engines may be added to it during the shaping process (QCoreTextFontEngineMulti::stringToCMap). That is why we need to fetch the font engine directly from QTextEngine's fontEngine cache instead of QFontCache. Task-number: QTBUG-20250 Reviewed-by: Eskil
* | Skip boundry neutral characters in bidi itemizationJiang Jiang2011-06-221-4/+22
| | | | | | | | | | | | | | | | | | According to UAX #9, bidiItemize should act as if those characters don't exist. If we don't, dir and status.eor here may become QChar::DirBN, thus interfere the result of bidiItemize. Task-number: QTBUG-19949 Reviewed-by: Lars Knoll
* | Fix warning in qtextengine compilationJiang Jiang2011-06-081-1/+1
| | | | | | | | | | | | enableHarfbuzz() should only be defined on Mac. Reviewed-by: Eskil
* | Merge remote branch 'qt/4.8' into fire-masterPaul Olav Tvete2011-06-061-17/+17
|\ \ | | | | | | | | | | | | | | | | | | | | | Conflicts: src/plugins/platforms/wayland/qwaylandclipboard.cpp src/plugins/platforms/wayland/qwaylandclipboard.h src/plugins/platforms/wayland/qwaylanddisplay.cpp src/s60installs/eabi/QtOpenGLu.def
| * | Update licenseheader text in source files for qt4.8Jyri Tahtela2011-05-131-17/+17
| | | | | | | | | | | | | | | | | | | | | Updated version of LGPL and FDL licenseheaders. Apply release phase licenseheaders for all source files. Reviewed-by: Trust Me
* | | Fix boundry conditions for cursor hit testJiang Jiang2011-05-251-1/+1
| | | | | | | | | | | | | | | | | | Clicking at the edge of a glyph means lookup for the left glyph. Reviewed-by: TrustMe
* | | Fix cursor position test on CursorOnCharacter caseJiang Jiang2011-05-251-1/+4
| | | | | | | | | | | | Reviewed-by: TrustMe
* | | Support placing cursor in ligature with mouse or touchJiang Jiang2011-05-231-0/+66
|/ / | | | | | | | | | | | | | | | | | | | | | | We need to find out the closest element in the ligature to the point we clicked (or tapped), currently we do this by dividing the width of that ligature glyph evenly by the number of characters it covered. We only support Common and Greek script at this point, ligatures in other scripts are still handled as a whole. Task-number: QTBUG-19260 Reviewed-by: Eskil
* | Use maximum ascent/descent/leading from fallback fonts in shapingJiang Jiang2011-04-271-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When shaping a QScriptItem with a multi font engine, currently we only take the ascent/descent/leading from the primary (first) font engine in that multi font engine, however, subsequent engines used during shaping may have larger ascent/descent/leading, disregarding them may cause clipping issues in some cases. It's fixed by checking each font engine used in the shaping process and take the maximum value instead of the first one. On ATSUI we merely make it compile. Task-number: QTBUG-16719 Reviewed-by: Eskil
* | Make sure layoutData exist before checking for string directionJiang Jiang2011-04-271-0/+2
| | | | | | | | | | | | Otherwise accessing that through QTextEngine::alignLine may cause crash. Reviewed-by: Samuel Rødal
* | Take leading space width into account for painting and selectionJiang Jiang2011-04-261-1/+3
| | | | | | | | | | | | | | | | | | When painting horizontally centered RTL text and selection with trailing spaces, we need to take that space width into account because line.textAdvance doesn't include it. Task-number: QTBUG-18612 Reviewed-by: Eskil
* | Turn on HarfBuzz support for Mac/CocoaJiang Jiang2011-04-191-1/+33
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It's possible to enable HarfBuzz text layout on Mac by either: - Set QT_ENABLE_HARFBUZZ environment variable when running a Qt app. - configure with -harfbuzz to build Qt, then HarfBuzz support will be turned on by default. HarfBuzz will only be used when the font explicitly requested is supported by HarfBuzz (aka. TrueType/OpenType font), other fonts (AAT fonts) will still be handled by Core Text. Using HarfBuzz for text layout will hopefully solve most tricky complex text shaping bugs on Mac. Task-number: QTBUG-17728 Reviewed-by: Eskil
* | Support visual cursor movement for BIDI textJiang Jiang2011-04-191-0/+297
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Bidi input can in some contexts be more intuitive if the cursor works in visual way: pressing left arrow key always make cursor move one character to the left regardless the language of text, pressing right arrow key always make cursor move to the right. It is also the behavior of Mac OS X. Based on the above reason and requests from Symbian we implemented this support for visual movement in BIDI text. 3 public properties are added to QTextDocument, QTextLayout and QLineEdit respectively: - QTextDocument::defaultCursorMoveStyle can be used to control the cursor behavior in all widgets based on QTextDocument, like QTextEdit, QPlainTextEdit, etc. When set to QTextCursor:: Visual, it will enable visual movement for all the cursors in the corresponding text edit. Default is QTextCursor::Logical. - QTextLayout::cursorMoveStyle is used for low-level cursor manipulation. When set to Visual, it will enable visual movement behavior for all the cursor related methods, including cursorToX, xToCursor and drawCursor. Default is Logical. - QLineEdit::cursorMoveStyle is used to control cursor movement behavior in QLineEdit. Default is Logical.: Task-number: QTBUG-13859 Reviewed-by: Eskil
* | Put all the declarations of qt_defaultDpi{,X,Y}() in one placeJiang Jiang2011-04-051-4/+0
| | | | | | | | Reviewed-by: Samuel Rødal
* | Fix horizontal centered text drawing without word wrapJiang Jiang2011-03-311-0/+16
| | | | | | | | | | | | | | | | In this case we can't use line width to align the text, we have to use the rectangle width given in QPainter::drawText for alignment instead. Reviewed-by: Eskil
* | Check engine existence before increasing reference countJiang Jiang2011-02-231-3/+6
| | | | | | | | Reviewed-by: TrustMe
* | Keep reference count for cached font engines in QTextEngineJiang Jiang2011-02-231-0/+15
| | | | | | | | | | | | | | | | So that if these font engines are deallocated elsewhere (by QFontCache for instance), we can still access them in QTextEngine. Task-number: QTBUG-17603 Reviewed-by: Eskil
* | Merge remote branch 'origin/4.7' into qt-master-from-4.7Olivier Goffart2011-01-171-9/+9
|\ \ | |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: examples/webkit/imageanalyzer/imageanalyzer.h examples/webkit/imageanalyzer/mainwindow.h mkspecs/unsupported/qws/linux-x86-openkode-g++/qplatformdefs.h src/corelib/io/qfsfileengine_iterator_unix.cpp src/corelib/io/qfsfileengine_iterator_win.cpp src/corelib/kernel/qcoreapplication.cpp src/network/access/qnetworkaccessdatabackend.cpp src/plugins/bearer/connman/qconnmanservice_linux.cpp src/plugins/platforms/openvglite/qwindowsurface_vglite.h src/s60installs/bwins/QtCoreu.def src/s60installs/eabi/QtCoreu.def src/s60installs/s60installs.pro tools/assistant/tools/assistant/helpviewer_qwv.h tools/qdoc3/test/qt-html-templates.qdocconf
| * Update copyright year to 2011.Jason McDonald2011-01-101-1/+1
| | | | | | | | Reviewed-by: Trust Me
| * Merge branch '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-2 into ↵Qt Continuous Integration System2011-01-071-1/+1
| |\ | | | | | | | | | | | | | | | | | | | | | 4.7-integration * '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-2: Fixes crash in QGraphicsItem's destructor. Doc: Fixing typo
| | * Doc: Fixing typoSergio Ahumada2011-01-071-1/+1
| | |
| * | improve performance of QTextEngine, esp. setBoundary by using non-detaching ↵Milian Wolff2010-12-231-7/+7
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | operator[] Improves scrolling in testfile content.xml attached to QTBUG-9549. According to callgrind, the improvement is nearly 35% (comparing total incl. cost of QTextEngine::setBoundary) total incl cost / calls to setBoundary = before: 6.0883269E9 / 46520 = approx. 130875.47 after: 2.4834313E9 / 29370 = approx. 84556.733 in relation this gives us: 84556.733 / 130875.47 = approx. 0.64608542 Merge-request: 975 Reviewed-by: Harald Fernengel <harald.fernengel@nokia.com>
* | Make sure num_glyphs pass to HarfBuzz is large enoughJiang Jiang2010-12-131-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently we only pass the num_glyphs for the run to HB_ShapeItem, but it can be less then the string length for this run because of Unicode surrogates. Thus, we need to pass at least the length of that run as num_glyphs to HB (given that we have enough space allocated because for the entire string), if that's still not enough, we will do ensureSpace again according to the num_glyphs returned by HB and move remaining glyphs backwards. Task-number: QTBUG-15679 Reviewed-by: Lars Knoll
* | Fix cursor position of one digit after RTL textJiang Jiang2010-11-151-1/+1
| | | | | | | | | | | | | | | | | | A single digit after RTL text will be considered as RTL because it was treated as Other Neutral (DirON), it can be solved by changing it to DirAN. Task-number: QTBUG-2795 Reviewed-by: Lars Knoll
* | Merge branch 4.7 into qt-master-from-4.7Qt Continuous Integration System2010-10-091-6/+10
|\ \ | |/
| * Fix infinite loop when justifying undisplayable Arabic textEskil Abrahamsen Blomfeldt2010-10-081-6/+10
| | | | | | | | | | | | | | | | | | | | | | If the Arabic text is for some reason undisplayable, e.g. because of QTBUG-13132, the font engine will be unable to find the tatweel character and the kashida width may be returned as 0. This would potentially cause an infinite loop, as "need" would remain >= minKashida forever because x - 0 is still >= 0. Task-number: QTBUG-13130 Reviewed-by: Lars
* | Merge remote branch 'origin/4.7' into qt-master-from-4.7Olivier Goffart2010-09-101-2/+9
|\ \ | |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: bin/syncqt demos/declarative/snake/content/snake.js demos/declarative/snake/snake.qml doc/src/development/qmake-manual.qdoc src/corelib/plugin/plugin.pri src/gui/kernel/qapplication_win.cpp src/gui/kernel/qdesktopwidget_win.cpp src/gui/painting/qdrawhelper.cpp tests/auto/qdir/tst_qdir.cpp tools/qdoc3/test/assistant.qdocconf tools/qdoc3/test/designer.qdocconf tools/qdoc3/test/linguist.qdocconf
| * Recognize @, #, $ and ` as word separatorsThorbjørn Lindeijer2010-09-031-0/+4
| | | | | | | | | | | | | | | | The behavior of Qt with these characters was different than other toolkits, which annoys some people. Task-number: QTCREATORBUG-2241 Reviewed-by: mae
| * QTextEngine::LayoutData::reallocate musn't corrupt memoryJoão Abecasis2010-08-311-2/+5
| | | | | | | | | | | | | | | | | | ... on re-allocation failure. So, let's actually check the returned pointer and fail, instead of using Q_CHECK_PTR. Task-number: QT-3785 Reviewed-by: Peter Hartmann Reviewed-by: Samuel Rødal
* | Merge remote branch 'origin/4.7' into qt-master-from-4.7Olivier Goffart2010-08-301-6/+1
|\ \ | |/ | | | | | | | | | | Conflicts: qmake/generators/win32/msbuild_objectmodel.cpp qmake/generators/win32/msvc_vcxproj.cpp tests/auto/qnetworkreply/tst_qnetworkreply.cpp
| * Correct last right bearing in boundingBox(glyphs)Jiang Jiang2010-08-271-6/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Commit 07880542ecc479807c23c5646d263135240822ff introduced regression to QFontMetrics::boundingRect and QTextEngine::boundingBox on FT, XLFD and QPF font engine. Because on these platforms, rightBearing of the last glyphs is already removed from the width returned in glyph_metrics_t. Subtracting that rightBearing twice will cause the resulting boundingBox smaller than expected. This patch fix this by removing last right bearing accounting code from generic QTextEngine::boundingBox, instead, we put it into font engines that need them: QFontEngineWin, QCoreTextFontEngine, QFontEngineMac, QFontEngineS60 and QFontEngineQWS. So that the resulting width should be correct on all platforms without introducing any performance penalties. Task-number: QTBUG-6854, QTBUG-12950 Reviewed-by: Eskil
| * Use binarysort to find items.Gunnar Sletta2010-08-241-7/+12
| | | | | | | | | | Task: http://bugreports.qt.nokia.com/browse/QTBUG-231 Reviwed-by: Eskil
* | Merge remote branch 'origin/4.7' into qt-master-from-4.7Olivier Goffart2010-08-131-24/+62
|\ \ | |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/gui/painting/qpainter.cpp src/gui/text/qtextengine.cpp tests/auto/qimage/tst_qimage.cpp tests/auto/qpainter/tst_qpainter.cpp tools/qdoc3/test/assistant.qdocconf tools/qdoc3/test/designer.qdocconf tools/qdoc3/test/linguist.qdocconf tools/qdoc3/test/qmake.qdocconf tools/qdoc3/test/qt-build-docs.qdocconf tools/qdoc3/test/qt-html-templates.qdocconf tools/qdoc3/test/qt-html-templates_zh_CN.qdocconf tools/qdoc3/test/qt.qdocconf