summaryrefslogtreecommitdiffstats
path: root/src/gui/text
Commit message (Collapse)AuthorAgeFilesLines
* Merge remote-tracking branch 'origin/stable' into devFrederik Gladhorn2013-01-2288-88/+88
|\ | | | | | | | | | | | | | | | | | | Conflicts: src/corelib/io/qsavefile_p.h src/corelib/tools/qregularexpression.cpp src/gui/util/qvalidator.cpp src/gui/util/qvalidator.h Change-Id: I58fdf0358bd86e2fad5d9ad0556f3d3f1f535825
| * Update copyright year in Digia's license headersSergio Ahumada2013-01-1890-90/+90
| | | | | | | | | | Change-Id: Ic804938fc352291d011800d21e549c10acac66fb Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* | Add support for retina glyph-based text drawing in the GL paint-engineTor Arne Vestbø2013-01-211-0/+1
| | | | | | | | | | | | | | | | | | | | Instead of always using a non-transformed glyph-cache we now allow a scaled glyph-cache so that retina-screens can take advantage of this. We take the cache's scale into account when positioning and drawing the glyphs so that the scale is not applied twice. Change-Id: Ia927656f0070df61e78da76e97d2c49de4d856d9 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
* | Merge remote-tracking branch 'origin/stable' into devFrederik Gladhorn2013-01-161-1/+2
|\| | | | | | | | | | | | | Conflicts: src/widgets/styles/qstyleanimation.cpp Change-Id: Iae570895be6544de80f9c1ec309d1a08c59daff8
| * Fix crash when trying to create paths for color-glyphs (Emoji) on MacTor Arne Vestbø2013-01-141-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | CoreText segfaults when creating paths for color-glyphs: 0 0x00007fff8fd41e69 in TFont::FindColourBitmapForGlyph () 1 0x00007fff8fd417ac in TFont::CreatePathForGlyph () 2 0x000000010567d1af in QCoreTextFontEngine::addGlyphsToPath (...) So we shortcut the code-path, since we don't support Emoji yet anyways. Task-number: QTBUG-28615 Change-Id: Ife16ae4959077d9eaaf6ea5cd1f27a4e2e01e7f5 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
* | Fix regression in perspective-transformed textEskil Abrahamsen Blomfeldt2013-01-111-1/+1
| | | | | | | | | | | | | | | | | | | | | | Change 8927084d0acfea2bb3fc8a932069c1d5ceb001d0 made a mistake in reversing the boolean logic of the type >= TxProject logic, causing us to try to use the font engine for perspective transformations instead of falling back to QPainterPath. Change-Id: Ideb59751ace23ab83f8ebd4f02dbe6c1724644a5 Reviewed-by: aavit <eirik.aavitsland@digia.com> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@digia.com>
* | Refactor paint/font-engine shouldDrawCachedGlyphs and supportsTransformationsTor Arne Vestbø2013-01-102-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Some cruft had built up over time, and this is an attempt at cleaning up the naming and use of these functions, and should not have any behavioral effects. The function supportsTransformations() has been renamed in QPaintEngineEx to reflect its use, which is to decide if QPainter needs to pre-transform the coordinates of the static text before asking the paint-engine to draw it. The new name is requiresPretransformedGlyphPositions(). The OpenGL and CoreGraphics (Mac) paint engines keep their behavior of not needing pre-transformed text, while the raster engine needs this when using cached glyphs. The base-class implementation assumes that all transforms that include a projection will need pre-transform, which is also the case for the raster engine. All decisions in the paint engines about whether or not to use the glyph cache when drawing text are now deferred to the function shouldDrawCachedGlyphs(), which has been refactored for the GL paint engine(s) to share more logic. All implementations call the base class implementation, which ensures that large font sizes will not be cached. The raster engine will in addition ask the font engine whether or not it can produce glyphs for the glyph-cache with the given transform. This is the only remaining instance of the supportsTransformations() function, and will for all font engines except the CoreText engine support affine transformations. The CoreText engine on the other hand only supports translations (for now). Change-Id: I8fb5e43e3de3ef62a526a79a6dfeda7f9546771d Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
* | Merge "Merge branch 'stable' into dev" into refs/staging/devJędrzej Nowacki2013-01-071-1/+3
|\ \
| * | Merge branch 'stable' into devFrederik Gladhorn2013-01-071-1/+3
| |\| | | | | | | | | | | | | | | | | | | Conflicts: tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp Change-Id: I6b8d505fc22f052c307ca27f58f7d16f98965f47
| | * Fix possible crash in QTextDocumentEskil Abrahamsen Blomfeldt2013-01-031-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | With trailing spaces in some cases, we would not get the "no justification at end of paragraph" special case, and continue in the code, getting the unexpected case where line_length becomes < 0 which would lead to memory corruption because we were writing outside our buffers. I added an assert to catch this type of bug earlier, and I added the trailing spaces to the test for the end of the paragraph. The test case added is one example which would crash. Task-number: QTBUG-27354 Change-Id: Id720a6fa55dbc709ce04dd5321e55687bf960d75 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* | | Get rid of pre-QPA leftoversKonstantin Ritt2013-01-073-240/+1
|/ / | | | | | | | | Change-Id: I61a393baa387f2f90dc652d6a9df1c41c3730611 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
* | Merge branch 'stable' into devFrederik Gladhorn2013-01-046-30/+31
|\| | | | | | | | | | | | | | | | | | | | | Conflicts: examples/widgets/painting/shared/shared.pri src/corelib/tools/qharfbuzz_p.h src/corelib/tools/qunicodetools.cpp src/plugins/platforms/windows/accessible/qwindowsaccessibility.cpp src/plugins/platforms/windows/qwindowsfontdatabase.cpp Change-Id: Ibc9860abf570e5ce8b052fb88feb73ec35e64bd3
| * Fix styleName support in QPA font databaseJiang Jiang2012-12-144-26/+17
| | | | | | | | | | | | | | | | | | Font styleName support was disconnected since Qt switched to QPA fontdatabase. Now add the code from Qt 4.8 back to enable this in QPA. Change-Id: Iab2cbfd5468f87542183348c2123ca4b2c270692 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
| * Mac: fix bugs for font selection in QFontDialogLiang Qi2012-12-141-1/+1
| | | | | | | | | | | | | | | | | | Use localized family name and style name when selecting font with non-English locale Task-number: QTBUG-27415 Change-Id: Ie81507ed011fc096e0f5edad146e97c392e86494 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
| * FreeType bitmaps interpreted in wrong formatFlorian Hänel2012-12-121-1/+13
| | | | | | | | | | | | | | | | | | | | | | | | We ask grayscale or mono bitmaps from FreeType but in some cases treat the output as ARGB without conversion. This surfaces using QGLWidget as a viewport to QDeclarative content. The offending glyphs are then generated through QTextureGlyphCache::textureMapForGlyph. This adds a fix for converting to the expected ARGB32 data. Change-Id: Ia219582ebd76b7e4e9379111a42312b4d97718de Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com> Reviewed-by: Frederik Gladhorn <frederik.gladhorn@digia.com>
| * properly syncqt-ize harfbuzz headersOswald Buddenhagen2012-12-041-2/+0
| | | | | | | | | | | | | | | | | | we were already installing them into QtCore/private, so turn them into proper private headers to start with. this cleans up our project files. Change-Id: I0795f79e03b60b5854de9e4dc339e9b5a5e6fd87 Reviewed-by: Lars Knoll <lars.knoll@digia.com> Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
* | Move ForceIntegerMetrics testing out of the loopKonstantin Ritt2013-01-021-2/+5
| | | | | | | | | | Change-Id: I5732999dee63568eb83e5186cf5bf8c63709724e Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
* | Update Qt internals to use QChar::ScriptKonstantin Ritt2012-12-2110-145/+138
|/ | | | | | | | | | | | | | ...and remove the outdated QUnicodeTables::Script enum. QFontEngineData now has one extra slot that never used (engines[QChar::Script_Inherited]). engines[QChar::Script_Unknown], if accessed, would be set with a Box engine instance, and could be used as a minor optimization some time later. In order to preserve the existing behavior, we map all scripts up to Latin to Common. Change-Id: Ide4182a0f8447b4bf25713ecc3fe8097b8fed040 Reviewed-by: Pierre Rossi <pierre.rossi@gmail.com> Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
* Replace two \returns markers by "The function returns"hjk2012-11-301-1/+1
| | | | | | Change-Id: I101310f6bd9bddf0ee9d06a81b9fef805313a015 Reviewed-by: Leena Miettinen <riitta-leena.miettinen@digia.com> Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Not necessary to assign bool to false for changing just 2 lines afterMontel Laurent2012-11-301-3/+2
| | | | | Change-Id: I4ed9a07e3dc2cac9d82b3070a2dd22cca2d80f3d Reviewed-by: David Faure <david.faure@kdab.com>
* Add more qtbase implictly-shared classes to the listGiuseppe D'Angelo2012-11-303-1/+4
| | | | | | | QText*Format and QDns* ones are still missing. Change-Id: I8e87fba596e87289ca935717e0a90bfc0b0a26c0 Reviewed-by: hjk <qthjk@ovi.com>
* Add QText*Format classes to the list of the implicitly shared onesGiuseppe D'Angelo2012-11-301-0/+7
| | | | | Change-Id: Iee0ecb1cf02fdf9dbdf8328bbe60b1dc7ca21894 Reviewed-by: hjk <qthjk@ovi.com>
* Fix possible assertion when using stringToCMap() for a multi engineKonstantin Ritt2012-11-271-4/+3
| | | | | | | | | | | If (*nglyphs < len), stringToCMap() sets *nglyphs to len and returns false immediately; the caller then must resize the buffer and re-try. However, QFontEngineMulti::stringToCMap() doesn't update the nglyphs value and thus the second call would fail, too. This is quite unexpected. Change-Id: Id2cce7b9faf7706c382fccf023e1b7affa9a10be Reviewed-by: Lars Knoll <lars.knoll@digia.com> Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
* Change license header from Nokia to DigiaSergio Ahumada2012-11-261-1/+1
| | | | | Change-Id: I2be215284d7670f60f8b5838fce1e6832dde2270 Reviewed-by: Martin Smith <martin.smith@digia.com>
* Change QTextLayout::textOption() to return a const reference insteadAndy Shaw2012-11-262-2/+2
| | | | | | | | | | | By changing textOption() to return a const reference we will get a performance increase when accessing this function internally. Task-number: QTBUG-28193 Change-Id: I65b594d844ebaee6d72f4a95d11bd2c5e801fab4 Reviewed-by: Lars Knoll <lars.knoll@digia.com> Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com> Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
* Fix transformed text on Mac OS XEskil Abrahamsen Blomfeldt2012-11-232-0/+6
| | | | | | | | | | | | | | | | | In change 1582407fc782c0befd0760633324dd5c206524a1, the Q_WS_MAC code path which disabled drawing cached glyphs for any transform was removed, as was the comment that scaling and rotation wasn't supported by the Mac font engines. This obviously broke transformed text on Mac, so we need to put it back. I put it into the font engine itself where it belongs, and I kept the somewhat confusing naming convention which is used in the paint engine to minimize this patch. I'll clean up these function names in a future commit. Task-number: QTBUG-27362 Change-Id: I4fc6a503eedd4b1ebaf3ee659d948f997f433338 Reviewed-by: Samuel Rødal <samuel.rodal@digia.com>
* Fix possible crash/assertion in qt_fontHasNarrowOutlines()Konstantin Ritt2012-11-211-4/+10
| | | | | | | | | 1. cloneWithSize() may return 0 1bis. QRawFont::setPixelSize() may ivalidate the font (due to 1.) 2. using the data obtained from a temporary QString is never safe! Change-Id: I0cd5f807d8077ef5112704e475f1904bd6fc4b1b Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
* Fixed rendering artifacts when drawing cursor.Samuel Rødal2012-11-201-1/+1
| | | | | | | | Get rid of the + 1 in addition to the ascent and descent. Task-number: QTBUG-27658 Change-Id: I8721226a034099ebe348cad3c49ac711c7fe44b9 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
* Fix conditional jump based on an uninitialized variable.Jędrzej Nowacki2012-11-031-2/+3
| | | | | | | | | | | | | | | | | | | | | | Valgrind warns about the jump in qfontconfigdatabase.cpp:522 based on uint QFondDef::hintingPreference:2 property. Surprising thing is that the property is initialized in the default constructor, so there should not be an issue. The warning disappear if the property is _not_ placed on a boundary of a two words, or if bit field is fully initialized. So I suspect that only one bit of the two was initialized properly. I decide to implement both solutions because of a potential minor performance improvement, during reading the property. I still fail to say why the value was uninitialized, I believe that this patch simply workarounds gcc bug or valgrind bug. Change-Id: I2e87738f66a435ef6e30b3d2db6baa73da025426 Reviewed-by: Jiang Jiang <gzjjgod@gmail.com> Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com> Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
* Pixel-align vertical metrics in QTextLayout againEskil Abrahamsen Blomfeldt2012-10-301-2/+2
| | | | | | | | | | | | | | | | | | | To avoid regressing due to de58eb64bc564fcb8af61a45576783e432d2380c, we need to return a pixel aligned height in QTextLine::height() and also use pixel aligned heights when calculating the position of lines as well as the bounding rect of the layout. Later, we can add a QTextLine::naturalHeight() or something like that which gives the fractional value, but until then, we need to access private API in QPainter to get the correct alignment, since we still don't want to align the height of the last line in the layout, we only want to align the origin of each line. Task-number: QTBUG-27740 Change-Id: I12325f07d33aaf1a1b967e0a11492759d0f565d9 Reviewed-by: Caroline Chao <caroline.chao@digia.com> Reviewed-by: Samuel Rødal <samuel.rodal@digia.com>
* QSyntaxHighlighter: minor code de-duplicationKonstantin Ritt2012-10-291-25/+4
| | | | | | | | The (r.start != -1) case is equal to (i == formatChanges.count()) case in the loop; no need to exit the loop just to do exactly what it did. Change-Id: I4129d8012399895c2fce70b26716ca5aeadee79c Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
* QFontEngineMulti: Fix possible crash in stringToCMap()Konstantin Ritt2012-10-291-3/+4
| | | | | | | | | in case when the layout is partially initialized. We shouldn't access any data except of indices if GlyphIndicesOnly flag has been passed in. Change-Id: I264689b498e0f9de8b5c040d47dbae4f6ef391c4 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
* QTextEngine: Support SMP code points when case changingKonstantin Ritt2012-10-251-4/+16
| | | | | | | Semi-related to QTBUG-17337 Change-Id: I6b42c0f7e588bbeab27bf410fcdfa1a6f80e4ac2 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
* Revert hacks in text rendering code pathEskil Abrahamsen Blomfeldt2012-10-252-4/+13
| | | | | | | | | | | | | | 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>
* Fix crash due to memory access violationKonstantin Ritt2012-10-221-0/+1
| | | | | | | | The font engine has been re-used without increasing it's reference counter Task-number: QTBUG-27596 Change-Id: Icd4c3ca131446255ad4a27da8aa9a6c69177212e Reviewed-by: Sergio Ahumada <sergio.ahumada@digia.com>
* QFont: Don't invalidate engine unless request has been changedKonstantin Ritt2012-10-192-7/+29
| | | | | | | | | | This makes QFont do a "light" detach when the font attributes data has been changed. The new test clearly shows that the engine is now shared between two font instances after changing the kerning attribute. Change-Id: I59db822f459f02d111686dba7101b98e361fada9 Reviewed-by: Marc Mutz <marc.mutz@kdab.com> Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Remove Qt3 compat leftoversKonstantin Ritt2012-10-191-12/+2
| | | | | Change-Id: I91c3d26125168998d6279bddb0671cfb68eac2f4 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Use the right properties when checking the frame's marginsAndy Shaw2012-10-181-4/+4
| | | | | | | | | Changed it to check the Frame*Margin property instead of the Block*Margin property as this was incorrect for a QTextFrameFormat. Task-number: QTBUG-22173 Change-Id: I2c3066165fb592ed034874b1180593822859f933 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Get rid of unused memberKonstantin Ritt2012-10-161-2/+0
| | | | | | Change-Id: Ic6d207cacf02f2e6837f9f35020be7728ec60706 Reviewed-by: Lars Knoll <lars.knoll@digia.com> Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
* QTextBlock: Handle surrogates in textDirection()Konstantin Ritt2012-10-161-2/+9
| | | | | | | just like QString does. Change-Id: I002827d9ec93fb19ef2c0198b5fcd4dae15c5c34 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
* QFont: Don't detach unless value has really changedKonstantin Ritt2012-10-161-6/+46
| | | | | | Change-Id: I496b0102853d04652322bf8751e5824aaa0725b7 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com> Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* QRawFont: improve performance and safety of glyphIndexesForString()Konstantin Ritt2012-10-152-39/+41
| | | | | | | | | | | As of 98c1eb1750498cdff9d3b26658e5e5be9c026c92, partially initialized QGlyphLayout is ok for stringToCMap() if GlyphIndicesOnly flag is set, thus we can use the glyphIndexes buffer directly and avoid copying. Also add some checks to guarantee we're not falling into an undefined behavior for the empty text or NULL buffer. Change-Id: I662953703e4c65edbebabbe4b753972417d963f3 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
* Use constFind()/constEnd() for const_iterator-sKonstantin Ritt2012-10-133-7/+7
| | | | | | | to make the strict iterators happy. Change-Id: Ief4ec309b815f18dc4b2017d4f34c063db510c31 Reviewed-by: Pierre Rossi <pierre.rossi@gmail.com>
* QFont: Fix build with QFONTCACHE_DEBUGKonstantin Ritt2012-10-131-1/+1
| | | | | | Change-Id: Ifc89af71cdf6a5f9e4114266030cf265042db626 Reviewed-by: Marc Mutz <marc.mutz@kdab.com> Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
* QGlyphRun: Fix isEmpty() and boundingRect() didn't work after setRawData()Konstantin Ritt2012-10-131-5/+5
| | | | | Change-Id: I44a347ef24961493d6b8353abbb215c713ccce52 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
* Update/fix QTextBoundaryFinder simple usage cases in qtbaseKonstantin Ritt2012-10-131-10/+10
| | | | | | Change-Id: I4d3000558bce86e2de3c32247915868ba18fc8b7 Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com> Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Revert "Handle additional format ranges when itemizing."Pierre Rossi2012-10-101-40/+23
| | | | | | | | | | | This reverts commit 101d04681f4ceb7410681eae684534a206a9d90a. That change seems to have introduced a few regressions, and Creator hits an assertion that it introduced because it assumes the additionalFormats consists of well-formed ranges (QTCREATORBUG-7995). Change-Id: Ic4ae761e6e7f6df8a6b5ca565ceb250647420c15 Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
* Handle additional format ranges when itemizing.Pierre Rossi2012-10-081-23/+40
| | | | | | | | | | | | | | This is useful when the additional formats are used on a text layout using a raw font. It can also come in handy for input methods operating on a QTextDocument. We now consider all format range edges to generate the associated items. The capitalization can be overridden via the additionnal formats mechanism. Adds an autotest that checks that this works with font capitalization. Change-Id: I782d2c48d05b0dfbad480a9ca77198465292b358 Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
* fixing typo in compile fix for MSVC 2008Thomas Hartmann2012-10-081-1/+1
| | | | | | Change-Id: If1955395d9c476a49e6d6f2ae14e6ad6c63a7da7 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com> Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
* compile fix for MSVC 2008 and std::upper_boundThomas Hartmann2012-10-042-1/+24
| | | | | | | | | | | | qUpperBound was replaced by std::upper_bound. Unfortunately the STL of MSVC 2008 enforces the definition of the operator in both directions. Change-Id: I3e0f775c23e43332d106e0847d3611e488da6c06 Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com> Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>