summaryrefslogtreecommitdiffstats
path: root/src/gui/text/qfontengine_p.h
Commit message (Collapse)AuthorAgeFilesLines
* Fix selection of fonts that require OpenType featuresKonstantin Ritt2013-03-041-0/+1
| | | | | | | | HB_Face's supported_scripts[] expects HB_Script, so QChar::Script should be remapped via script_to_hbscript(). Change-Id: Ib068c35ab76567fe9a61da7d8ab01133a6f58bc0 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Add support for color glyphs (Emoji) on Mac OS X and iOSTor Arne Vestbø2013-02-131-1/+3
| | | | | | | | | | | | | A new glyph type is added to the glyph caches for ARGB bitmap glyphs, and the raster and OpenGL paint engines have been modified to support this glyph type for drawCachedGlyphs(). The CoreText font engine implements support for these glyphs through the CTFontDrawGlyphs API, since CGContextShowGlyphsWithAdvances does not handle color glyphs. Change-Id: Idad9ce75a911cae130d65aebe59142772a16fc12 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
* Merge remote-tracking branch 'origin/stable' into devFrederik Gladhorn2013-01-221-1/+1
|\ | | | | | | | | | | | | | | | | | | 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-181-1/+1
| | | | | | | | | | Change-Id: Ic804938fc352291d011800d21e549c10acac66fb Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* | Refactor paint/font-engine shouldDrawCachedGlyphs and supportsTransformationsTor Arne Vestbø2013-01-101-1/+1
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* Fix transformed text on Mac OS XEskil Abrahamsen Blomfeldt2012-11-231-0/+2
| | | | | | | | | | | | | | | | | 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>
* 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>
* Move ShaperFlags enum from QTextEngine to QFontEngineKonstantin Ritt2012-07-101-10/+17
| | | | | | | | 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>
* Remove all references to XLFD fontsLars Knoll2012-06-271-3/+0
| | | | | | | | XLFD fonts are no longer supported in Qt 5. Change-Id: I83400dab417c933d5cd956c0d168c45b9d79dab7 Reviewed-by: Casper van Donderen <casper.vandonderen@nokia.com> Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com>
* QFontMetrics/QRawFont: Optimize SMP code points handling a bitKonstantin Ritt2012-06-141-0/+12
| | | | | | | | | Calling QString::fromUcs4() for the single UCS-4 -encoded character is quite suboptimal since the BOM detections and the resulting QString aren't really used; all we need is to split the UCS-4 code point into the UCS-2 surrogate pair. Change-Id: Ia5b68312909bf551cf2493d9e2752a7d7d837fb9 Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
* Use the lazily-queried families for all QPA multi font engines.Pierre Rossi2012-03-141-0/+2
| | | | | | | | | This is the approach introduced together with the WebKit "backdoor" that lets us use QRawFont with QTextLayout. We could use it all over the place and share more code. Change-Id: Ie1963679755f37ba9204d67554a163f1d1115604 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com>
* Enablers for shared graphics cache in raster paint engineJiang Jiang2012-03-081-3/+3
| | | | | | | | | | | | Required changes for using shared graphics cache for distance field raster glyph rendering. Most of the logic is in platform plugins. Platform plugins should implement QPlatformIntegration::createImagePaintEngine() to create a subclass of QRasterEngine. Change-Id: Icf0a396e722e43b4caa2c1849aae38753cde38f1 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com>
* Remove dead code.Pierre Rossi2012-03-081-1/+0
| | | | | | | | This logic was introduced as part of change I92dfb39289a359f49caa02c2caf8baf66098fb59 but isn't used anymore. Change-Id: I5bcfea99a7a2993434e1e978195a70dae52d6cfa Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com>
* Make cache of opentype tables in Harfbuzz face lazyEskil Abrahamsen Blomfeldt2012-03-061-0/+1
| | | | | | | | | | | | | | | | | | | | The mechanism in fontconfig which determines if a certain character is available (FcCharSetHasChar()) may give false positives, in which case we would load and unload those fonts per every char for which FC gave us a false positive. This was a major performance regression. Specifically the false positives happened when looking at e.g. italic variants of certain multilingual fonts, since we only check the charset of the font family as a whole and not of the specific variant, which may only support a subset of the chars. To optimize this, we remove the deletion of the font engines after loading them, but also wait with loading the opentype tables until they are actually needed. This means that for the false positives, we will load the font, but the cached data for each unused font will be much smaller. Change-Id: Idfc794401a2080da5946bf65204eb947aeb635ed Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
* Merge remote-tracking branch 'origin/api_changes'Lars Knoll2012-03-041-1/+0
|\ | | | | | | | | | | | | | | | | | | Conflicts: dist/changes-5.0.0 mkspecs/features/qt_module_config.prf qmake/project.cpp qmake/property.cpp Change-Id: I6e4af40743a9aeff8ed18533a48036e332acc296
| * QFontEngine: remove unused and buggy grayPalette()Marc Mutz2012-02-271-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | QFontEngine::grayPalette() mistakenly returns an empty vector, so even if there's a user (the class it exported, after all), it cannot correctly use it. So, just remove it. Change-Id: Id5f70139e5f6ed9a2a3f28400cd0750d14cb7dc0 Reviewed-by: Olivier Goffart <ogoffart@woboq.com> Reviewed-by: Jiang Jiang <jiang.jiang@nokia.com>
* | Allow using multi fontengine in QTextLayout with QRawFont.Pierre Rossi2012-03-011-0/+2
|/ | | | | | | | | | | This change enables us to instantiate a QFontEngineMulti that takes the raw font's font engine as its primary engine but can use fallback engines based on the platform. Since this can be quite expensive, we defer the query for fallback families' names until it's needed and we cache the resulting multi font engine. Change-Id: I390dbc1cb2fe61d56867f29a03f313eb3eb49dc3 Reviewed-by: Simon Hausmann <simon.hausmann@nokia.com>
* Avoid loading and keeping unused fallback font enginesEskil Abrahamsen Blomfeldt2012-02-171-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | When we request glyphs from fallback fonts, we would potentially load all fonts on the system into memory. This is especially true for glyphs that are not supported by any font (or by the last in the list) in any "Common" script (which e.g. includes CJK). This would make any application which tried to display unsupported glyphs use huge amounts of memory for keeping unused fonts cached, only limited by the number of fonts on the system. The patch contains two solutions: First, before loading the font, the multi font engine will be asked whether it needs to be tried for the given character. By default, this will always be true, so all fonts will be tried, but with the new font config multi engine in the platform plugin, it will ask FontConfig whether the font contains a glyph for the character. Should the font be loaded and still fail to resolve the character (which could be the case for other platforms), we will simply delete it again immediately instead keeping it cached. Change-Id: I92dfb39289a359f49caa02c2caf8baf66098fb59 Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
* Remove Symbian specific code from QtGui.Xizhi Zhu2012-01-311-3/+0
| | | | | Change-Id: I450a78863462936d0b18e211763f274b59497109 Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
* Remove "All rights reserved" line from license headers.Jason McDonald2012-01-301-1/+1
| | | | | | | | | | As in the past, to avoid rewriting various autotests that contain line-number information, an extra blank line has been inserted at the end of the license text to ensure that this commit does not change the total number of lines in the license header. Change-Id: I311e001373776812699d6efc045b5f742890c689 Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Move glyphMargin() to QFontEngineJiang Jiang2012-01-241-2/+3
| | | | | | | | | | | | | glyphMargin() support for QTextureGlyphCache is implemented in respective font engines, thus this function is platform dependent. Before Qt 5 the code is guarded in macros like #ifdef Q_WS_MAC, now we should move them into QFontEngine and its subclasses. So far only Windows font engines support it. FreeType and Core Text based font engines all ignore it. Change-Id: Ia14016533d8fbfaacf848a7d3bc928f8197318f5 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com>
* Update contact information in license headers.Jason McDonald2012-01-231-1/+1
| | | | | | | Replace Nokia contact email address with Qt Project website. Change-Id: I431bbbf76d7c27d8b502f87947675c116994c415 Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Update copyright year in license headers.Jason McDonald2012-01-051-1/+1
| | | | | Change-Id: I02f2c620296fcd91d4967d58767ea33fc4e1e7dc Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Fix subpixel positioning supportJiang Jiang2011-11-081-1/+2
| | | | | | | | | | | | Move subpixelPositionForX from QTextureGlyphCache to QFontEngine, since some font engines like QFontEngineFT may need a custom implementation or tweak it a little bit. In QRasterPaintEngine::drawCachedGlyphs, do not add aliasedCoodinate to x offset as that will break subpixel positioning. Change-Id: Idbcec617509459b80965220ceb07b17737649bbf Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com>
* Remove Q_WS_ and Q_OS_SYMBIAN from QtGui.Friedemann Kleint2011-10-131-67/+0
| | | | | | Change-Id: I2ac3376513c3fbfc81a2e695a73a0d948d2696bc Reviewed-on: http://codereview.qt-project.org/6607 Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com>
* Support adding application fonts with QFontconfigDatabaseJiang Jiang2011-09-231-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | QFontDatabaseQPA should be able to reinitialize database and reregister all the fonts when an application font is added, because it will trigger db->invalidate(). Add cloneWithSize support to QFontEngineBox so that even no usable font is found in QFontDatabase, QRawFont::setPixelSize can still work (without making the result rawfont invalid). Register application fonts with QFontconfigDatabase, the code is adapted from QFontDatabaseX11. Reenable QRawFont tests for QPA, these usages are now supported in QPA. Fix QStaticText tests, raster in QPA does support transformations. Translate the text before ZAxix rotation so that it will be visible in canvas. Add back fixedPitch support to QPA, and fix QFontDatabase tests. Fix QGlyphRun tests, ignore non-existence glyphs in alphaMap locking. Fix QFontMetrics tests. Task-number: QTBUG-21415, QTBUG-20754, QTBUG-20977, QTBUG-20976, QTBUG-20760, QTBUG-20759 Change-Id: I24aea7d6ec6b2ac6342134d1f2591327c23a692b Reviewed-on: http://codereview.qt-project.org/5384 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com>
* Avoid double caching glyphs in raster/QPA/FreeTypeEskil Abrahamsen Blomfeldt2011-09-201-0/+9
| | | | | | | | | | | | | | | | | | | | | Since FreeType has internal caching, it has had a special code path in the raster engine which avoided using Qt's glyph cache, as that would be redundant. However, when compiling with QPA, we want the same behavior without being able to access the QFontEngineFT class. To achieve this, I've made a new abstraction and added it to QFontEngine which allows the FT engine to provide direct pointers into the alpha maps stored by FT. This requires a locking/unlocking mechanism. Yes, the QFontEngine::alphaMap* API is slowly becoming a horrible mess, but due to time constraints, the task of refactoring these functions into a more flexible API needs to wait. I've added a TODO comment for this. Change-Id: I08237403c2967f8fb952258178676f33a87c0353 Reviewed-on: http://codereview.qt-project.org/5155 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com>
* Merge remote branch 'gerrit/master' into refactorSamuel Rødal2011-08-291-0/+5
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/gui/accessible/qaccessible.h src/gui/kernel/qapplication.cpp src/gui/kernel/qapplication.h src/gui/kernel/qapplication_mac.mm src/gui/kernel/qapplication_qws.cpp src/gui/kernel/qapplication_s60.cpp src/gui/kernel/qapplication_win.cpp src/gui/kernel/qapplication_x11.cpp src/gui/kernel/qdnd_x11.cpp src/gui/kernel/qwidget.cpp src/gui/widgets/qlabel.cpp Change-Id: Ief9c75724d2cff89ed45f009bdee2ffc5e4395ba
| * Fix crash when fallback font is not #0 in multi font engineEskil Abrahamsen Blomfeldt2011-08-261-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Easily reproducible by testing Chinese with the threaded renderer. The multi engine would then have a list of engines with a single item, but the glyphs might belong to e.g. engine 11. In that case, engine() would assert when it couldn't find the engine if the layout had been done in a different thread. We force the loading of the required engine if it's not already loaded. Note that this fix does not work on Mac, as loadEngine() will crash there, so the layout has to be done in the same thread as the rendering, since loading the engines is part of the layout process. Task-number: QTBUG-21112 Change-Id: I71cc396664e3b95fbb4815a90873457e1f89528e Reviewed-on: http://codereview.qt.nokia.com/3631 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Jiang Jiang <jiang.jiang@nokia.com>
* | Merge branch 'master' into refactorGunnar Sletta2011-08-251-1/+1
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/gui/kernel/qapplication_qpa.cpp src/gui/kernel/qcursor_qpa.cpp src/gui/kernel/qwindowsysteminterface_qpa.cpp src/gui/kernel/qwindowsysteminterface_qpa.h src/gui/kernel/qwindowsysteminterface_qpa_p.h src/gui/text/qtextcontrol.cpp src/plugins/platforms/wayland/wayland.pro src/widgets/accessible/qaccessible2.h src/widgets/widgets/qwidgetlinecontrol_p.h Change-Id: I5e6f4eb184159dccc67e8f13673edb884d179c74
| * Remove all non-const operator==Harald Fernengel2011-08-091-1/+1
| | | | | | | | | | | | | | | | | | | | | | We had to leave the non-const operator== for binary compatibility. Remove them all, just leave the const version in there. 100% source compatible. Change-Id: Ib7a70fb441fe51d5164d9cbf495cbeda0f48fafe Reviewed-on: http://codereview.qt.nokia.com/2773 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Robert Griebl <robert.griebl@nokia.com>
* | Merge remote branch 'gerrit/master' into refactorSamuel Rødal2011-08-031-1/+2
|\| | | | | | | | | | | | | | | | | | | Conflicts: src/gui/kernel/qapplication_x11.cpp src/gui/widgets/qlinecontrol.cpp src/gui/widgets/qlinecontrol_p.h src/gui/widgets/qtabwidget.h Change-Id: I90ba893a5553b9ff5658ca0a3221ecf76be4c736
| * Add support for rawFonts loaded from data in FaceIdPierre Rossi2011-07-211-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | The problem was that with an empty filename and index of 0, all raw fonts loaded from data had the same FaceId, and we wouldn't bother to load another one after doing this once. This commit introduces a uuid in FaceId to help distinguish them in that case. Change-Id: I93655ff07a7d8856af1f854024e207c519f8ed1a Reviewed-on: http://codereview.qt.nokia.com/1882 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Jiang Jiang <jiang.jiang@nokia.com>
* | Adapt font engines for Windows/QPA.Friedemann Kleint2011-06-291-1/+5
|/ | | | | | | | | Export QFontEngineMulti and glyph_metrics_t. Implement alphaMapForGlyph() for the multifont-engines which is called in the QPA code paths (similar to boundingBox()). Acked-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com>
* Update licenseheader text in source files for qtbase Qt moduleJyri Tahtela2011-05-241-17/+17
| | | | | | | Updated version of LGPL and FDL licenseheaders. Apply release phase licenseheaders for all source files. Reviewed-by: Trust Me
* Make QtQuick2 compile on QPAEskil Abrahamsen Blomfeldt2011-04-281-0/+2
| | | | | | | | | | | Moved the logic to set pixel size into the font engines to avoid making the platform plugin interface too complex, and added a function in QPA to make an isolated font engine based on font data. Currently none of the QPA back-ends supports it, but it compiles and spits out a warning if you try to create a QRawFont from data there. This isn't used in QtQuick2 anyway. Reviewed-by: Jiang Jiang
* Initial import from qtquick2.Qt by Nokia2011-04-271-0/+8
| | | | | Branched from the monolithic repo, Qt qtquick2 branch, at commit a4a585d2ee907746682846ae6e8a48e19deef469
* Initial import from the monolithic Qt.Qt by Nokia2011-04-271-0/+452
This is the beginning of revision history for this module. If you want to look at revision history older than this, please refer to the Qt Git wiki for how to use Git history grafting. At the time of writing, this wiki is located here: http://qt.gitorious.org/qt/pages/GitIntroductionWithQt If you have already performed the grafting and you don't see any history beyond this commit, try running "git log" with the "--follow" argument. Branched from the monolithic repo, Qt master branch, at commit 896db169ea224deb96c59ce8af800d019de63f12