summaryrefslogtreecommitdiffstats
path: root/src/gui/text/qtextengine.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Fix assert on justification of QTextLine with only spacesEskil Abrahamsen Blomfeldt2014-04-301-1/+1
| | | | | | | | | | | | | | | | | | In the justification code, we unconditionally subtracted one from the line_length, but then compared the result to 0 afterwards, so we did not support when the line_length is 0 initially, which can happen if it only consists of spaces (in which case trailingSpaces will be non-zero and line_length will be zero.) The fix is to bail out for both strings of length 1 and length 0. [ChangeLog][Text] Fixed an assert when justifying a QTextLine which only contains spaces. Task-number: QTBUG-38520 Change-Id: Ib04993f47eb2f9f7fc49c4a5400f18f9682a72f2 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com> Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com> Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Improve the Unicode script itemization implementationKonstantin Ritt2014-04-141-16/+1
| | | | | | | | | | | | | | | | | | Make it closer to the Unicode specs (UAX#24): * Common now inherits the preceding character's script, if any; * In a combining character sequence, if the base character is of Common script, the entire sequence is treated like if it were of the first non-Inherited, non-Common script in the sequence. See http://www.unicode.org/reports/tr24/tr24-21.html for more details. [ChangeLog][QtGui] Fixed regression in arabic text rendering. Task-number: QTBUG-28813 Task-number: QTBUG-29930 (related) Task-number: QTBUG-35836 Change-Id: Id85761965b08ca94c674d5f3613fe58b82b2ce9c Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com> Reviewed-by: Ahmed Saidi <justroftest@gmail.com>
* Make HarfBuzz-NG the default shaper on MacKonstantin Ritt2014-04-141-0/+2
| | | | | | | | | | | | | | | | | For AAT shaping support, we need either the pre-QPA shaping trick or the new HarfBuzz on Mac; prefer the latter. Disable some test cases aimed to test the HB-old behavior; enable ones that should guarantee shaping-unaware behavior. [ChangeLog][OS X] Use CoreText text shaping engine for support of complex scripts. If required, the shaping engine used in previous versions can be preferred by configuring Qt with -no-harfbuzz. Alternatively, the QT_HARFBUZZ environment variable could be set to "old". Task-number: QTBUG-18980 (relates) Task-number: QTBUG-38246 Change-Id: Iee6fe4f5bc047e77259182b8585385c5febd02b3 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
* QTextLayout: Fix cursor movement from invalid positionKonstantin Ritt2014-04-041-6/+9
| | | | | | | | 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>
* Optimize QTextEngine::insertionPointsForLine() a bitKonstantin Ritt2014-04-041-0/+3
| | | | | | | Reserve the insertionPoints vector capacity prior to multiple append()-s. Change-Id: I97ab5b2a1add9f2e87c04ad0707bf516c13ff4d7 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* QTextLayout: Fix visual cursor movement in some casesKonstantin Ritt2014-04-041-12/+8
| | | | | | | | | | | | | | | | To guarantee proper positioning at the end of the last line in a bidirectional text we have to insert the eol position into the insertion points vector, accordingly to the visual ordering. Detection of the last *logical* item in a *visual* line is unrelaed to the text direction, it is simply `iterator.item == iterator.lastItem`. [ChangeLog][QtGui][QTextLayout] Fixed visual cursor movement in bidirectional text. Task-number: QTBUG-18060 (partially related) Change-Id: I53b6ab889ef580ab0560b620b808b1e09efc0fbd Reviewed-by: Lars Knoll <lars.knoll@digia.com> Reviewed-by: Ahmed Saidi <justroftest@gmail.com>
* QTextEngine: Fix visual position movement for tab and object casesKonstantin Ritt2014-04-041-8/+7
| | | | | | | | | QTextLineItemIterator::next() was never updating itemStart and itemEnd for QScriptAnalysis::TabOrObject, thus producing incorrect insertion points for the line that contains tabs and/or objects. Change-Id: Ia964c663cc0636ba6be4500702656f989b252fba Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Make QTextEngine::setAdditionalFormats() invalidate cached resultsKonstantin Ritt2014-03-171-1/+3
| | | | | | | | | ...which ensures we're not getting the formatting/rendering artefacts in case of QStackTextEngine. Change-Id: Ia0696a3e67eb866cf9776c6649c43775944edd1d Reviewed-by: Andy Shaw <andy.shaw@digia.com> Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Fix CJK languages support with HarfBuzz-NGKonstantin Ritt2014-03-101-14/+17
| | | | | | | | | By some reason, mapping to Han script doesn't work for some (most?) fonts. Until the issue is really fixed, pretend the HB-old behavior and simply map to Common script. Change-Id: I4c146f5ff2a42f64b971b2f5ebd7f65e2513fdf0 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Optimize glyph lookups with QFontEngine::glyphIndex(uint)Konstantin Ritt2014-03-051-41/+26
| | | | | | Change-Id: I56c7e727f3d9b08195f38939106620c744c6eaf0 Reviewed-by: Lars Knoll <lars.knoll@digia.com> Reviewed-by: BogDan Vatra <bogdan@kde.org>
* Make QGlyphLayout consume one byte less per glyphKonstantin Ritt2014-03-031-2/+14
| | | | | Change-Id: Iddcc2e1f284dcf13ae98b57ea2d5854e57c83530 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Hide the justification algorithm implementation detailsKonstantin Ritt2014-03-031-22/+38
| | | | | | | | | | 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>
* HarfBuzz-NG: Hide characters that should normally be invisibleKonstantin Ritt2014-02-251-0/+15
| | | | | | | | | | | These are non-ambigue NLF characters that should only imply the sctructure of the document. For details, see http://www.unicode.org/reports/tr13/ . The issue could be reproduced with use of multi-line QML Text element. Change-Id: Ibb4d5cd26bc0ac6b79a4cb549e6a3cd7633bd071 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Respect the QTextBlock's character formats in itemizationKonstantin Ritt2014-02-171-2/+5
| | | | | | | | | | | | This fixes regression introduced in f864bdaf592412 (in resolveAdditionalFormats(), formatIndex(si) returned an invalid block format index due to non-empty specialData->resolvedFormats) Task-number: QTBUG-36759 Change-Id: I4da13d2edaf1987bcd85b2ef326e9d22345eb8f3 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@digia.com> Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Merge remote-tracking branch 'origin/stable' into devFrederik Gladhorn2014-02-121-78/+50
|\ | | | | | | | | | | | | | | | | | | Conflicts: src/gui/image/qimage.cpp src/gui/text/qtextengine.cpp src/plugins/platforms/linuxfb/qlinuxfbscreen.cpp src/printsupport/kernel/qprintengine_win.cpp Change-Id: I09ce991a57f39bc7b1ad6978d0e0d858df0cd444
| * Minor optimization for QTextEngine::shapeText()Konstantin Ritt2014-02-111-43/+36
| | | | | | | | | | | | | | | | | | | | Remember the engine index for each sub-item and avoid moveGlyphData() where possible (ie. when there are no glyph indexes to care about). Also don't memmove data we didn't ever initialize. Change-Id: Ib8e5fd937a10e4e3c8c0e18961a2e2c1a4167924 Reviewed-by: Ahmed Saidi <justroftest@gmail.com> Reviewed-by: Lars Knoll <lars.knoll@digia.com>
| * Fix log_clusters calculation in HarfBuzz-NG code pathKonstantin Ritt2014-02-111-37/+16
| | | | | | | | | | | | | | | | | | | | | | | | The old code wasn't good enough to catch all the glyph (de)composition cases, thus leading to an assertion in QTextLayout's addNextCluster() helper. The new code catches all the corner cases and introduces somewhat better performance to the HB-NG shaper backend. Change-Id: I5b6c673395a4a039dc55b200abbf74b0ba5d0829 Reviewed-by: Ahmed Saidi <justroftest@gmail.com> Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* | Merge "Merge remote-tracking branch 'origin/stable' into dev" into ↵Frederik Gladhorn2014-02-111-1/+3
|\ \ | | | | | | | | | refs/staging/dev
| * | Merge remote-tracking branch 'origin/stable' into devFrederik Gladhorn2014-02-071-1/+3
| |\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/gui/kernel/qguiapplication.cpp src/plugins/platforms/android/androidjnimain.cpp src/plugins/platforms/android/qandroidplatformintegration.cpp src/plugins/platforms/android/qandroidplatformintegration.h src/plugins/platforms/android/qandroidplatformopenglcontext.cpp src/plugins/platforms/cocoa/qcocoawindow.h src/plugins/platforms/cocoa/qcocoawindow.mm src/plugins/platforms/xcb/qxcbconnection_xi2.cpp src/sql/doc/src/sql-driver.qdoc src/widgets/widgets/qtoolbararealayout.cpp Change-Id: Ifd7e58760c3cb6bd8a7d1dd32ef83b7ec190d41e
| | * Fix access after delete with Harfbuzz NG code path.Allan Sandfeld Jensen2014-02-031-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | Remove reference to released font-engine so we don't risk returning it later. Change-Id: I741a741567a079818c7f414ac1f9c0b5a9677322 Task-number: QTBUG-36522 Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
* | | Optimize stringToCMap() usageKonstantin Ritt2014-02-071-23/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | CMAP guarantees there is 1:1 mapping between the Unicode code points array and the glyph indexes array, which means the QString length always greater than or equal to a sufficient glyph indexes array length. Simply add some asserts and improve the memory consumption and the performance where possible. Change-Id: I0bc8cdba5f86c1c0ba9e79c8d5f96cbe56ec463e Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* | | Get rid of SpecialData::addFormatIndicesKonstantin Ritt2014-02-061-45/+27
| | | | | | | | | | | | | | | | | | | | | | | | and rename SpecialData:: resolvedFormatIndices to resolvedFormats. Instead, resolvedFormats now stores QTextCharFormat shared copies. Change-Id: I4a22cb3f5679b980ef52d47e4e1935663dd257ea Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* | | Fix japanese text rendering with Harfbuzz-NGKonstantin Ritt2014-02-061-2/+12
|/ / | | | | | | | | | | | | | | In rendering, treat (Hiragana|Katakana|Han)+ sequence like Han. Task-number: QTBUG-36066 Change-Id: I3b5d2833e73431b07fa0df859b5d716357374cf4 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* | Fix character mirroring issue with HarfBuzz-NGKonstantin Ritt2014-02-041-4/+2
| | | | | | | | | | | | | | | | | | | | HarfBuzz-NG does character mirroring where appropriate. A simple solution is to unset RightToLeft shaper flag when text gets shaped with HB-NG. Instead, move the mirroring code right to HB-old proxy function and decrease code duplication. Change-Id: Icdcd50b73b3e6a43da4b85addc7d8f51edf86512 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* | Make HarBuzz-NG the default shaper on MacKonstantin Ritt2014-01-311-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since we dropped all platform-related shapers during the QPA refactoring, thus making HarfBuzz the only shaper on all platforms, we can not deal with AAT-capable fonts anymore. HarBuzz-NG now supports it's own shaper backend infrastructure, so the decision was to enable HB's CoreText shaper backend on Mac and simply make HB-NG the default shaper there. Task-number: QTBUG-36056 Change-Id: If22e24fd5cc00c25952934332a2f4123f38135a4 Reviewed-by: Lars Knoll <lars.knoll@digia.com> Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
* | Get rid of QGlyphLayout::advances_yKonstantin Ritt2014-01-301-23/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ...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>
* | Introduce QChar::JoiningType enum and QChar::joiningType() methodKonstantin Ritt2014-01-291-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This aimed to disctinct joining types "L", "T", and "U" from just "U". Unicode 6.3.0 has introduced a character with joining type "L" and Unicode 7.0 will add a few more characters of joining type "L", so we'll have to deal with it anyways. [ChangeLog][QtCore][QChar] Added JoiningType enum and joiningType() method that deprecates the old QChar::Joining enum and joining() method. Change-Id: I4be3a3f745d944e689feb9b62d4ca86d1cf371b0 Reviewed-by: Lars Knoll <lars.knoll@digia.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Update the Unicode Data and Algorithms up to Unicode 6.3.0Konstantin Ritt2014-01-141-9/+7
|/ | | | | | | | | | | | | | | | | | | | * Mongolian and Phags-pa characters have been given a Joining_Type classification for contextual shaping. As a part of these additions, one Phags-pa character has the Joining_Type value of L (Left Joining), which no character had been assigned before. * The unassigned code points in the Currency Symbols block have been given the Bidi_Class property value ET and the Line_Break property value PR, to help implementations support new currency symbols, when they are encoded. * Hebrew letters and basic punctuation marks have been assigned the newly introduced Word_Break property values Hebrew_Letter, Single_Quote, and Double_Quote. * The Bidi_Class property has been extended with four new values for directional isolates. For more details, see http://www.unicode.org/versions/Unicode6.3.0/ Change-Id: Iad62d02edc58a8497898dcd6d6c70d5aece317ea Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* REG: Fix support for strings spanning multiple font enginesEskil Abrahamsen Blomfeldt2014-01-031-1/+1
| | | | | | | | | | | | | | | | E.g. in the case where the first char in a font got a font engine index != 0, and the second character got font engine index == 0, we would not count the second character as a separate glyph run. The result would be that its glyph indexes would refer to font #0, but the font used to render them would be the same as for the first character, i.e. random. Task-number: QTBUG-35740 [ChangeLog][Text][QTBUG-35740] Fixed regression when shaping some strings containing characters from multiple fonts. Change-Id: I668804045c8b276787c7b256bc87916c467f3f59 Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
* Fix build with HarfBuzz-NG older than 0.9.20Konstantin Ritt2013-12-171-1/+1
| | | | | | | | It is annoying that HB maintains binary compatibility but does not really care about source compatibility. Change-Id: Ife7b011919f28527b77858ad8398fe723c65b1b3 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Fix build with -WerrorKonstantin Ritt2013-12-171-1/+1
| | | | | Change-Id: I2fe4b006dc0696e5491792846bdb8c99ac31af6e Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* QTextEngine: fix layouting of inline objects in right-aligned tabs.David Faure2013-12-051-0/+4
| | | | | | | | | | | (same thing for center- and delimiter-aligned tabs) The width of the inline object wasn't taken into account, the code in QTextEngine::calculateTabWidth only looked at glyph widths. Change-Id: I303a6561c67870ff2094a685698e642fc1b53b12 Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com> Reviewed-by: Allan Sandfeld Jensen <allan.jensen@digia.com>
* Fix finding cursor position in words with accentsJoshua Grauman2013-10-301-3/+3
| | | | | | | | | | | | | | In positionInLigature() we were mixing indexes into the script item with indexes into the entire string. The getClusterLength() function would expect an attributes array for the current script item and it thus needs to be adjusted by si->position. In addition, when looking for the next grapheme boundary, we were comparing pos (which indexed the string) with end (which indexed the script item). This has also now been fixed by adjusting for si->position as well. Task-number: QTBUG-30123 Change-Id: Id02e2eddcc5b7888eacb34bd1e39cc6911880ca1 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
* Use QAtomicInt ref/deref patternAllan Sandfeld Jensen2013-10-111-1/+2
| | | | | | | Change check of QAtomicInt::load with the preferred ref() deref() pattern. Change-Id: I12d2e24812259c16623c8a59cac30cafa4b05565 Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
* Memory leak with Small-caps QRawFontAllan Sandfeld Jensen2013-10-111-0/+4
| | | | | | | | | | | | | | | Make sure we deallocate the scaled rawfont, when it is not used due to a cached engine being used instead. This fixes a major memory leak in Qt WebKit when using Small Caps in the complex font path. The complex font path is always used for small caps since Qt 5.1. Task-number: QTBUG-33576 Change-Id: I500db9ae6f6576734f1a972387a1a488218a9db6 Reviewed-by: pierre.rossi@digia.com Reviewed-by: Pierre Rossi <pierre.rossi@gmail.com>
* Remove some qBinaryFind usages from QtGuiGiuseppe D'Angelo2013-09-231-1/+4
| | | | | | | | This is done per the mailing list discussion at http://www.mail-archive.com/development@qt-project.org/msg01603.html Change-Id: Iecb921cd778571d24680254566e9aa8fc8d5edff Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com>
* Fix QTextEngine build on MSVC2008 debug mode.Nicolás Alvarez2013-09-151-0/+1
| | | | | | | | | | | This was broken in 7ac6ce21 which removed some unused functions; but MSVC2008 in debug mode requires this particular operator overload. I'm re-adding it in an appropriate #ifdef so it doesn't cause "unused" warnings in other platforms/compilers. Task-number: QTBUG-33473 Change-Id: I6dfba0fa5f835e848e8a1e4213efb030fb5def3d Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
* Add HarfBuzz-NG supportKonstantin Ritt2013-09-081-1/+175
| | | | | | | | | | | | | | | | | 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::shapeText(): Better error handling for corner casesKonstantin Ritt2013-09-081-4/+4
| | | | | | | | | Use Q_UNREACHABLE() instead of silly return to catch shaping errors, which are fatal ones in fact, since the application would assert/crash some later due to a hard dependency on the shaping result. Change-Id: Ie58a2f2686a795f6178a588de6f2a2e37e1ed13c Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* QTextEngine::shapeTextWithHarfbuzz() code simplificationKonstantin Ritt2013-09-081-65/+68
| | | | | | | | | | | | 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>
* Remove deprecated QtAlgorithms calls from QtGuiGiuseppe D'Angelo2013-09-051-4/+4
| | | | | | | | QtAlgorithms is getting deprecated, see http://www.mail-archive.com/development@qt-project.org/msg01603.html Change-Id: I324ddf6129fe8884ecea97ef47abb7c071dfb34c Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com>
* Fix ICC warnings about functions declared but not usedThiago Macieira2013-09-041-1/+0
| | | | | | | | | | | | | | | Added Q_DECL_UNUSED for the function used in Q_ASSERT; removed the functions that really weren't used and added the #ifdef for the function that was only used under #ifdef. qmetaobjectbuilder.cpp(93): warning #177: function "priv" was declared but never referenced qobject.cpp(2349): warning #177: function "check_and_warn_compat" was declared but never referenced qpathsimplifier.cpp(141): error #177: function "<unnamed>::Rational::isValid" was declared but never referenced qtextengine.cpp(2584): error #177: function "<unnamed>::QScriptItemComparator::operator()(const QScriptItem &, const QScriptItem &)" was declared but never referenced Change-Id: I89a140d59211f10ecd88d751f0bcc0ea2fedff7f Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com> Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* Improve QTextEngine::elidedText() in TextShowMnemonic modeKonstantin Ritt2013-04-021-4/+5
| | | | | | | | | | Check if the sequence is really a mnemonic and emulate grapheme cluster if so, rather than blindly reset the next character's attributes. This covers cases like "& ", "&<U+034F>", etc. Change-Id: Ibb063a2d258aff6455b9bb41bbe1a58a5036d0d6 Reviewed-by: Lars Knoll <lars.knoll@digia.com> Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
* Improve shapeTextWithHarfbuzz() logic a bitKonstantin Ritt2013-04-011-84/+62
| | | | | | | | | | | * 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-39/+45
| | | | | | | | | | 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>
* Fix the font engines leakingKonstantin Ritt2013-03-201-5/+2
| | | | | | | | | | | | | | | 1. when there were some engines with ref > 1 in the cache, prior to calling QFontDatabase::{add,remove}ApplicationFont()/removeAllApplicationFonts() (QFontCache::clear() has never decreased engine's cache_count); 2. when the QFontEngineData's engine is not in cache i.e. the Box or Test font engine (~QFontEngineData() didn't free engines it keeps). Instead of using the font engine's (external) "cache_count" counter, QFontCache now references a given font engine every time it is inserted to the cache and dereferences exactly that number of times in clear(). Change-Id: I87677ebd24c1f4a81a53526f2e726e596b043c61 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Move QTextEngine implementation details from QTextLayoutKonstantin Ritt2013-03-191-29/+71
| | | | | | | | | | | | | | | | 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>
* QTextEngine capitalization doesn't work with QRawFontAllan Sandfeld Jensen2013-03-141-2/+3
| | | | | | | | | The capitalization settings is attempted read via specialData->addFormats, but the QTextCharFormat there is reset when added, and should instead be accessed through specialData->addFormatIndices. Change-Id: I190c419f07c3f7e803ca1d44059e8f538216b9ab Reviewed-by: Pierre Rossi <pierre.rossi@gmail.com>
* Move Unicode script itemization code from text engine to UnicodeToolsKonstantin Ritt2013-03-141-6/+10
| | | | | | | | | | | This is still the same trivial implementation with the only difference in that that it properly handles surrogate pairs and combining marks. This temporarily makes QTextEngine::itemize() insignificatly slower due to using intermediate buffer, until refactoring is done. Change-Id: I7987d6306b0b5cdb21b837968e292dd70abfe223 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
* QTextEngine::itemize(): Minor optimizationKonstantin Ritt2013-03-131-1/+1
| | | | | | | | | Avoid using script_to_hbscript() in generateScriptItems()'s loop. This is absolutely unnecessary due to hbscript_to_script(script_to_hbscript(..)) in QTextEngine::itemize(). Change-Id: I44e710d010f8e57043a6c74dd80f3164e95e18e6 Reviewed-by: Lars Knoll <lars.knoll@digia.com>