summaryrefslogtreecommitdiffstats
path: root/src/gui/text
Commit message (Collapse)AuthorAgeFilesLines
* QTextLayout: Fix cursor movement from invalid positionKonstantin Ritt2014-04-042-7/+13
| | | | | | | | 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>
* [HB] Ensure we always working with non-multi font engineKonstantin Ritt2014-04-042-4/+9
| | | | | Change-Id: If88385d4cecdc527b7952d34e48f7ba889173c6c Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Fix QFontCache::Key comparison for custom font fallbacks caseKonstantin Ritt2014-03-311-1/+1
| | | | | | | Just a C&P typo, of course we have to compare lists, not their sizes. Change-Id: I40542035b87f5bb8d75207cb02c0826cc3a2a413 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Drop dead codeKonstantin Ritt2014-03-311-4/+1
| | | | | | | The QFontEngineMulti's `base` font engine always non-null. Change-Id: I5092b66bc839a6a3216ffa0b0afe55a8b62be620 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Deprecate QFont::setRawName() and QFont::rawName()Sergio Ahumada2014-03-272-2/+6
| | | | | | | | | | | | | | We don't support xlfd fonts anymore and indeed QFont::setRawName() is an empty method. [Changelog][QtGui] QFont::setRawName() and QFont::rawName() are deprecated. Change-Id: Ic52d42a9bc200ba8b246dd4e28c77f84e086dad5 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@digia.com> Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com> Reviewed-by: Simon Hausmann <simon.hausmann@digia.com> Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
* Fix typos in QFont documentation.Mitch Curtis2014-03-271-2/+2
| | | | | | Change-Id: I0e8de5b47ec7b64719f875eecc46cc8ef009642b Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com> Reviewed-by: Jerome Pasion <jerome.pasion@digia.com>
* Android: Fix font mergingEskil Abrahamsen Blomfeldt2014-03-251-1/+1
| | | | | | | | | | | | | Our fallback fonts would contain a minimal list of hardcoded fallback fonts, which is neither sufficient for displaying all text, nor portable to different vendors which can supply different font sets. [ChangeLog][Android] Fixed font merging problem which caused e.g. missing glyphs for Arabic numerals. Task-number: QTBUG-37738 Change-Id: Ic971343a1cd5610c79a81f6f6152c637937b5626 Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
* Fix grammar in QFontInfo::styleName() doc.Mitch Curtis2014-03-251-1/+1
| | | | | Change-Id: I673ecc8931f4824dc4fb923056354cfd2e119e40 Reviewed-by: Jerome Pasion <jerome.pasion@digia.com>
* [HarfBuzz-NG] Optimize Unicode de-/composition callbacksKonstantin Ritt2014-03-251-33/+26
| | | | | | | Use QStringIterator instead of QString::toUcs4() and escape earlier. Change-Id: If80b886bece1a43af7078e8cdc9c31babf602731 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Teach font database to populate families lazilyTor Arne Vestbø2014-03-203-26/+99
| | | | | | | | | | | | | | | | | | | | | | Instead of requiring that QPlatformFontDatabase::populateFontDatabase() populates every single font in the system by calling registerFont(), we now allow the platform database to call registerFontFamily() instead, and then keep track of which families we've yet to fully populate in the font database. Once a property of a family is requested (such as its writing system, style, etc), the family is lazily populated by calling back to the platform database through QPlatformFontDatabase::populateFamily(), which in turn does the final call to registerFont() as before. This cuts application startup on OS X and iOS (of which the font population used to be a major limiting factor) from roughly one second to about 350ms. Task-number: QTBUG-37165 Change-Id: Ic2fc3447beb818ffe23635a5b7816ed7e70c93a7 Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com> Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com> Reviewed-by: Simon Hausmann <simon.hausmann@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>
* Merge remote-tracking branch 'origin/release' into stableFrederik Gladhorn2014-03-171-1/+1
|\ | | | | | | | | | | | | | | | | Conflicts: src/gui/painting/qdrawhelper.cpp src/gui/painting/qdrawhelper_avx.cpp src/gui/painting/qdrawhelper_x86_p.h Change-Id: I09352d05119f6fd000319074a2705b38361b2c90
| * CSS parser: fix the pseudo-classes array lengthGiuseppe D'Angelo2014-02-261-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The pseudoclass array is declared with length "NumPseudos - 1", but the declaration has actually 44 elements, not 45. This caused a zero-initialized last element to be silently appended to the array. The zero-initialized element broke the sorting of the array, which in turn broke std::lower_bound usage (although of course the problem was there from before switching to the standard library algorithms). Task-number: QTBUG-36933 Change-Id: I8a02891fc36761b6ae72d15a0a8d6c6a96813947 Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* | Fix rendering of grayscale antialiased FT fonts on QGLWidgetAllan Sandfeld Jensen2014-03-151-4/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | QFontEngineFT::alphaMapForGlyph and QFontEngineFT::alphaRGBMapForGlyph has been broken since change#65694. They always fall back to using the path rendering of QFontEngine because we zero the scoped pointer just before testing it. To fix it we need to release the scope pointer after we are done using it. Change-Id: I8811c1f5261f286f2f3dd3c0f93c988ba0909669 Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
* | Prevent DrawTextItemDevice::metric warning on MacMorten Johan Sørvig2014-03-151-0/+3
| | | | | | | | | | | | | | | | Implement PdmDevicePixelRatio. Task-number: QTBUG-36419 Change-Id: I4d2822d01e08c80e9b829d5f524e8e761e694fba Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@digia.com>
* | Build bundled HarfBuzz-NG outside QtGuiKonstantin Ritt2014-03-141-1/+1
| | | | | | | | | | | | | | | | | | Being a part of QtGui, HarfBuzz-NG breaks build with -Werror. Instead of disabling a particular warnings-as-errors, build a prefixed static library and make it a link-time dependency. Change-Id: Id0be1f0e0034092d50f83cd364d5c65940fee869 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* | Ensure that QGuiApplication is inited before using QFontDatabaseTor Arne Vestbø2014-03-131-0/+3
| | | | | | | | | | | | Change-Id: I494c4fdfa49139316efac0f68f8d463c02056372 Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com> Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* | Fix custom font substitution list supportKonstantin Ritt2014-03-112-8/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | During the QPA refactoring, the custom font substitution list support was lost by ignoring the font request's fallbackFamilies member when the multi font engine gets created/initialized. If fallbackFamilies is not empty, it should be prepended to the font database default fallback families list. Also respect the custom fallback families list in the cache key to avoid picking a multi font engine with wrong fallbacks list. Task-number: QTBUG-36628 Change-Id: Ie2b84b3a397bee4816f421cddf76a5375829f13a Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com> Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* | Guarantee QPFDB::fontEngine() always return non-multi font engineKonstantin Ritt2014-03-111-5/+4
| | | | | | | | | | | | | | | | | | | | After QPA refactoring, QWindowsFontDatabase::fontEngine() was returning a multi font engine w/o any particular reason. This makes the code more obvious and opens the road to further improvements. Change-Id: I4858026ddf774d3159c89357b1c905f5112b1c51 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@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>
* | Use QStringIterator instead of homebrewKonstantin Ritt2014-03-104-44/+24
| | | | | | | | | | | | | | Task-number: QTBUG-15664 Change-Id: I1ed3eb04ddd822e57a4d993af656dfe283f3af1a Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* | QFontEngineQPA: Get rid of unused externalCMapKonstantin Ritt2014-03-082-17/+6
| | | | | | | | | | | | | | It seems to be a leftover after dropping the QPF1 font engine. Change-Id: If8d3e1447fab9d042a85195d7bdb4d9811c37c6e Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* | Make QFontEngineQPA report the TT 'cmap' table supportKonstantin Ritt2014-03-081-4/+8
| | | | | | | | | | | | | | The QPF2 CMap is identical to the TrueType CMap table format. Change-Id: I8c34d7c6a5942375538f3b8cb71d5a808b4fb400 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* | Improve code readabilityKonstantin Ritt2014-03-081-4/+3
| | | | | | | | | | | | | | | | Since we were requesting a multi font engine, the returned font engine must be a multi one or nothing at all. Change-Id: I1ee4e1b7c68f54c83a8c7292082d015ebfa0a8cb Reviewed-by: Pierre Rossi <pierre.rossi@gmail.com>
* | Prevent repeated and unnecessary font population QCoreTextFontDatabaseTor Arne Vestbø2014-03-053-0/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The platform font database is populated from QFontDatabase, through the static initializeDb() function, whenever the font database determines that the platform database has not been initialized (by checking if the font database is empty). There are other clients of QPlatformFontDatabase though, such as QFont, which uses the platform font database to check for the default family. The CoreText implementation of determining the default family relies on data that is computed during font population, and hence does an internal (self-triggered) populate. To prevent repeated populates as a result of calling QFont::defaultFamily() we guard the populate by a similar isEmpty() check as QFontDatabase does, but to ensure that this check works in the case of an invalidated font database, we need to propagate the font database invalidation down to the platform font database. Change-Id: I8d06c6f6fc5da6353c087335859eaca008c2f6a6 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
* | Make QFontEngine::type() non-virtualKonstantin Ritt2014-03-056-37/+27
| | | | | | | | | | Change-Id: I24ece90d6d8f96dad0c41a474a491b4ea96d97c3 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* | Get rid of QFontEngine::name()Konstantin Ritt2014-03-055-20/+4
| | | | | | | | | | | | | | | | It was only used in QFontCache debug output, and some engines weren't even report a name. Change-Id: I6cec4b75f105f5a4e1405f50188bebb3a3f04e33 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* | Optimize QFontEngineMulti::stringToCMap() in case of missing glyphsKonstantin Ritt2014-03-051-15/+7
| | | | | | | | | | | | | | | | | | Use recently introduced glyphIndex() method and only recalc advances if the glyph is present in the font. This allows to avoid restoring the old advance when the glyph was not found in the fallback fonts. Change-Id: I3e0aa549961767e5448816327328101cf6a78873 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* | Optimize glyph lookups with QFontEngine::glyphIndex(uint)Konstantin Ritt2014-03-058-264/+62
| | | | | | | | | | | | Change-Id: I56c7e727f3d9b08195f38939106620c744c6eaf0 Reviewed-by: Lars Knoll <lars.knoll@digia.com> Reviewed-by: BogDan Vatra <bogdan@kde.org>
* | Merge qfontdatabase_qpa.cpp with qfontdatabase.cppTor Arne Vestbø2014-03-042-475/+416
| | | | | | | | | | | | | | | | | | There's no point in separating them anymore, and it just makes editing and reasoning about the QFontDatabase code harder. Change-Id: I6bc8cb5e5daac26293e75553639e4a4d34eba3bd Reviewed-by: Simon Hausmann <simon.hausmann@digia.com> Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
* | Disable 'gsub' table check for AAT fonts on MacKonstantin Ritt2014-03-041-0/+9
| | | | | | | | | | | | | | In AAT fonts, 'gsub' table is effectively replaced by 'mort'/'morx' table. Change-Id: Ifa044c8e28c3f2aab0f57ba5e3e6b99ada84d37c Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* | Introduce a generic QFontEngine::canRender() implementationKonstantin Ritt2014-03-036-56/+17
| | | | | | | | | | | | | | | | ...which uses the recently introduced glyphIndex() method; get rid of re-implementations that did almost the same. Change-Id: I6d32d2cee6a31f57de6aee05ed8d120d4a1f4e9c Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* | Introduce QFontEngine::glyphIndex(uint)Konstantin Ritt2014-03-036-0/+83
| | | | | | | | | | | | | | | | | | ...an optimized drop-in replacement for the code like this: `stringToCMap(&uc, 1, &g, &numGlyphs, QFontEngine::GlyphIndicesOnly)` (aka "get the glyph index for exactly one Unicode character"). Change-Id: I22babf49f7cf28892d27533a5ac51ad449779f75 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* | Unify QFontEngine*::stringToCMap() behaviorKonstantin Ritt2014-03-033-0/+3
| | | | | | | | | | | | | | | | Ensure the params are valid and make QCoreTextFontEngine::stringToCMap() handle the unsufficient buffer case exactly like the other engines does. Change-Id: I078af37da917cf2bac709b12aa827ed4128e5f30 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* | Fix QFontEngineQPA::recalcAdvances() in case of missing glyphKonstantin Ritt2014-03-031-3/+1
| | | | | | | | | | | | | | | | Modifying the glyph indexes array in recalcAdvances() could lead to undefined behavior. Change-Id: Ibbb6642f381a5fe01b285dc8d2001c167dc66f46 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* | Make QGlyphLayout consume one byte less per glyphKonstantin Ritt2014-03-032-18/+23
| | | | | | | | | | Change-Id: Iddcc2e1f284dcf13ae98b57ea2d5854e57c83530 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* | Hide the justification algorithm implementation detailsKonstantin Ritt2014-03-032-43/+45
| | | | | | | | | | | | | | | | | | | | 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>
* | Fix retreiving the 'head' table in QPAGeneratorKonstantin Ritt2014-03-021-5/+3
| | | | | | | | | | | | | | | | | | The 'head' table is usually of 54 bytes length. Passing the buffer of 4 bytes capacity for the 'head' table is expected to return false, thus skipping the FontRevision tag in QPAGenerator::writeHeader(). Change-Id: I02c0b13f3cbf13579a845fe78fcbc8a437ae22bf Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* | Unify QFontEngine::getSfntTableData() behavior on all platformsKonstantin Ritt2014-03-024-5/+23
| | | | | | | | | | | | | | | | | | | | | | | | Being a most significant method in the font API, getSfntTableData() must behave in exactly the same way on all platforms. Briefly, it must return true if the table exists in the font, despite the other params, and always stores the table data length in 'length' param, thus reporting the amount of bytes actually needed to store the table data in a buffer. Change-Id: I7a15465020c1ea818ea46a05ea3b9b7e1cd60d14 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* | Merge "Merge remote-tracking branch 'origin/release' into stable" into ↵Frederik Gladhorn2014-02-271-51/+53
|\ \ | | | | | | | | | refs/staging/stable
| * | Merge remote-tracking branch 'origin/release' into stableFrederik Gladhorn2014-02-241-51/+53
| |\| | | | | | | | | | Change-Id: I3199d47f7d450853032ea5aa38cd4c7c30b9a3d0
| | * Make unicode ranges in font take precedence over codepageEskil Abrahamsen Blomfeldt2014-02-191-51/+53
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Change 4b2c73b4767bcb512cbc17f65186eac5d004db07 triggered a regression on Android, because the DroidSansFallback.ttf font has codepage ranges that list Arabic as a supported codepage despite the fact that the font has no glyphs for Arabic. If a font has valid unicode ranges which does not specify support for e.g. Arabic, then the code page ranges for the same script should be ignored. [ChangeLog][Android][Fonts] Fixed support for Arabic text. Task-number: QTBUG-36789 Change-Id: I7c5a0e303fd9ed2733275814fe752ae0fb54a207 Reviewed-by: Konstantin Ritt <ritt.ks@gmail.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>
* | QTextObject: replace a use of an inefficient QList with QVectorMarc Mutz2014-02-202-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | The QTextLayout::FormatRange is larger than void* and thus should not be held in QList. Use a QVector instead. This is public, but as of yet unreleased API. Change-Id: Ie04a561b43c91c3b2befb3cac2981821f84d5f77 Reviewed-by: Lars Knoll <lars.knoll@digia.com> Reviewed-by: Gunnar Sletta <gunnar.sletta@jollamobile.com> Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
* | Fix QFontMetrics widthBernd Weimer2014-02-201-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Commit f4dd534 introduced a regression, so that QFontMetrics reported a wrong size (to be more specific width) for FreeType fonts. The calculation of glyph advances has to to reflect (rounded) integral number of pixels. This was only done when the glyph was cached. So in some cases the first call to QFontMetrics::size gave a different result than the second. This patch reverts f4dd5344fbbce257a40e014acc4e87f4773f40. The tst_QFontMetrics::same auto test only happened to work on some platforms, on BlackBerry for instance it did not. Extended the test case to make sure it works for different font sizes. Change-Id: Ia5bb9abd3ff98193c9bba048b85207672ed8d9c3 Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
* | Unify glyph format between QFontEngine and QFontEngineGlyphCacheTor Arne Vestbø2014-02-195-24/+47
| | | | | | | | | | | | | | | | | | | | | | | | Instead of the glyph cache having its own cache type that always mapped one to one to a font engine glyph format, causing confusion and needless conversions, the glyph caches now use QFontEngine's glyph format enum. This also removes the iffy use of an int for the glyphFormat in the font engines. Change-Id: I529bad5c179e004f63e152f7dcc311d298c3db98 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* | Merge remote-tracking branch 'origin/stable' into devFrederik Gladhorn2014-02-181-2/+5
|\ \ | | | | | | | | | | | | | | | | | | Conflicts: src/plugins/platforms/android/qandroidplatformtheme.h Change-Id: I541bd3069df3ab54c7942d5f4a9e155e3b6566a0