summaryrefslogtreecommitdiffstats
path: root/src/gui/text/qtextengine_p.h
Commit message (Collapse)AuthorAgeFilesLines
* 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-3/+11
|\ | | | | | | Change-Id: I42ec9e6aafc203465cbeb88af70c7af26b7df8ed
| * Update the Unicode BiDi algorithm to be compliant with Unicode 10Lars Knoll2018-02-281-3/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The UBA in Qt was out of date, implementing the spec from pre Unicode 6.3 days. It missed handling of directional isolates and paired brackets. This adds a completely new implementation of the UBA, that is compliant with Unicode 10. Added the test data from Unicode 10 to the qcomplextext auto test and ensure that we pass the test suite. Task-number: QTBUG-57743 Change-Id: Ie2d957bc9775d82f0a51d1c78dc6bd154f22847c Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | Merge remote-tracking branch 'origin/5.11' into devLiang Qi2018-02-161-4/+4
|\| | | | | | | | | | | | | Conflicts: src/corelib/tools/tools.pri Change-Id: I705630f9cecbf0ce51a22fc6116b8c49611259e9
| * Merge remote-tracking branch 'origin/5.9' into 5.11Liang Qi2018-02-141-4/+4
| |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: .qmake.conf src/corelib/animation/qvariantanimation.cpp src/corelib/global/qglobal.cpp src/corelib/global/qlogging.cpp src/corelib/io/qprocess_win.cpp src/corelib/json/qjsonarray.cpp src/corelib/tools/qsimd_p.h src/corelib/tools/qtimezoneprivate_p.h src/corelib/xml/qxmlstream_p.h src/gui/kernel/qsimpledrag.cpp src/gui/kernel/qsimpledrag_p.h src/plugins/generic/generic.pro src/plugins/platforms/cocoa/qcocoamenu.mm src/widgets/styles/qmacstyle_mac.mm tests/auto/concurrent/qtconcurrentmap/BLACKLIST tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp tests/auto/gui/kernel/qwindow/BLACKLIST tests/auto/widgets/dialogs/qmessagebox/BLACKLIST Change-Id: I508d686cf20f7f8cc6a7119b9bc7c3bbb505c58e
| | * Do a static_cast in bit-blasts that are UBVille Voutilainen2018-01-251-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Without this, building Qt and Qt applications fails with GCC 8. The errors look like this: writing to an object of type ‘class QPointer<QQuickPointerHandler>’ with no trivial copy-assignment; use copy-assignment or copy-initialization instead [-Werror=class-memaccess] Task-number: QTBUG-65691 Change-Id: Ie5a30814125deca7a160b9a61f5aa3f944ee1ac9 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | | QTextEngine: micro optimize insertionPointsForLineAnton Kudryavtsev2018-02-151-1/+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>
* / QScriptItem: reduce boilerplate codeMarc Mutz2017-03-291-10/+7
|/ | | | | | | | | | | | | | | | The class does not need to be exported, as it is all-inline, and non-polymorphic. The class also does not need a default ctor, except that QVector requires it, so make the default ctor private and grant QVector friendship. Add constexpr and noexcept. Mark as primitive instead of movable. Change-Id: Ia5d11de8eb993cb080002804e11176dc5226a04c Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Use harfbuzz feature to check for HarfBuzzLars Knoll2016-11-241-1/+1
| | | | | | | instead of defining a special macro for it. Change-Id: I715380717f7d871571f663be30b73f7d95d83d71 Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
* Add qtguiglobal.h and qtguiglobal_p.hLars Knoll2016-07-031-1/+1
| | | | | | | | | | | | | | | | | | | | The new modular configuration system requires one global header per module, that is included by all other files in this module. A similar scheme and naming convention is already being used for many other modules (e.g. printsupport, qml, quick). That header will later on #include the configuration file for Qt Gui. For now it defines the Q_GUI_EXPORT macro for this library. In addition, add a private global header, qtguiglobal_p.h, that can later on include the private config header for Qt Gui for things we don't want to export to the world. Change-Id: Id9ce2a4f3d2962c3592c35e3d080574789195f24 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
* QtGui: mark more types as primitive/movableMarc Mutz2016-04-251-0/+1
| | | | | | | | | | | | These types are held in QVarLengthArrays, so benefit from being trivially relocatable. They are also part of the private API, so there's no BC issues with potential uses of these types in QList, except for QPainter::PixmapFragment, which consequently has been marked as relocatable only. Change-Id: I90fb9a19231c6f5c71c593602fc997ffafe8f047 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* Merge remote-tracking branch 'origin/5.6' into 5.7Liang Qi2016-02-241-1/+7
|\ | | | | | | | | | | | | | | | | | | | | 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
| * Disable unneeded ligatures when letter spacing is setEskil Abrahamsen Blomfeldt2016-02-191-1/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For writing systems where glyph substitutions are purely cosmetic, we should disable them when letter spacing is set, otherwise we get ligatures where the spacing is not applied. To avoid changing Harfbuzz-NG upstream, we detect this case when fetching the GSUB table and return an empty blob instead. Task-number: QTBUG-44393 Change-Id: Ie5f6b2d795d7fecbba0ece3941fb70ba7f04c395 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com> Reviewed-by: Simon Hausmann <simon.hausmann@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>
* Optimize QTextEngine::findItem() usage casesKonstantin Ritt2015-11-231-1/+1
| | | | | | | | 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>
* Insert leading after each line, not beforeUlf Hermann2015-10-091-2/+1
| | | | | | | Task-number: QTBUG-45791 Change-Id: I763d9d1ba00989d0c6b1e0b955173dadbef26b10 Reviewed-by: Stephen Chu <stephen@ju-ju.com> Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* Move min left/right bearing calculations to QFontEngine baseclassTor Arne Vestbø2015-09-021-0/+16
| | | | | | | | | | | | | | | | 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>
* QTextEngine: don't hold ItemDecoration in QListMarc Mutz2015-07-131-1/+3
| | | | | | | | | | | | | ItemDecoration is larger than a void*, so holding it in QLists is needlessly inefficient. Worse, the code could come to depend on the fragile property of (inefficient) QLists that references to elements therein never are invalidated. Fix by marking the type movable and holding in QVector instead. Change-Id: I06d7a77529f7cff2ba503c5e8d6e5df0ad801a21 Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com> Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
* QTextLayout: replace a use of an inefficient QList with QVectorMarc Mutz2015-05-291-4/+4
| | | | | | | | | | | | | | | | | | | 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-1/+0
| | | | | | | | 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>
* 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>
* 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>
* Fix menu mnemonic inside ligaturesAllan Sandfeld Jensen2014-09-181-2/+0
| | | | | | | | | | | 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>
* Decrease code duplication by reusing QTextEngine::findItem()Konstantin Ritt2014-07-081-1/+0
| | | | | | | | | Use the findItem()'s optimized binary search impl instead of a generic one. Also drop the "already shaped item" case since setBoundary() is only called from itemize(), where the items are not shaped yet. Change-Id: Ifbecdc41b2e3cb7791a7896fbb0cbea439ca0706 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Rename some QTextEngine members to reflect their meaningKonstantin Ritt2014-05-201-10/+11
| | | | | | | | | | | | | | | 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-4/+1
| | | | | Change-Id: I5c43db4e0a499ecfd23f3dac63615e7c40208f36 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
* Minor optimization for QTextLineItemIteratorKonstantin Ritt2014-05-161-7/+5
| | | | | | | | | 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>
* Make QGlyphLayout consume one byte less per glyphKonstantin Ritt2014-03-031-16/+9
| | | | | Change-Id: Iddcc2e1f284dcf13ae98b57ea2d5854e57c83530 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Hide the justification algorithm implementation detailsKonstantin Ritt2014-03-031-21/+7
| | | | | | | | | | The justification "classes" stored in the glyph attributes are actually a justification priorities suitable for a particular language (script). The external API only uses the justification metrics array calculated on top of these priorities. Change-Id: I5b0a39e35954084c63a798b632fd6108f9ae7608 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Get rid of SpecialData::addFormatIndicesKonstantin Ritt2014-02-061-3/+3
| | | | | | | | and rename SpecialData:: resolvedFormatIndices to resolvedFormats. Instead, resolvedFormats now stores QTextCharFormat shared copies. Change-Id: I4a22cb3f5679b980ef52d47e4e1935663dd257ea Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* QTextEngine: Make FontEngineCache inaccessible from outsideKonstantin Ritt2014-01-311-0/+2
| | | | | | | | This is really an implementation detail and shouldn't be accessible in any way. Change-Id: Icd9f2ea6f9a1d5ebd613ce65eebe2823301f87ea Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Get rid of QGlyphLayout::advances_yKonstantin Ritt2014-01-301-23/+14
| | | | | | | | | | | | | | | ...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>
* Remove unimplemented constructor in QTextEngineEskil Abrahamsen Blomfeldt2014-01-151-1/+0
| | | | | | | | | QTextEngine(LayoutData*) declaration seems to have been added in Qt 4.1 without an implementation. As far as I can see it has never been implemented. Change-Id: I4bbf032395f7c930c9e8d365cdbbcf47bb118d64 Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
* Add HarfBuzz-NG supportKonstantin Ritt2013-09-081-0/+3
| | | | | | | | | | | | | | | | | Some features are of limited usefulness for now (same as with HB-old): * mixed scripts cases aren't handled correctly due to an outdated script and bidi itemization implementation; * language-by-script detection: the only fallback to locale's LANG is used Some features are missing entirely (in compare to HB-old): * justification points support: not implemented in HarfBuzz-NG Task-number: QTBUG-18980 Task-number: QTBUG-14590 Task-number: QTBUG-16128 Change-Id: Ic98a10054be5fac55224ef31c7261168c0bf8739 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* QTextEngine::shapeTextWithHarfbuzz() code simplificationKonstantin Ritt2013-09-081-1/+1
| | | | | | | | | | | | Move (sub-)item boundaries calculation (aka fallback font items) outside to be shared with HarfBuzz-NG based shaping a bit later. This implementation might silently break words or even graphemes so it needs to be reworked anyways; keeping it in a single place would make futher work some cheaper. Change-Id: Id9ca82b40e90b07ca29363fd43247c5fa9897eff Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Don't allocate QGlyphLayout data, when possibleKonstantin Ritt2013-08-141-31/+0
| | | | | | | | | | | | | | | ...and operate directly on a passed array pointers, without having to copy the input and output data. Calling QFontEngine:: stringToCMap()/recalcAdvances() with partially-constructed QGlyphLayout is completely safe iff `glyphs` and `advances_?` members were initialized. Also get rid of QGlyphLayoutInstance that was used just in a single place and never was really needed. Change-Id: I48fab246fd69fc869f948220a553c3574d93c772 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Improve shapeTextWithHarfbuzz() logic a bitKonstantin Ritt2013-04-011-1/+1
| | | | | | | | | | | * Move non-specific code to shapeText(); * Make shapeTextWithHarfbuzz() re-use variables obtained in shapeText(); * Make shapeTextWithHarfbuzz() return amount of shaped glyphs instead of nothing. Right now, this is not about error reporting, since failed shaping causes assertion/crash in most cases. Change-Id: I2e0c91b9e5de8b19e0bc22ca60add1b1fc6ebdb0 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Replace HB_JustificationClass with QGlyphAttributes::JustificationClassKonstantin Ritt2013-04-011-0/+14
| | | | | | | | | | Also move stringToGlyphs() helper closer to shapeTextWithHarfbuzz(), where it is only used. As of now, Harfbuzz-old dependency in QTextEngine can be disabled by simply if-defing a single piece of code. Change-Id: Ic6f7d9b64bf9201d7540c58db46e20f28de8120d Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Move QTextEngine implementation details from QTextLayoutKonstantin Ritt2013-03-191-3/+15
| | | | | | | | | | | | | | | | 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>
* Replace HB types used in API with Qt analogsKonstantin Ritt2013-03-121-14/+28
| | | | | | | | | | hb_uint32 <-> quint32 HB_Glyph <-> glyph_t HB_Fixed <-> QFixed, HB_FixedPoint <-> QFixedPoint HB_GlyphAttributes <-> QGlyphAttributes Change-Id: I4338ec4ce9a9c20ea591606ab10e6ef4f19931b8 Reviewed-by: Lars Knoll <lars.knoll@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>
* Revert hacks in text rendering code pathEskil Abrahamsen Blomfeldt2012-10-251-1/+1
| | | | | | | | | | | | | | There are a lot of hacks here and there in Qt trying to align the text in a correct way which caused regressions to appear once the default coordinate system changed. We need to remove these hacks to get a more consistent and maintainable base. This also fixes the regression introduced by changing the aliased coordinate system. Task-number: QTBUG-27667 Change-Id: I620db2ca23b7ff6c912f3a51e86e7e36bbef81f0 Reviewed-by: Samuel Rødal <samuel.rodal@digia.com>
* Remove Qt3 compat leftoversKonstantin Ritt2012-10-191-12/+2
| | | | | Change-Id: I91c3d26125168998d6279bddb0671cfb68eac2f4 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Change copyrights from Nokia to DigiaIikka Eklund2012-09-221-24/+24
| | | | | | | | Change copyrights and license headers from Nokia to Digia Change-Id: If1cc974286d29fd01ec6c19dd4719a67f4c3f00e Reviewed-by: Lars Knoll <lars.knoll@digia.com> Reviewed-by: Sergio Ahumada <sergio.ahumada@digia.com>
* A step out from Harfbuzz (reduce dependency)Konstantin Ritt2012-09-221-2/+4
| | | | | | | | | | | | | | | | | Introduce QCharAttributes and use it instead of HB_CharAttributes everywhere in Qt (in Harfbuzz, the HB_CharAttributes is only used in the text segmentation algorithm which has been moved from HB to Qt (well, most of it)). Rename some members to better reflect their meaning, remember to keep HB_CharAttributes in sync with QCharAttributes. Also replace HB_ScriptItem with a (temporary) QUnicodeTools::ScriptItem struct that will be replaced with a more efficient/friendly solution a bit later. The soft hyphen and the mandatory break detection has been factored out of the default text breaking algorithm to a higher level in order to refactor the QCharAttributes bitfields and to optimize the implementation for the common case. Change-Id: Ieb365623ae954430f1c8b2dfcd65c82973143eec Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Optimize QTextLayout/QTextEngine usage outside of QTextDocument.Milian Wolff2012-09-051-1/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When QTextLayout is used in a QTextDocument, many code paths use special caches and thus greatly outperform the raw QTextLayout version that operates directly on a QString. This patch brings some of these optimizations also to the raw version. We now also use a QFormatCollection in such cases and enable the functionality of QTextEngine::indexAdditionalFormats() and QTextEngine::resolveAdditionalFormats(). Thanks to that, we can greatly speed up QTextEngine::format(), which now uses an amort O(1) hash table lookup instead of a O(N) linear search. The added benchmark shows a gain in the order of one magnitude: ./tst_bench_QText formattedLayout:long-many before applying the patch: 378.19 msecs per iteration (total: 37,820, iterations: 100) after applying the patch: 25.80 msecs per iteration (total: 2,580, iterations: 100) Note: This change is source-incompatible for applications using the private QTextEngine API. Task-number: QTBUG-8389 Change-Id: Ifcf7a8902a394428979ea06a6d955f886ee739c7 Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com> Reviewed-by: Olivier Goffart <ogoffart@woboq.com> Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
* Move ShaperFlags enum from QTextEngine to QFontEngineKonstantin Ritt2012-07-101-10/+0
| | | | | | | | These flags are specific to font engine(s) and has nothing to do with the text engine or the text layout. Change-Id: I4bb793c3c634b3cf0ae0a8a8c23b946fad5874b6 Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
* QTextEngine: drop unused leftoversKonstantin Ritt2012-05-081-8/+0
| | | | | | | | | qIsControlChar() doesn't handle SMP code points, it is outdated and is not used anymore; drop it Change-Id: I934ace1e44eb2652e426fccc579b563d31197fca Reviewed-by: Girish Ramakrishnan <girish.1.ramakrishnan@nokia.com> Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com>
* Fix warnings about commas at the end of enumsThiago Macieira2012-03-241-1/+1
| | | | | | | | It's non-standard to accept them, so remove them and silence the warnings. Change-Id: I51c5afe99eac408f326ab9fcf40435b60e953b54 Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
* Line up underlines if fallback fonts are used (QTBUG-21832)Stefan Hundhammer2012-03-121-0/+32
| | | | | Change-Id: Icecc514f6c47c0576af8cabd39cdc0987f8d93fa Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com>