summaryrefslogtreecommitdiffstats
path: root/src/gui/text/qtextlayout.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Merge remote-tracking branch 'origin/5.12' into devLiang Qi2019-01-041-0/+4
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Also blacklist tst_QRawFont::unsupportedWritingSystem() and tst_QGlyphRun::mixedScripts() on windows for now. Conflicts: qmake/generators/makefile.cpp src/corelib/itemmodels/qstringlistmodel.cpp src/platformsupport/fontdatabases/windows/qwindowsfontengine_p.h tests/auto/corelib/itemmodels/qstringlistmodel/tst_qstringlistmodel.cpp tests/auto/gui/text/qglyphrun/BLACKLIST tests/auto/gui/text/qrawfont/BLACKLIST Task-number: QTBUG-72836 Change-Id: I10fea1493f0ae1a5708e1e48d0a4d7d6b76258b9
| * Draw ShowTabsAndSpaces symbols with the correct fontEskil Abrahamsen Blomfeldt2019-01-031-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | We would draw the tab and space symbols without setting the correct font on the painter first. [ChangeLog][QtGui][Text] Fixed so ShowTabsAndSpaces will use the correct font. Fixes: QTBUG-62540 Change-Id: I3b7d6d317473e7aab722dafe1a128c57a830f634 Reviewed-by: Andy Shaw <andy.shaw@qt.io> Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
* | QtGui: Remove unused brushes [-Wclazy-unused-non-trivial-variable]Sergio Martins2018-12-101-2/+0
| | | | | | | | | | | | Change-Id: If7e5340ec8acdfd70ea919286da5940db7a4def9 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
* | Merge remote-tracking branch 'origin/5.12' into devLiang Qi2018-11-221-3/+57
|\| | | | | | | | | | | | | | | | | | | Conflicts: src/corelib/io/qdir.cpp src/corelib/kernel/qtimer.cpp src/corelib/kernel/qtimer.h Done-With: Edward Welbourne <edward.welbourne@qt.io> Change-Id: I683d897760ec06593136d77955f8bc87fdef3f9f
| * Fix vertical alignment of inline imagesLars Knoll2018-11-191-3/+57
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Inline images can have 4 different alignments. Unfortunately, AlignTop and AlignBottom can only be set once we have laid out the whole line and know the total height of the line, as one could otherwise end up with lines that are too high. To fix this, position the images for these cases in a second loop after we have calculated the length of the line and the maximal image height in that line. Task-number: QTBUG-59310 Change-Id: I1fd4cd39e43a13d1967b9f5c9ce8270a99269cd9 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io> Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* | Fix constness of QPaintDevice argumentsLuca Beldi2018-11-191-4/+15
|/ | | | | | | | | | | | QFont, QFontMetrics, QFontMetricsF and QTextLayout constructors use only const methods of QPaintDevice so there is no reason for them to require a non-const pointer argument Fixes: QTBUG-65967 Change-Id: Ibfcdef2a25f0cd4284dad76135fc4c9bf5667d7a Reviewed-by: Samuel Gaist <samuel.gaist@idiap.ch> Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de> Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* Don't position cursor inside complex graphemes when clicking outside lineEskil Abrahamsen Blomfeldt2018-06-281-2/+1
| | | | | | | | | | | | | | | | | | | | | If you clicked to the right of a text line ended with a grapheme consisting of several characters, either because it was a unicode surrogate pair or a ligature, we would always to the previous character in logical order, without checking if this was a valid cursor position. One result of this would be that hitting backspace when the cursor was positioned in an invalid position, would cause the entire contents of the document to become invalid. Instead we should search backwards for the previous grapheme boundary using QTextEngine::previousLogicalPosition(). [ChangeLog][QtGui][Text] Fixed position of text cursor set by clicking outside the bounds of a text line that ends with a surrogate pair or ligature. Task-number: QTBUG-69085 Change-Id: I7224c065f332f398bdfbb3f42b2b3ec8280c76a4 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Show nbsps as a degree symbol to differeniate from normal spacesAndy Shaw2018-03-161-2/+3
| | | | | | | | | | | | | | When using QTextOption::ShowTabsAndSpaces then spaces and nbsps would appear the same. So since using the degree symbol to illustrate nbsps is an accepted standard, we use that and spaces are illustrated as before. [ChangeLog][QtGui] Display non-breaking spaces as a degree symbol when QTextOption::ShowTabsAndSpaces is used. Task-number: QTBUG-57479 Change-Id: I20c72c9e1640457c034b87587a8975cb73228803 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* Merge remote-tracking branch 'origin/5.11' into devQt Forward Merge Bot2018-03-021-1/+2
|\ | | | | | | Change-Id: I42ec9e6aafc203465cbeb88af70c7af26b7df8ed
| * Fix ligature handling in QTextLine::cursorToX()Lars Knoll2018-02-281-1/+2
| | | | | | | | | | | | | | | | | | | | If the script item is rtl, we need to subtract the offset inside the ligature again, as the full width of the ligature would have already been added in the loop before. Change-Id: I544ac6fa19484b35335767e1ba1befc3dfa07693 Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | QTextEngine: micro optimize insertionPointsForLineAnton Kudryavtsev2018-02-151-4/+2
| | | | | | | | | | | | | | | | | | Don't use out param, use return by value instead. Also since we don't need CoW replace QVector with std::vector Change-Id: I5b6ea286b83e2ab959b5734cc1af31cc63c06553 Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* | fix selection rendering issues if rounding leads to left-out pixelsChristoph Cullmann2018-02-151-9/+5
|/ | | | | | | | | | | | instead of manual qFloor, use the toAlignedRect() function to get the minimal enclosing rectangle this will in some cases over-paint one-pixel, which is preferable to under-paint which leaves gaps inside painting text lines that can not be fixed by the user of the painting routines Task-number: QTBUG-66036 Change-Id: I8d6c2f7370e55bd544e1ff93d5c07b554b20ffeb Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io> Reviewed-by: Dominik Haumann <dhaumann@kde.org> Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* doc: Add missing class qualifiers to uses of FormatRangeMartin Smith2018-01-121-2/+2
| | | | | | | | | struct FormatRange is contained in QTextLayout, so uses of it as parameters in friend functions of struct FormatRange must be qualified with QTextLayout:: Change-Id: I6d3ad3020240bff3b948fb571971694b44708c54 Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* Update usage of QFontMetrics::width() to new APIEskil Abrahamsen Blomfeldt2017-12-081-2/+2
| | | | | | | | | | | | | | QFontMetrics(F)::width() has been deprecated and is replaced by horizontalAdvance(). This updates all usage of it in tests and documentation. It is worth noting that many or most of the usages of QFontMetrics::width() probably intended to use boundingRect().width(), but since it currently works, I have not looked into that, just replaced the function name mechanically. Change-Id: Iec382e5bad0b50f37a6cfff841bfb46ed4d4555f Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Merge remote-tracking branch 'origin/5.9' into devLiang Qi2017-05-291-0/+6
|\ | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: .qmake.conf mkspecs/common/msvc-desktop.conf mkspecs/win32-g++/qmake.conf mkspecs/win32-icc/qmake.conf src/platformsupport/fontdatabases/mac/coretext.pri src/plugins/platforms/cocoa/qcocoawindow.h src/plugins/platforms/cocoa/qcocoawindow.mm Change-Id: I74a6f7705c9547ed8bbac7260eb4645543e32655
| * doc: Add warning about QTextLayout::beginLayout() and clearLayout()Eskil Abrahamsen Blomfeldt2017-05-221-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | If you keep around QTextLines referring to the previous contents of the layout, you can experience crashes when using these after the layout has been cleared. Since QTextLine is a value type, this is not very obvious in the API, so we should at least give a warning in the docs. Task-number: QTBUG-60804 Change-Id: I81b2b640eec5f62b0af1e878aadd9fa23654ec18 Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com> Reviewed-by: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io> Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | QTextLayout optimization: avoid calling [] when at() will doDavid Faure2017-04-051-29/+29
|/ | | | | | | | The 'lines' and 'items' containers are both declared mutable, so [] detaches even in const functions. Change-Id: I29ac74302af2fab390b3cf3f9d05ea2cace6840b Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* Merge remote-tracking branch 'origin/5.8' into devLiang Qi2016-11-171-7/+10
|\ | | | | | | | | | | | | | | Conflicts: mkspecs/features/mac/default_post.prf mkspecs/features/uikit/default_post.prf Change-Id: I2a6f783451f2ac9eb4c1a050f605435d2dacf218
| * Merge remote-tracking branch 'origin/5.7' into 5.8Liang Qi2016-11-161-2/+6
| |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: mkspecs/common/linux-android.conf src/gui/opengl/qopengl.h src/network/socket/qnativesocketengine_winrt.cpp src/network/socket/qnativesocketengine_winrt_p.h src/plugins/platforms/cocoa/qcocoawindow.mm src/plugins/platforms/eglfs/api/qeglfsintegration.cpp src/plugins/platforms/linuxfb/qlinuxfbintegration.cpp sync.profile Change-Id: If70aaf2c49df91157b864cf0d7d9513546c9bec4
| | * Merge remote-tracking branch 'origin/5.6' into 5.7Liang Qi2016-11-151-2/+6
| | |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: configure src/plugins/platforms/eglfs/qeglfsintegration.cpp src/plugins/platforms/linuxfb/qlinuxfbintegration.cpp Change-Id: Id2da7c775439adb62646d5b741ee7c638042b34b
| | | * Don't count no-break spaces as trailing spacesEskil Abrahamsen Blomfeldt2016-11-091-2/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | No-break-spaces should not be counted in the space data, but rather be treated as any other non-breakable character. We were already taking care of this in the loop we reach if the item starts with a character which isn't whitespace, but there is a second loop for items that begin with whitespace characters. The result of this was that in certain circumstances where you gave the nbsp its own format and made the line wrap, the previous line would count an extra trailing space and it would swallow the first character in its following line. [ChangeLog][QtGui][Text] Fixed a bug where a no-break space would sometimes cause the first character of the containing line to not be displayed. Task-number: QTBUG-56714 Change-Id: Idd760a389052e6de70f6cc397122b217987fa5f2 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
| * | | Improve use of QHash to minimize double hashingAllan Sandfeld Jensen2016-11-101-5/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Avoid looking up by key twice in a row in various locations, but instead using iterators and index lookup. Change-Id: I61a079115199ab9c041ad3a26d36b45ee3f775e0 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | | | Fix possible crash in calculateRightBearingForPreviousGlyph().John Preston2016-10-101-4/+6
|/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | LineBreakHelper saves previousGlyph for calculating right bearing of this glyph when it is needed. But between the saving of this glyph and the calculation the fontEngine can change (if we move to the different item). So we need to save the fontEngine together with the glyph and use this saved fontEngine for the saved glyph, while still using the current fontEngine for calculating right bearing of the current glyph. [ChangeLog][QtGui][QTextLine] Fixed a possible UB in the calculation of glyph right bearing when a QTextLine layout is performed. Change-Id: I14c729a1f761a45eaba85754c0b15a27faff7458 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* | | Merge remote-tracking branch 'origin/5.7' into devLiang Qi2016-05-031-10/+9
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: configure src/3rdparty/double-conversion/include/double-conversion/utils.h src/corelib/global/qnamespace.qdoc src/corelib/tools/qsimd_p.h tests/auto/corelib/io/qfile/tst_qfile.cpp Change-Id: I3ca1007bab5355d251c13002a18e93d81c254d34
| * | Merge remote-tracking branch 'origin/5.6' into 5.7Liang Qi2016-04-131-10/+9
| |\| | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: config.tests/unix/compile.test src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java src/testlib/qtestcase.cpp src/testlib/qtestcase.qdoc Change-Id: Ied3c471dbc9a076c8de33d673bd557e88575609d
| | * Qt Quick: Fix bug for selections with line wraps and breaksEskil Abrahamsen Blomfeldt2016-04-081-10/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This fixes yet another bug where the selection spans both line wraps and explicit line breaks. Offsetting the log clusters by the text position in 342c909b340cb1bfbb95480fc79dcea21a470c83 was not entirely correct, because in some cases the script item will refer to a specific part of the string, as indicated by si.position, while iterator.itemStart is in the context of the full string. In this case, the log cluster array pointer we use refers to the script item's part of the array, i.e. it is already offset by si.position. Therefore, we must offset the logClusters pointer by the text position *relative* to the current script item. Previously we would actually offset by si.position twice in cases where si.position != 0. We want the text range to refer to the full string, though, so it can be compared to other text ranges later. However, in some cases when we are requesting only part of a script item, then iterator.itemStart does not correspond to relativeFrom, so in order for the text range search to work, we must pass in the text positions we are using [relativeFrom, relativeTo], though offset by si.position so that it refers to the full string and not just the part addressed by the script item. Task-number: QTBUG-51759 Change-Id: Ib69856d6d3bc1dd501db94c9d295623f436d122c Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com> Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* | | Merge remote-tracking branch 'origin/5.7' into devLiang Qi2016-03-221-1/+1
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: configure mkspecs/common/wince/qplatformdefs.h src/plugins/platforms/directfb/qdirectfbbackingstore.cpp src/plugins/platforms/xcb/qxcbbackingstore.cpp Change-Id: Ied4d31264a9afca9514b51a7eb1494c28712793c
| * | 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>
* | | QTextCursor: Use RasterOp_NotDestination composition mode for drawing the cursorDmitry Shachnev2016-03-161-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This has several advantages over the current “fill the rectangle with the default text color” approach: - When the background color for some block of text is black, the cursor will be white and visible. - It is possible to set the cursor width to width of a character (for example for monospace edits), and the characters will be visible when the cursor is displayed. Change-Id: I2e6303166d5d63c8dd11ec4fcf3d734cdf440e7e Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com> Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com> Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>
* | | gui: Pass large types by const-refSérgio Martins2016-03-151-1/+1
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | sizeof: Operator : 144 QTransform : 88 QGlyphLayout : 48 QTextFrame::Iterator: 32 QRectF : 32 QCss::Value : 24 (Linux/x86_64) Change-Id: I4965bf0959683c0bc8909428fca86d66851af92c Reviewed-by: Marc Mutz <marc.mutz@kdab.com> Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.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>