summaryrefslogtreecommitdiffstats
path: root/src/gui/text/qtextlayout.cpp
Commit message (Collapse)AuthorAgeFilesLines
* QtGui: use printf-style qWarning/qDebug where possible (I)Marc Mutz2016-03-041-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The printf-style version of QDebug expands to a lot less code than the std::ostream-style version. Of course, you pay in type safety (but compilers warn about it these days), you cannot stream complex Qt types and streaming QStrings is awkward, but in many cases you actually improve on readability. But the main reason is that something that's not supposed to be executed under normal operation has no business bloating executable code size. This is not an attempt at converting all qWarnings() to printf-style, only the low-hanging fruit. In this first part, replace qWarning() << "..."; with qWarning("..."); In QTransform shared warning strings. Saves 3KiB in text size on optimized GCC 5.3 AMD64 builds. Change-Id: I142a8020eaab043d78465178192f2c8c6d1cc4f9 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com> Reviewed-by: Kai Koehne <kai.koehne@theqtcompany.com>
* Merge remote-tracking branch 'origin/5.6' into 5.7Liang Qi2016-02-241-9/+10
|\ | | | | | | | | | | | | | | | | | | | | Conflicts: src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java src/plugins/platforms/windows/qwindowsfontengine.cpp src/plugins/platforms/windows/qwindowsnativeimage.cpp tests/auto/gui/kernel/qwindow/BLACKLIST tests/auto/gui/kernel/qwindow/tst_qwindow.cpp Change-Id: I649b32b260ce0ed2d6a5089021daa0d6a8db85f7
| * Qt Quick: Fix selection when mixing line breaks and line wrapsEskil Abrahamsen Blomfeldt2016-02-191-9/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The enabler for finding selection ranges in Qt Quick had two bugs which caused some selected text to disappear. Specifically, this was the case for selected text where a line contained both an explicit break and a break due to line wrapping. First of all, the glyphsEnd that is passed into glyphRunsWithInfo() is expected to be inclusive, since we are actually searching for its index in the log cluster array. We would in certain cases not find the glyph at all in the log clusters, thus the glyph run would be set to overlap with any glyph run coming after it in the same item. Second of all, we need to start searching at the correct position in the log clusters when searching for the correct rangeStart, since rangeStart is initialized with textPosition. Otherwise, we would in some cases never reach the start of the range, and rangeStart would be set to textPosition + textLength, which is the end of the range. Task-number: QTBUG-49596 Change-Id: I436ba3f1c7414d4f5044d9b70aa04c60b01755e4 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* | Merge remote-tracking branch 'origin/5.6' into 5.7Liang Qi2016-02-181-0/+3
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | This also reverts commit 018e670a26ff5a61b949100ae080f5e654e7bee8. The change was introduced in 5.6. After the refactoring, 14960f52, in 5.7 branch and a merge, it is not needed any more. Conflicts: .qmake.conf src/corelib/io/qstandardpaths_mac.mm src/corelib/tools/qsharedpointer_impl.h tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp Change-Id: If4fdff0ebf2b9b5df9f9db93ea0022d5ee3da2a4
| * Fix bounding rect of glyph runs in multi-line QTextLayoutEskil Abrahamsen Blomfeldt2016-01-301-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | When getting the glyph runs from a QTextLayout with multiple lines, the glyph runs would be merged if possible, but not their bounding rects. This was an oversight. [ChangeLog][Text][QTextLayout] QTextLayout::glyphRuns() now returns united bounding rects for glyph runs that are merged. Change-Id: Ibbeaa99ecfc4e82e7965342efdae7c3c2b637343 Task-number: QTBUG-50715 Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com> Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* | Updated license headersJani Heikkinen2016-01-151-14/+20
|/ | | | | | | | | | | From Qt 5.7 -> LGPL v2.1 isn't an option anymore, see http://blog.qt.io/blog/2016/01/13/new-agreement-with-the-kde-free-qt-foundation/ Updated license headers to use new LGPL header instead of LGPL21 one (in those files which will be under LGPL v3) Change-Id: I046ec3e47b1876cd7b4b0353a576b352e3a946d9 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* Fix QTextLine::cursorToX()J-P Nurmi2015-11-251-3/+1
| | | | | | | | | | 0e99f3c broke tst_qquicktextinput::horizontalAlignment_RightToLeft() and tst_qquicktextedit::hAlign_RightToLeft(). This fix was proposed by Konstantin. Change-Id: I602b7301d415f266224ae2c1ffd81244e9565862 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com> Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* Optimize QTextEngine::findItem() usage casesKonstantin Ritt2015-11-231-2/+2
| | | | | | | | Since the item positions are guaranteed to grow, we could safely re-use the obtained first item while looking for the last item in the chain. Change-Id: I5e42f5de820c62a51a109a4b227b031c697aa898 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* QTextLine::cursorToX: Optimize by re-using the cached valuesKonstantin Ritt2015-11-231-10/+8
| | | | | | | (and move some code around) Change-Id: I2e26dcc7b769fdbcc750332845da11ec88e332dd Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* QTextLine::cursorToX: Always return the nearest valid cursor positionKonstantin Ritt2015-11-231-9/+9
| | | | | | | | The documentation already states we're doing this, so stop lying and implement it properly :) Change-Id: Ic78980d76f61e8aa64e59ea058a8105d9c507774 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* QTextLine::cursorToX: Fix typo in the documentationKonstantin Ritt2015-11-221-1/+1
| | | | | Change-Id: Iecdcab5145b147edbab78b08bd6c9e2dc2f18d48 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* Move min left/right bearing calculations to QFontEngine baseclassTor Arne Vestbø2015-09-021-3/+10
| | | | | | | | | | | | | | | | 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>
* Merge remote-tracking branch 'origin/5.5' into 5.6Liang Qi2015-08-261-26/+55
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: qmake/doc/snippets/code/doc_src_qmake-manual.pro qmake/doc/src/qmake-manual.qdoc src/corelib/io/qstorageinfo_unix.cpp src/corelib/tools/qbytearray.cpp src/widgets/kernel/qwidgetwindow.cpp tests/auto/corelib/io/qprocess/tst_qprocess.cpp tests/auto/corelib/mimetypes/qmimedatabase/tst_qmimedatabase.cpp tests/auto/network/access/qnetworkreply/BLACKLIST Change-Id: I9efcd7e1cce1c394eed425c43aa6fce7d2edf31c
| * Improve readability of QTextLine's handling of (negative) right bearingTor Arne Vestbø2015-08-071-26/+55
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Helper functions in LineBreakHelper have been renamed from adjustFoo to calculateFoo, to signal that they do work, and are not adjusting something relative to something else. - The use of QFixed(1) and >= 0 has been replaced with an explicit constant for the case of the bearing not being calculated yet. - A helper function negativeRightBearing() has been added that returns the absolute value of any negative right bearing, making the width computations simpler. - Comments have been added and rewritten to make the logic clearer. Change-Id: I1d3a0214cfa8b4fed4551f3444b43a37d55bd69b Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@theqtcompany.com>
* | qdoc:Fixed a few qdoc errorsMartin Smith2015-07-071-0/+14
| | | | | | | | | | | | | | | | | | Fixed a few qdoc error messages caused by errors in qmetatype.cpp and qtextlayout.cpp and qtestcase.cpp and qpointer.cpp Change-Id: I662aa25bedba057e125e289c34787e81793941ff Task-number: QTBUG-46939 Reviewed-by: Martin Smith <martin.smith@digia.com>
* | QTextLayout: deprecate QList API for additionalFormatMarc Mutz2015-07-041-8/+9
| | | | | | | | | | | | | | | | | | This is a separate commit to allow other modules to do the transition before this may vanish or cause a warning. Change-Id: I556837bf0d2c667f067f4e1fa7918bd1a3f55025 Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com> Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* | Fix users of QTextLayout::additionalFormats to use the new APIMarc Mutz2015-05-301-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | QTextLayout::additionalFormats setters and getters using QList<FormatRange> have been deprecated; port to the QVector versions. Moved op== definition for FormatRange needed in tst_qsyntaxhighlighter.cpp to a friend declaration in FormatRange itself, because MSVC 2008 doesn't find it otherwise. Change-Id: Ibab6589df057f02377d895079b56395859e3401e Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
* | QTextLayout: replace a use of an inefficient QList with QVectorMarc Mutz2015-05-291-2/+38
|/ | | | | | | | | | | | | | | | | | | The QTextLayout::FormatRange is larger than void* and thus should not be held in QList. Use a QVector instead. Other parts of Qt already hold FormatRanges in QVectors, so this also makes handling FormatRanges more consistent. To avoid ugly names for the getter which doesn't overload on return type alone), rename the set of function to format (from additionalFormats). [ChangeLog][QtGui][QTextLayout] Added QVector-based alternatives setFormat(), format(), and clearFormat() to setAdditionalFormats(), additionalFormats(), and clearAdditionalFormats(), resp. Change-Id: Ie04a561b43c91c3b2befb3cac2981821f84d5f77 Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com> Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* [QTextCursor] Better use of the cached whiteSpace attributeKonstantin Ritt2015-04-151-4/+4
| | | | | | | | In compare to QTextEngine::atSpace(), this also handles the less-common "white spaces" and the exceptional control codes. Change-Id: I52878932926b7f9fe36c9dd01007963b9691fbf0 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* QTextLayout: Reserve space ahead of time.Robin Burchell2015-02-151-0/+2
| | | | | | | We know the size, so use it instead of allowing QVector to reallocate. Change-Id: I2d18c30ef0d050326bb03c54da61459c40eb7af6 Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
* Update copyright headersJani Heikkinen2015-02-111-7/+7
| | | | | | | | | | | | | | | | | | Qt copyrights are now in The Qt Company, so we could update the source code headers accordingly. In the same go we should also fix the links to point to qt.io. Outdated header.LGPL removed (use header.LGPL21 instead) Old header.LGPL3 renamed to header.LGPL3-COMM to match actual licensing combination. New header.LGPL-COMM taken in the use file which were using old header.LGPL3 (src/plugins/platforms/android/extract.cpp) Added new header.LGPL3 containing Commercial + LGPLv3 + GPLv2 license combination Change-Id: I6f49b819a8a20cc4f88b794a8f6726d975e8ffbe Reviewed-by: Matti Paaso <matti.paaso@theqtcompany.com>
* Fix possibly corrupted log clusters when using custom tab stopsEskil Abrahamsen Blomfeldt2014-12-151-0/+5
| | | | | | | | | | | | | | The calculateTabWidth() can trigger shaping of the item, which can cause the layout data to be reallocated, so we need to update the local pointers to it, like we do when we explicitly invoke the shaper. [ChangeLog][Text] Fixed problems with text layout when using custom tab stops. Task-number: QTBUG-43126 Change-Id: Ifaeeeb4bfb1a55e6638b12b444f53d2679d3d1e6 Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
* Make QRawFont usage safer in a multi-threaded environmentKonstantin Ritt2014-12-131-3/+2
| | | | | | | | | | QFontEngine must be accessed amd deleted only in a thread in which it was instantiated, so we remember that thread and check if it hasn't been changed every time we access the engine. Change-Id: I28bc0394ced9cbd437dc950d35ffcbd99cfa7152 Reviewed-by: Pierre Rossi <pierre.rossi@theqtcompany.com> Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Fix justification in multi fontengine glyphrunsAllan Sandfeld Jensen2014-10-281-2/+4
| | | | | | | | | | QTextLine::glyphRuns was not handling justification when splitting glyphRuns due to multiple font-engines. This patch adds the missing justification. Task-number: QTBUG-41901 Change-Id: I02d24218630506da21531a6499784dff2eecdf6f Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>
* fix crash when dropping a file into an empty QTextEditJoerg Bornemann2014-10-271-0/+4
| | | | | | | | | | | Since commit be0bfe09ee4b99e9ab45c6898949b5d144e77a29 we return -1 in QTextEngine::findItem if the item cannot be found. Calling code must be prepared for this case. Otherwise we run into an out-of-bounds vector access later on. Task-number: QTBUG-42103 Change-Id: Ie338cd1fc3cf0ce1e8edfa59dead635669020a33 Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
* Add text ranges to QGlyphRunPrivateEskil Abrahamsen Blomfeldt2014-10-081-8/+62
| | | | | | | | | | | | This is an enabler for using the QGlyphRun in the selection code of the scene graph node. In this case, we need to know exactly which of the characters in the text are represented by the glyph run, as a single range of text may result in several glyph runs. Change-Id: Ie8ec942693dceea45ab548f6cefc4f78e4c6d524 Task-number: QTBUG-41808 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Fix QTextInlineObject class documentationAlex Blasche2014-10-051-6/+3
| | | | | | | Change-Id: I10ac533c1ba7a8003b59b1617af98afbdd4ed17f Task-number: QTBUG-39784 Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com> Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>
* Update license headers and add new license filesMatti Paaso2014-09-241-19/+11
| | | | | | | | | - Renamed LICENSE.LGPL to LICENSE.LGPLv21 - Added LICENSE.LGPLv3 - Removed LICENSE.GPL Change-Id: Iec3406e3eb3f133be549092015cefe33d259a3f2 Reviewed-by: Iikka Eklund <iikka.eklund@digia.com>
* Merge remote-tracking branch 'origin/5.3' into 5.4Frederik Gladhorn2014-09-231-1/+1
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The isAlwaysAskOption was removed in 38621713150b663355ebeb799a5a50d8e39a3c38 so manually removed code in src/plugins/bearer/connman/qconnmanengine.cpp Conflicts: src/corelib/global/qglobal.h src/corelib/tools/qcollator_macx.cpp src/corelib/tools/qstring.cpp src/gui/kernel/qwindow.cpp src/gui/kernel/qwindow_p.h src/gui/text/qtextengine.cpp src/platformsupport/fontdatabases/fontconfig/qfontenginemultifontconfig_p.h src/plugins/platforms/android/qandroidinputcontext.cpp src/plugins/platforms/xcb/qglxintegration.cpp src/plugins/platforms/xcb/qglxintegration.h src/plugins/platforms/xcb/qxcbconnection_xi2.cpp src/testlib/qtestcase.cpp src/testlib/qtestlog.cpp src/widgets/dialogs/qfiledialog.cpp src/widgets/kernel/qwindowcontainer.cpp tests/auto/corelib/tools/qcollator/tst_qcollator.cpp tests/auto/gui/text/qtextscriptengine/tst_qtextscriptengine.cpp tests/auto/widgets/kernel/qwidget_window/tst_qwidget_window.cpp tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp Change-Id: Ic5d4187f682257a17509f6cd28d2836c6cfe2fc8
| * Fix crash in QTextLayout::cursorToXKevin Funk2014-09-021-1/+1
| | | | | | | | | | | | | | | | | | | | When 'cursorPos' is out of bounds ([0, lineEnd]), this method crashed. Change-Id: Ia0540ab3afbffb5c598f7b8515263cce3b3928e4 Task-number: QTBUG-40753 Reviewed-by: Dominik Haumann <dhaumann@kde.org> Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com> Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
* | Fix menu mnemonic inside ligaturesAllan Sandfeld Jensen2014-09-181-116/+39
| | | | | | | | | | | | | | | | | | | | | | The code to draw underlines on specific characters in widget menu could not handle ligatures. Instead of using special code to handle this case this patch changes the mnemonic underlines to use normal format-ranges making the text engine deal with splitting ligatures as necessary. Task-number: QTBUG-20960 Change-Id: I6159110eae7aa8c819af16ba4a393d758871e2e0 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
* | Merge remote-tracking branch 'origin/5.3' into devFrederik Gladhorn2014-07-221-0/+5
|\| | | | | | | | | | | | | | | Conflicts: src/widgets/kernel/qwidget_qpa.cpp src/widgets/widgets.pro Change-Id: I697eec936c4e1a6c360edc8f0b472e23c0461ecb
| * Doc: Hide QTextInlineObject constructor from the documentationTopi Reinio2014-07-141-0/+5
| | | | | | | | | | | | | | | | | | | | | | The constructor takes an internal class instance as a parameter, and is not meant to be used externally. Add a note in the description and hide the constructor. Task-number: QTBUG-39785 Change-Id: Ice850f0968880f3933ebb7ae83efeaeed85441cb Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com> Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
* | Merge remote-tracking branch 'origin/5.3' into devFrederik Gladhorn2014-07-101-1/+10
|\| | | | | | | Change-Id: Ia12ffdb27ecdf25c2a2bdb0eed1945387502108a
| * REG: Fix nbsp in QTextLayoutEskil Abrahamsen Blomfeldt2014-07-081-1/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | At some point since Qt 4.8, the nbsp character has acquired the whitespace attribute, causing it to be treated exactly like an ordinary space. To account for this, we add an extra check in the layout code to avoid breaking on non-breaking spaces even if they have the whiteSpace flag set. This is a temporary fix for the regression. The line breaking algorithm needs to be refactored and support Unicode tr14 properly, which it currently doesn't. [ChangeLog][Text] Fixed lines breaking on non-breaking spaces. Task-number: QTBUG-39832 Change-Id: Ibd7e1a11ce4b82c611ecda1542c8638a67bf3cae Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
* | Guarantee QTextEngine::findItem() returns -1 for invalid strPosKonstantin Ritt2014-05-231-0/+1
| | | | | | | | | | | | | | | | ...and check the returned value where it may cause undefined behavior (i.e. negative amount of items or iteration from -1 to n). Change-Id: Ib7bd9ab178526df45b792ad48b91ebbab6be861a Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* | Rename some QTextEngine members to reflect their meaningKonstantin Ritt2014-05-201-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | formats() -> formatCollection() additionalFormats -> formats QTextEngine has three different code paths: in context of QTextDocument, additionalFormats are currently _additional_ formats; though in QTextLayout, they are the only formats in use; and the QRawFont-related path shares the QTextLayout's behavior. This is a preparation step to consolidating these three into a single one. Change-Id: I427ccc3c2f672ce090899bb0a0995972315daafa Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
* | Minor code clean-upKonstantin Ritt2014-05-201-1/+1
| | | | | | | | | | Change-Id: I5c43db4e0a499ecfd23f3dac63615e7c40208f36 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
* | Minor optimization for QTextLineItemIteratorKonstantin Ritt2014-05-161-12/+6
|/ | | | | | | | | Don't store unused values (pos_x and levels) and re-use already calculated ones (itemStart, itemEnd, and itemLength). Also const-ify some members to make the code a bit more clear. Change-Id: Ied80ebf9e4e7e8a1d057e413a9bd24f84b8aaf92 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* QTextLayout: Fix cursor position calculation for BiDi textAndrey Volykhin2014-05-121-1/+0
| | | | | | | | | | | Due excess 'break' in loop, function xToCursor() with "CursorOnCharacter" option for BiDI text returns wrong cursor position (start glyph position) all time. Task-number: QTBUG-38846 Change-Id: Iba6671905e0785da6f343db19d6c3bb3e2cf5e8a Reviewed-by: Andrey Volykhin <andrey.volykhin@lge.com> Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com> Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
* QTextLayout: Fix cursor movement from invalid positionKonstantin Ritt2014-04-041-1/+4
| | | | | | | | Actually guarantee cursor doesn't move in this case for both logical and visual modes (just what the documentation says we already do ;) Change-Id: Iabdca7aa1d205672386a0095e3487e585611cdb5 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Get rid of SpecialData::addFormatIndicesKonstantin Ritt2014-02-061-6/+5
| | | | | | | | and rename SpecialData:: resolvedFormatIndices to resolvedFormats. Instead, resolvedFormats now stores QTextCharFormat shared copies. Change-Id: I4a22cb3f5679b980ef52d47e4e1935663dd257ea Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Get rid of QGlyphLayout::advances_yKonstantin Ritt2014-01-301-11/+7
| | | | | | | | | | | | | | | ...and thus consume 4 bytes less per glyph and increase the performance a bit. It seems, the only CTFontGetAdvancesForGlyphs() returns both x and y advances, though y advances are always equal to 0 for horizontal orientation and x advances are always equal to 0 for vertical orientation. Also, rename `advances_x` to `advances` for consistency and declare QGlyphLayout's data size in a single place. Change-Id: I56b20f893f8a6feb7aa870e3edbca99dd93ba2e2 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com> Reviewed-by: Lars Knoll <lars.knoll@digia.com> Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Fix misaligned selection region with text when centeredJonathan Liu2013-10-231-5/+14
| | | | | | | | | | | | | If the text is centered, the x/y position in the selection QRectF may be a multiple of 0.5 which is rounded up. This rounding causes misalignment of the selection region with the text. The alignment is fixed by using qFloor on the x and y components. Task-number: QTBUG-34218 Task-number: QTBUG-34234 Change-Id: I4f2fadeb38602f62a93773c6e5faecf03b28069f Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com>
* Doc: Fix typos and add missing words.Marcel Krems2013-10-121-2/+2
| | | | | Change-Id: I40e4780bcabbca29425945a69d8a0781cd5c0e9f Reviewed-by: Jerome Pasion <jerome.pasion@digia.com>
* Fix broken text layout with ShowLineAndParagraphSeparatorsEskil Abrahamsen Blomfeldt2013-10-091-0/+3
| | | | | | | | | | | | | | | Before we add the current cluster we need to check if there's space for it. Calling checkFullOtherwiseExtend() also has the side effect of resetting the space data. We would add the cluster without checking for space when showing separators, causing broken behavior like we would count the space in the current item as trailing space, which would make us chop the end of the string. Task-number: QTBUG-28832 Change-Id: I8169662218ff6e645575d4e89a57f6b234f3c4cb Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com> Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Doc: Adding mark-up to boolean default values.Jerome Pasion2013-10-081-7/+7
| | | | | | | | | | | | | | | | | Default values should have mark-up to denote that they are code. This commit changes: -"property is true" to "property is \c true". -"Returns true" to "Returns \c true". -"property is false" to "property is \c false". -"returns true" to "returns \c true". -"returns false" to "returns \c false". src/3rdparty and non-documentation instances were ignored. Task-number: QTBUG-33360 Change-Id: Ie87eaa57af947caa1230602b61c5c46292a4cf4e Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com> Reviewed-by: Jerome Pasion <jerome.pasion@digia.com>
* Move QTextEngine implementation details from QTextLayoutKonstantin Ritt2013-03-191-54/+9
| | | | | | | | | | | | | | | | As of now, we'll have everything related to the additional formats handling just in a single place. Make specialData private to prevent accessing it from outside. This helped in tracking-down several related issues: - in format(const QScriptItem *), the resolvedFormatIndices can not be empty at that point, so the code path is dead; - in resolveAdditionalFormats(), testing if formats has not been indexed yet is not needed since they are indexed just in the setter; - in useRawFont mode, hasFormats() didn't check if QTextEngine really has some formats, which potentially leads to formatting artifacts. Change-Id: Id4b912888fd5a1fa83f01007170134b6386e2879 Reviewed-by: Lars Knoll <lars.knoll@digia.com> Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
* Whitespace cleanup: remove trailing whitespaceAxel Waggershauser2013-03-161-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | Remove all trailing whitespace from the following list of files: *.cpp *.h *.conf *.qdoc *.pro *.pri *.mm *.rc *.pl *.qps *.xpm *.txt *README excluding 3rdparty, test-data and auto generated code. Note A): the only non 3rdparty c++-files that still have trailing whitespace after this change are: * src/corelib/codecs/cp949codetbl_p.h * src/corelib/codecs/qjpunicode.cpp * src/corelib/codecs/qbig5codec.cpp * src/corelib/xml/qxmlstream_p.h * src/tools/qdoc/qmlparser/qqmljsgrammar.cpp * src/tools/uic/ui4.cpp * tests/auto/other/qtokenautomaton/tokenizers/* * tests/benchmarks/corelib/tools/qstring/data.cpp * util/lexgen/tokenizer.cpp Note B): in about 30 files some overlapping 'leading tab' and 'TAB character in non-leading whitespace' issues have been fixed to make the sanity bot happy. Plus some general ws-fixes here and there as asked for during review. Change-Id: Ia713113c34d82442d6ce4d93d8b1cf545075d11d Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
* Update copyright year in Digia's license headersSergio Ahumada2013-01-181-1/+1
| | | | | Change-Id: Ic804938fc352291d011800d21e549c10acac66fb Reviewed-by: Lars Knoll <lars.knoll@digia.com>