summaryrefslogtreecommitdiffstats
path: root/src/gui/text
Commit message (Collapse)AuthorAgeFilesLines
* Add a way to check if we have a matching family in the database.Pierre Rossi2011-07-212-0/+12
| | | | | | | | | | | | | | This is needed in order to get proper font fallback, and incidentally webfonts, working in QtWebKit. See: https://bugs.webkit.org/show_bug.cgi?id=55036 Internal for now, maybe it could be made public for a future release. Task-number: QTBUG-15575 Change-Id: I5c454689125cd9d5fda26ff2149208ed1beec24d Reviewed-on: http://codereview.qt.nokia.com/1829 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Jiang Jiang <jiang.jiang@nokia.com> Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com>
* Move separator skipping to proper placeJiang Jiang2011-07-192-6/+7
| | | | | | So that it won't crash some places that requires shaping results. Reviewed-by: TrustMe
* Skip shaping for hidden line/paragraph separatorsJiang Jiang2011-07-191-0/+6
| | | | | | | | | | Since we are not going to draw them in QTextLine::draw either, and shaping them here will cause performance issue on certain systems like Mac OS X 10.7 (most fonts don't have glyph for U+2028, while font fallback handling in Core Text slowed down a bit). Task-number: QTBUG-20252 Reviewed-by: Eskil
* Apply 57993ba7 properly to 4.8Jiang Jiang2011-07-141-1/+1
| | | | | | | Because we have moved alignLine from qtextlayout.cpp to QTextEngine, this patch has to be applied manually. Reviewed-by: TrustMe
* Fix warning for uninitialized variableJiang Jiang2011-07-121-1/+1
| | | | Reviewed-by: Eskil
* Fix compiler warning in qtextdocument.cppEskil Abrahamsen Blomfeldt2011-07-111-1/+1
| | | | | | Missing QLatin1String() wrapper to ensure codec of text. Reviewed-by: Jiang Jiang
* Fix crash when app font is addedJiang Jiang2011-07-113-19/+28
| | | | | | | | | | | | | Loading app fonts will clear the application font cache, but QFontPrivate::engineWithScript will try to load the font again, in Mac the font engine used here must be the one used for shaping, because subsequent sub font engines may be added to it during the shaping process (QCoreTextFontEngineMulti::stringToCMap). That is why we need to fetch the font engine directly from QTextEngine's fontEngine cache instead of QFontCache. Task-number: QTBUG-20250 Reviewed-by: Eskil
* Use truncate only for subpixel boundingBox x positionJiang Jiang2011-07-081-1/+1
| | | | | | | | | | | | | | Since Lion, Core Text starts to return fractional values for x origin in the glyph bounding box. To get correct alignment we need to make it integer, it seems that round will cut certain pixels (x = 0.6 will be round to 1, then that glyph will be moved too much to the left in image glyph cache). Reverting 4297b85a appears to work fine on previous version of Mac OS X as well. This change will not affect Windows (DirectWrite) and FreeType font engines since they both return integer values for that. Reviewed-by: Eskil
* Revert 344a4dcfe and part of 93bce787Jiang Jiang2011-07-071-3/+4
| | | | | | Due to subpixel grid change, these changes are no longer needed. Reviewed-by: Eskil
* Fix raster subpixel positioning in LionJiang Jiang2011-07-071-1/+1
| | | | | | | | In Lion, the x position returned by CTFontGetBoundingRectsForGlyphs can be fractional, we need to round().truncate() it as we did in QTextureGlyphCache to save the baseLineX. Reviewed-by: Eskil
* Merge remote branch 'mainline/4.8'Jiang Jiang2011-07-073-165/+73
|\ | | | | | | | | Conflicts: dist/changes-4.8.0
| * Merge branch 'master' of scm.dev.nokia.troll.no:qt/oslo-staging-1 into ↵Qt Continuous Integration System2011-07-022-162/+66
| |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | master-integration * 'master' of scm.dev.nokia.troll.no:qt/oslo-staging-1: changelog Compile with DEBUG_FONTENGINE define minor optimization remove the old compatibility code make QFontEngineQPF1 work even without mmap(2) support Doc: Fixing typo
| | * Compile with DEBUG_FONTENGINE defineHarald Fernengel2011-07-011-4/+4
| | | | | | | | | | | | Trivial fix to make the debug code compile again after latest changes
| | * minor optimizationRitt Konstantin2011-07-011-2/+2
| | | | | | | | | | | | | | | | | | | | | use the cached data from fileinfo rather than re-creating it one line later Merge-request: 1260 Reviewed-by: Harald Fernengel <harald.fernengel@nokia.com>
| | * remove the old compatibility codeRitt Konstantin2011-07-011-95/+2
| | | | | | | | | | | | | | | | | | | | | obsoleted by the last commit (and moreover, disabled a while ago) Merge-request: 1260 Reviewed-by: Harald Fernengel <harald.fernengel@nokia.com>
| | * make QFontEngineQPF1 work even without mmap(2) supportRitt Konstantin2011-07-011-62/+59
| | | | | | | | | | | | | | | | | | | | | | | | this also fixes a memory leaking on Integrity (an allocated data was unmap()'ed rather than free()'d) Merge-request: 1260 Reviewed-by: Harald Fernengel <harald.fernengel@nokia.com>
| * | Merge remote-tracking branch 'origin/4.7' into qt-4.8-from-4.7Liang Qi2011-07-011-3/+7
| |\ \ | | | | | | | | | | | | | | | | Conflicts: src/s60installs/s60installs.pro
| | * \ Merge branch '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-2 into ↵Qt Continuous Integration System2011-06-291-3/+7
| | |\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 4.7-integration * '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-2: Fix text color in some cases of QML and QStaticText
| | | * | Fix text color in some cases of QML and QStaticTextEskil Abrahamsen Blomfeldt2011-06-291-3/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts 518c2a58ed6fdfd7449cb4476aa8ea0d32ad16e3 which caused a regression. When writing systems are mixed and an underline is set on the font, QPainter will set a pen with the current color and a new width on itself before drawing the decoration. This would cause the recorder in QStaticText to mark the pen as dirty, saving the current pen color in all subsequent text items. The effect was e.g. that in QML the cached color would override the current one, making it impossible to change the color on the text without forcing a relayout somehow. The right fix is to only mark the pen as dirty when its color actually changes. Task-number: QTBUG-20159 Reviewed-by: Jiang Jiang
* | | | | Fix S60 compileJiang Jiang2011-07-061-1/+1
| | | | |
* | | | | Remove some metrics parsing code from Core TextJiang Jiang2011-07-062-20/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The respective value in some of the default fonts like Lucida Grande are simply not reliable. It seems that the only reliable way to get such information is by going through all the glyphs. It seems that these code are not well tested on Mac and should be removed for now since it caused visible regressions in QLineEdit rendering. Reviewed-by: Eskil
* | | | | Fix Windows compileJiang Jiang2011-07-061-1/+1
| | | | |
* | | | | Move styleName out of QtFontStyle::KeyJiang Jiang2011-07-065-46/+57
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Makes the code clearer and more explicit. Reviewed-by: Eskil
* | | | | Fix regressions in previous QFontDatabase patchJiang Jiang2011-07-051-12/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 1. QtFontStyle::Key comparison should either use styleName or style, etc., but not both. 2. When initializing a QFont from QFontDatabase::font(), style and weight parameters should always be set even when we found a match styleName, in case these parameters will be used for comparison later. Reviewed-by: Eskil
* | | | | Store styleName in font databaseJiang Jiang2011-07-043-12/+38
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | So that queries like QFontDatabase::styles() can return exactly the same styles as the system does. Then application can use QFont::setStyleName() to select those styles later. With a lot of fonts not providing correct numeric weight/width values and even if they did, values are usually not directly mapped to QFont enums, styleName is probably the only reliable way to select any possible font in the system. Task-number: QTBUG-13518 Change-Id: Id8a9469b804f1b5bb81d8c7378e7e8778f9a4fff Reviewed-on: http://codereview.qt.nokia.com/739 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com>
* | | | | Fix resource leak in QFontEngineDirectWriteEskil Abrahamsen Blomfeldt2011-06-301-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Bug introduced by f54c5d9133d7aa7636988db36fa6cc51d26434b6. The release statement has to come before the return statement :) Reviewed-by: Jiang Jiang
* | | | | Fix transformations on DirectWrite rasterized textEskil Abrahamsen Blomfeldt2011-06-302-47/+104
|/ / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There were a few bugs in the DirectWrite font engine that caused transformed text to break. First of all, alphaMapForGlyph() ignored the transform, so no gray antialiased text would be transformed. Second of all, the imageForGlyph() function would use the wrong bounding box for the rasterized glyph, causing its positioning to become a little bit off when rotating. The fix is to get the bounding box from the system and add a margin to this instead of trying to predict how it will appear after the vertical hinting etc. has been applied. So that the positioning metrics are in sync with the actual metrics used by the alphaMap* functions, we also need to implement the alphaMapBoundingBox() function. Task-number: QTBUG-19829 Reviewed-by: Jiang Jiang
* | | | Merge remote-tracking branch 'qt-mainline/4.8'aavit2011-06-274-5/+3
|\ \ \ \ | | |_|/ | |/| |
| * | | Merge branch 'qt-4.8-from-4.7' of scm.dev.nokia.troll.no:qt/qt-integration ↵Qt Continuous Integration System2011-06-243-3/+3
| |\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | into master-integration * 'qt-4.8-from-4.7' of scm.dev.nokia.troll.no:qt/qt-integration: (28 commits) Use numeric virtual keyboard for all number entry modes. QTBUG-17776, reporting terminated threads as not running on Symbian Splitview - Auto-translation rules changed Support clipboard function on Symbian Added qmlshadersplugin to Symbian qt.iby-file. Workaround webkit deadlock on macos x Disable antialiasing for tiled image drawing. Ensure visibility of input widget in QML app when doing layout switch Def update for gui, openvg, and opengl. Revert "Def update." Fix trailing whitespace Remove unnecessary resizes during orientation change Revert "Symbian: Fix QFontInfo::pixelSize()" Improving warning messages in QVolatileImage. Proper naming for raster pixmap and paintengine on Symbian. Def update. Handle QVolatileImage-backed pixmaps optimally in drawPixmap(). Resizable graphicsview's background is drawn incorrectly in splitview Add inputcontext reset to orientation switch in Symbian QS60Style: QGroupBox is drawn as white box in upcoming Symbian release ...
| | * \ \ Merge remote-tracking branch 'origin/4.7' into qt-4.8-from-4.7Liang Qi2011-06-243-3/+3
| | |\ \ \ | | | |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/gui/image/qpixmap_raster_symbian.cpp src/gui/image/qpixmapdatafactory.cpp src/gui/painting/qgraphicssystem.cpp src/gui/styles/qs60style.cpp src/network/bearer/qnetworkconfigmanager_p.h src/s60installs/bwins/QtGuiu.def src/s60installs/bwins/QtOpenGLu.def src/s60installs/bwins/QtOpenVGu.def src/s60installs/eabi/QtGuiu.def src/s60installs/eabi/QtOpenVGu.def tests/auto/qnetworkproxyfactory/tst_qnetworkproxyfactory.cpp
| | | * | Merge branch '4.7' of scm.dev.nokia.troll.no:qt/qt into 4.7Laszlo Agocs2011-06-204-29/+134
| | | |\ \ | | | | |/
| | | | * Fix glyph metrics with QStaticText/Freetype/raster and light/no hintingEskil Abrahamsen Blomfeldt2011-05-311-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a back-port of part of cad70d64d0bbada. In the raster engine's drawCachedGlyphs(), which is used by QStaticText, we would use the wrong metrics to lay out the glyphs, because loadGlyphMetrics() would assume full hinting. A visible effect of this was that the baseline of rotated text became wavy. Task-number: QTBUG-18185 Reviewed-by: Jiang Jiang
| | | | * Fix boundry conditions for cursor hit testJiang Jiang2011-05-251-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Clicking at the edge of a glyph means lookup for the left glyph. Reviewed-by: TrustMe (cherry picked from commit 31110bf84bb06d57983501fa65fe0db3f7c61927)
| | | | * Fix cursor position test on CursorOnCharacter caseJiang Jiang2011-05-253-4/+9
| | | | | | | | | | | | | | | | | | | | Reviewed-by: TrustMe
| | | | * Fix xToCursor issue due to backporting from 4.8Jiang Jiang2011-05-241-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | Task-number: QTBUG-19260 Reviewed-by: TrustMe
| | | | * Support placing cursor in ligature with mouse or touchJiang Jiang2011-05-233-7/+74
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We need to find out the closest element in the ligature to the point we clicked (or tapped), currently we do this by dividing the width of that ligature glyph evenly by the number of characters it covered. We only support Common and Greek script at this point, ligatures in other scripts are still handled as a whole. Task-number: QTBUG-19260 Reviewed-by: Eskil
| | | | * Fix ligature offset in multi-line textJiang Jiang2011-05-201-2/+2
| | | | | | | | | | | | | | | | | | | | Reviewed-by: Eskil
| | | | * Make selection work across ligaturesJiang Jiang2011-05-201-21/+43
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For widgets like QPlainTextEdit, selection across ligatures (typically 'fi', 'ffi', 'fl', etc.) end up highlighting the entire ligature glyphs, this patch fixed that by dividing width inside the ligature so that selection will not expand past the actual selected characters. Since cursor position already considered this, we merely adopted the algorithm and made it a separated helper function for all necessary cases. Dividing width directly looks like a temporary workaround but works well enough so far for cursor positions. Task-number: QTBUG-11969 Reviewed-by: Eskil (cherry picked from commit 99fd5825dfb4d50cff93165995701a65b7a8e4ed)
| | | * | Revert "Symbian: Fix QFontInfo::pixelSize()"Alessandro Portale2011-06-162-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit fcfc19878a0a1a48194a786bba64da11606077d2. I am happy that this commit fixed three bugs at once. But Actually, I am not sure if QTBUG-15513 should be fixed at this point. Fact is that the patch as it is would have changed the point->pixels calculation back to how it was in Qt 4.6. This means that the fonts which are defined with pointSize would now (in Qt 4.7.4) suddenly be bigger than they were in Qt 4.7.3. Imho this is unacceptable, as it would break all layouts which were developed for Qt 4.7 apps, when point size (instead of pixle size) was used. I will need to fix QTBUG-17844 without fixing QTBUG-13009 If QTBUG-13009 will be fixed for 4.8 will be discussed.
| | | * | Proper naming for raster pixmap and paintengine on Symbian.Laszlo Agocs2011-06-163-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As QTBUG-19880 highlighted, the old S60 naming is not suitable for these classes anymore. Task-number: QTBUG-19913 Reviewed-by: Jani Hautakangas
| | | * | Symbian: Fix QFontInfo::pixelSize()Alessandro Portale2011-06-142-4/+1
| | | |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Unlike QFont::pixelSize(), which may return -1 if the font size was defined in points, QFontInfo::pixelSize() always needs to return a valid value. c4ef479906f073fa84999eb950f00e264ebd4e8e which was a fix for QTBUG-13009 tried to fix a similar issue, but failed to do that properly, which resulted in QTBUG-15513 and QTBUG-17844. This commit is supposed to fix all three bugs. Task-Number: QTBUG-13009 Task-Number: QTBUG-15513 Task-Number: QTBUG-17844
| | | * Fix broken drawing with large fonts using QStaticText and FreeTypeEskil Abrahamsen Blomfeldt2011-05-181-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In FreeType, there's a fall back to QFontEngine::alphaMapForGlyph() when the fonts are very large. Since this uses a QPainterPath containing an unhinted glyph, the use of hinted metrics would sometimes lead to the glyphs being clipped because they would be positioned slightly outside the image they were painted into. When outline drawing is on, it makes sense to return unhinted metrics, since the glyphs we will actually use are unhinted. Task-number: QTBUG-19067 Reviewed-by: Jiang Jiang
| | | * Merge branch '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-1 into ↵Qt Continuous Integration System2011-05-1796-1633/+1633
| | | |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 4.7-integration * '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-1: Updating file with CRLF line endings for the updated header Fix a regression in QList::mid() update gitignore remove -fno-stack-protector Fix make confclean Update licenseheader text in source files
| | | | * Update licenseheader text in source filesJyri Tahtela2011-05-1396-1633/+1633
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Updated version of LGPL and FDL licenseheaders. Apply release phase licenseheaders for all source files. Reviewed-by: Trust Me
| * | | | Merge remote-tracking branch 'origin/4.8'Olivier Goffart2011-06-2427-284/+619
| |\ \ \ \ | | |/ / /
| * | | | move some internal helper functions from qglobal.cpp to qcore_mac*Ritt Konstantin2011-06-091-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | namely: void qt_mac_to_pascal_string(const QString &s, Str255 str, TextEncoding encoding = 0, int len = -1); QString qt_mac_from_pascal_string(const Str255 pstr); OSErr qt_mac_create_fsref(const QString &file, FSRef *fsref); OSErr qt_mac_create_fsspec(const QString &file, FSSpec *spec); remove relevant "extern" declarations all over the Qt sources Merge-request: 2615 Reviewed-by: Denis Dzyubenko <denis.dzyubenko@nokia.com>
* | | | | Only compare styleNames if they are not emptyJiang Jiang2011-06-272-2/+2
| | | | | | | | | | | | | | | | | | | | Task-number: QTBUG-19366
* | | | | Add styleName to QFontDef comparisonJiang Jiang2011-06-252-0/+4
| |/ / / |/| | | | | | | | | | | | | | | | | | | | | | | To make sure we cache different font engines with different style names. Task-number: QTBUG-19366
* | | | Merge branch 'master' of scm.dev.nokia.troll.no:qt/qt-fire-staging into ↵Qt Continuous Integration System2011-06-236-60/+64
|\ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | master-integration * 'master' of scm.dev.nokia.troll.no:qt/qt-fire-staging: Skip boundry neutral characters in bidi itemization Update autotest case after toHtml change Proper fix for previous deallocation problem No need to destroy match pattern again Fix fontconfig usage in X11 font database Fix empty lines in Qt HTML when displayed in external browsers (again) Make it possible to set color of QStaticText with pixel size >= 64
| * | | | Skip boundry neutral characters in bidi itemizationJiang Jiang2011-06-221-4/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | According to UAX #9, bidiItemize should act as if those characters don't exist. If we don't, dir and status.eor here may become QChar::DirBN, thus interfere the result of bidiItemize. Task-number: QTBUG-19949 Reviewed-by: Lars Knoll