summaryrefslogtreecommitdiffstats
path: root/src/gui/text/qfontengine.cpp
Commit message (Collapse)AuthorAgeFilesLines
* QFontEngine: replace QLinkedList with std::listMarc Mutz2019-05-141-5/+5
| | | | | | | | | | | The object is never copied, so there's no point in using a cow'ed list implementation. Also port two explicit-iterator loops to ranged-for, as one is necessary (because of constBegin()) and the other is for consistency. Change-Id: Ia7f080060d6b675a76b55d197af08161389082a9 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Prefix textstream operators with Qt::Lars Knoll2019-05-021-1/+1
| | | | | | | As the non prefixed variants are deprecated Change-Id: I2ba09d71b9cea5203b54297a3f2332e6d44fedcf Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* QtGui/Network/OpenGl/Widgets/Xml: use \nullptr in documentationChristian Ehrlicher2019-02-201-2/+2
| | | | | | | Replace null and '\c nullptr' with \nullptr in the documentation. Change-Id: I58934eea06943309ba895833f1991629870ab45b Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* [Windows] Fixed regression when creating fallback fontsEskil Abrahamsen Blomfeldt2019-02-141-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | In 3ccdeb4b58b681bb3a0a43f926f81fd94f527680, we removed the specialized multi font engine on Windows, causing us to go through the same code path when loading fallbacks as on other platforms. When combined with 97f73e957756753b09a778daf2ee8f0ddb97f746, this caused an error, because the code in QFontEngineMulti::loadEngine() only overrode the families list, but not the singular family in the request. In the QRawFont test, this would cause the requested fallback font to correctly have "MS Shell Dlg2" as the only font in the families list, but the request.family would still be "QtBidiTestFont", the name of the main font. The singular family in the request was preferred by the windows font database when creating the LOGFONT. We would therefore load the latter for the fallback as well and since it still does not support the characters in question, we would continue searching. Fixes: QTBUG-72836 Change-Id: I1787b57febcf6030d5c5b09bc2ef2c9558f05beb Reviewed-by: Andy Shaw <andy.shaw@qt.io>
* Merge remote-tracking branch 'origin/5.12' into devLiang Qi2018-12-041-1/+1
|\ | | | | | | | | | | | | Conflicts: src/gui/painting/qdrawhelper.cpp Change-Id: I4916e07b635e1d3830e9b46ef7914f99bec3098e
| * CoreText: Remove handling of QFontEngineMulti's highByteTor Arne Vestbø2018-11-301-1/+1
| | | | | | | | | | | | | | | | | | | | | | It's a leftover from when the Cocoa plugin used QFontEngineMulti exclusively. Nowadays QFontEngineMulti will strip out the highByte before calling into the real engine. Left an assert just in case.. Change-Id: I6cb26d20a908d7c3aaf096297fca160805fdb85b Reviewed-by: Simon Hausmann <simon.hausmann@qt.io> Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* | Handle fonts that have commas/quotes in the family nameAndy Shaw2018-11-081-1/+1
|/ | | | | | | | | | | | | | | | | | | | | | | | Since the comma character was originally used as a separator, we need to extend QFont to have setFamilies() so that we can avoid joining the family strings together. This enables us to see the family name as a single string and for multiple family names, we have families(). Subsequently, this has added functions to QTextCharFormat to account for multiple font families too. So it is now possible to set a single one directly with setFontFamily() and multiple ones with setFontFamilies(). This also bumps up the datastream version to 19 as QFont now streams the families list as well. [ChangeLog][QtGui][QFont] Add setFamilies()/families() to aid using of font families with commas and quotes in their name. [ChangeLog][Important Behavior Changes] QDataStream version bumped up to 19 to account for changes in the serialization of QFont. Fixes: QTBUG-46322 Change-Id: Iee9f715e47544a7a705c7f36401aba216a7d42b0 Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Merge remote-tracking branch 'origin/5.11' into 5.12Qt Forward Merge Bot2018-10-211-1/+1
|\ | | | | | | Change-Id: Iaf28977e7ecf566b28b9406dcb005d48621169c2
| * Fix enum passed to QFontDatabase::findFontAllan Sandfeld Jensen2018-10-161-1/+1
| | | | | | | | | | | | | | | | The script taken here is a QChar::Script, not a QFontDatabase::WritingSystem. This means it was passing QChar::Unknown. Change-Id: I919ae7187ba277346a7719116a94776dce24dd84 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* | Silence warning in gcc 4.9 for AndroidEskil Abrahamsen Blomfeldt2018-08-301-1/+1
|/ | | | | | | | When building with warnings are errors for Android with gcc 4.9, it wrongfully fails on use of uninitialized variable. Change-Id: I39c5e8413c30567fba60cbba6a8b26d537c5836e Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
* QFontEngine: use QStringBuilder moreAnton Kudryavtsev2018-01-181-7/+6
| | | | | Change-Id: I7dd00080962a245e5fc67ef623d7b3a4dab69c80 Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* Merge remote-tracking branch 'origin/5.10' into devLiang Qi2018-01-111-2/+35
|\ | | | | | | | | | | | | | | | | Conflicts: src/3rdparty/harfbuzz-ng/src/hb-private.hh src/sql/doc/snippets/code/doc_src_sql-driver.cpp src/sql/doc/src/sql-driver.qdoc Change-Id: I38f0e82fcd37926cbf3c1915e009a731040d4598
| * Merge remote-tracking branch 'origin/5.9' into 5.10Liang Qi2018-01-091-2/+35
| |\ | | | | | | | | | Change-Id: I840849c072075a69819eb185b20bc42c3de0f825
| | * Fix ZWJ and ZWNJ when fallback font is in useEskil Abrahamsen Blomfeldt2018-01-091-0/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When applying fallback fonts to characters that are joined by ZWJ or ZWNJ, we also have to set the same font for the control characters, otherwise we will split the text and the necessary shaping will not take place. This was reported for emojis, but will probably also happen for Indic scripts where joiners are used predominately. [ChangeLog][QtGui][Text] Fixed ZWJ and ZWNJ control characters when fallback fonts are in use. Task-number: QTBUG-65519 Change-Id: Ia37233f3319b95af68ae6053c29997eac65448e0 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
| | * Fix fallback fonts for non-common writing systemEskil Abrahamsen Blomfeldt2018-01-081-2/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When we request fallback fonts, we cannot discriminate the fonts based on the writing system support. This is especially important since common script is now merged with other scripts, meaning that a common script character will always go through the fallback mechanism when not supported by the main font. When drawing for instance a string of Devanagari characters on macOS, we would get a list of 33 fallback fonts, but almost all of them would be the default Devanagari font, since none of the other fallbacks would support that script. Meaning that we would just check the same font over and over, which makes no sense. The fallback list has been retrieved specifically for the given script, so we do not need to consider that when fetching the fonts. For most of the common set, we will not have noticed the bug, because at least one of the writing system-specific fallbacks will have had support for latin characters as well. But when trying to mix emojis and some non-common script, we would get a box in place of the emoji, which had been adopted to the main script and would only be looked for in the fonts supporting this. Note that this exposed an issue with the QRawFont test on some systems. When the sample text contained a space, it would be possible to get a fallback font for this character, since we now effectively support fallbacks. This is not the correct behavior, but it is unrelated to this fix, and it was not what the QRawFont::unsupportedWritingSystem() test was written to check. I have therefore removed the space from the sample text to make the test pass, and will make a separate task of fixing the issue of merging fonts for whitespace characters. [ChangeLog][QtGui][Text] Fixed a bug where mixing different writing systems with emojis could lead to missing glyphs. Task-number: QTBUG-61882 Change-Id: I00f6043bb01af1f2277723ccf643034aebf3e18f Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
* | | Replace Q_NULLPTR with nullptr where possibleKevin Funk2017-09-191-3/+3
|/ / | | | | | | | | | | | | | | | | | | | | | | | | Remaining uses of Q_NULLPTR are in: src/corelib/global/qcompilerdetection.h (definition and documentation of Q_NULLPTR) tests/manual/qcursor/qcursorhighdpi/main.cpp (a test executable compilable both under Qt4 and Qt5) Change-Id: If6b074d91486e9b784138f4514f5c6d072acda9a Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* / Add API to disable text shaping on fontsEskil Abrahamsen Blomfeldt2017-07-261-3/+1
|/ | | | | | | | | | | | | | | | | | | | | | In the past, we had an undocumented text flag that worked with one of the QPainter::drawText() overloads. This was never intended as public API and served a specific cause in Qt WebKit at one point. But there is a general need for such API, as disabling shaping features easily gives 25% performance improvement on text rendering even for fairly short strings. This patch adds a new style strategy flag to disable shaping and will just uses the CMAP and HDMX tables to get glyph indices and advances for the characters. In Qt 6, the TextBypassShaping flag can be removed completely and be replaced by the style strategy. [ChangeLog][QtGui][Text] Added QFont::PreferNoShaping style strategy to support improvements to performance at the expense of some cosmetic font features. Task-number: QTBUG-56728 Change-Id: I48e025dcc06afe02824bf5b5011702a7e0036f6d Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Optimize debug builds when -Og is availableAllan Sandfeld Jensen2017-01-261-1/+1
| | | | | | | | | | | | | Enables optimizing with -Og if GCC has the option available, this should produce faster debug binaries without compromising debugability. Is a privateConfig to limit it to the default Qt build. Includes two fixes for false positives of maybe_uninitialized triggered by -Og on gcc 4.9. Change-Id: I466d7a4070295714189024369312e6cbd36cfacf Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
* Enable gamma-correction on a face-by-face basisAllan Sandfeld Jensen2017-01-241-0/+5
| | | | | | | | | | | Changes how we control if gamma-correction is done, and enables it for the freetype CFF engine when stem-darkening is available. The new code replaces existing hacks to force gamma-correction off when using Freetype on X11 and Windows. Change-Id: Ic703ca6965a3d81b204349e10f406c991b292edd Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* Merge "Merge remote-tracking branch 'origin/5.7' into 5.8" into refs/staging/5.8Liang Qi2016-11-241-0/+1
|\
| * Merge remote-tracking branch 'origin/5.7' into 5.8Liang Qi2016-11-241-0/+1
| |\ | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/network/socket/qnativesocketengine_winrt.cpp tools/configure/configureapp.cpp tools/configure/environment.cpp Change-Id: Ieae6f2ee004a87f041751852b687484f91ee4480
| | * Merge remote-tracking branch 'origin/5.6' into 5.7Liang Qi2016-11-231-0/+1
| | |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This also reverts commit 0d2f0164f45cb626c40a7c95026ba00fa56ac249. Conflicts: header.BSD-NEW qmake/Makefile.win32 src/openglextensions/qopenglextensions.cpp src/openglextensions/qopenglextensions.h src/winmain/qtmain_win.cpp src/winmain/qtmain_winrt.cpp tools/configure/configureapp.cpp util/glgen/qopenglextensions.cpp.header util/glgen/qopenglextensions.h.header Change-Id: If26c6f4111b342378dd88bbdc657e322d2ab6ad8
| | | * QFontEngine: Cache whether or not a font can be smoothly scaledRobin Burchell2016-11-151-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This will be used by QtQuick to correct a performance regression introduced by 592614ea3ecd90ede2ae1b8e6579d1b898f474ec -- QFontDatabase::isSmoothlyScalable is quite computationally expensive; and now it is unconditionally expensive regardless of the platform. Change-Id: I82bfa65a963c6c3c276d574f2b379da4a9ba5b69 Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com> Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* | | | Use harfbuzz feature to check for HarfBuzzLars Knoll2016-11-241-5/+5
|/ / / | | | | | | | | | | | | | | | | | | instead of defining a special macro for it. Change-Id: I715380717f7d871571f663be30b73f7d95d83d71 Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
* | | Merge remote-tracking branch 'origin/5.7' into 5.8Liang Qi2016-08-291-31/+28
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | cf53aa21bf0f8fbd13c0ce2d33ddf7bc63d0d76a and 3aaa5d6b32130d3eeac872a59a5a44bfb20dfd4a were reverted because of reconstruction in 5.7. defineTest(qtConfTest_checkCompiler) in configure.pri is smart enough to cover the case in a9474d1260a8c8cc9eae14f2984098919d9684e5. DirectWrite: Fix advances being scaled to 0 Since 131eee5cd, the stretch of a font can be 0, meaning "whatever the font provides". In combination with ec7fee96, this would cause advances in the DirectWrite engine to be scaled to 0, causing the QRawFont test to fail. Conflicts: configure mkspecs/features/uikit/device_destinations.sh mkspecs/features/uikit/xcodebuild.mk src/corelib/global/qglobal.cpp src/corelib/global/qnamespace.qdoc src/plugins/platforms/cocoa/qcocoamenuitem.h src/plugins/platforms/windows/qwindowsservices.cpp src/plugins/platformthemes/gtk3/qgtk3dialoghelpers.cpp src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp src/widgets/kernel/qapplication.cpp tests/auto/widgets/dialogs/qfiledialog/tst_qfiledialog.cpp tests/auto/widgets/dialogs/qfiledialog2/tst_qfiledialog2.cpp Change-Id: I4656d8133da7ee9fcc84ad3f1c7950f924432d1e
| * | Merge remote-tracking branch 'origin/5.6' into 5.7Liang Qi2016-08-251-31/+28
| |\| | | | | | | | | | | | | | | | | | | | | | Conflicts: src/corelib/mimetypes/qmimeprovider.cpp src/corelib/mimetypes/qmimetype.cpp Change-Id: Ib483ddb6bfc380e7c8f195feca535703814c3872
| | * Limit glyph caches per QFontEngine to four per context, not four in totalTor Arne Vestbø2016-08-241-31/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The limitation of four glyph caches per font engine was to prevent memory spikes during rotation of text. But in an application with multiple top level OpenGL windows, each with their own context, we'd end up trashing the list of glyph caches during rendering, even if each window just drew the same static text. Having a shared context between the windows helped a bit, but had other performance issues due to the globally shared state, so the better approach is to limit the caches to four per context. This brings the multiwindow manual test from a grinding 4fps on macOS to a smooth 60fps for 20 concurrent windows. Task-number: QTBUG-52372 Change-Id: I26edd5f6edb5c7818e14b2203af062df19ae7127 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | | Added capHeight() to QRawFont and QFontMetrics(F)Konstantin Tokarev2016-08-151-0/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Cap height is an important metric of font, in particular it is required to make decent implementation of "initial-letter" CSS property in QtWebKit. Note that some fonts lack cap height metadata, so we need to fall back to measuring H letter height. Change-Id: Icf69d92159d070889085e20d31f2e397d796d940 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* | | Merge remote-tracking branch 'origin/5.7' into devLiang Qi2016-06-131-2/+1
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: config_help.txt configure mkspecs/features/uikit/sdk.prf src/corelib/global/qhooks.cpp src/corelib/io/qfilesystemwatcher.cpp src/corelib/io/qlockfile_unix.cpp src/corelib/tools/qalgorithms.h src/gui/kernel/qwindowsysteminterface.h src/gui/text/qtextdocument_p.cpp src/network/access/access.pri src/network/access/qnetworkaccessmanager.cpp src/network/access/qnetworkreplynsurlconnectionimpl.mm src/src.pro src/testlib/qtestcase.cpp src/widgets/kernel/qwidgetbackingstore_p.h src/widgets/styles/qwindowscestyle.cpp src/widgets/styles/qwindowsmobilestyle.cpp tests/auto/corelib/io/qdiriterator/qdiriterator.pro tests/auto/corelib/io/qfileinfo/qfileinfo.pro tests/auto/gui/kernel/qwindow/BLACKLIST tests/auto/widgets/dialogs/qfilesystemmodel/tst_qfilesystemmodel.cpp tools/configure/configureapp.cpp Change-Id: Ibf7fb9c8cf263a810ade82f821345d0725c57c67
| * | Merge remote-tracking branch 'origin/5.6' into 5.7Liang Qi2016-06-061-2/+1
| |\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: .qmake.conf config.tests/unix/nis/nis.cpp mkspecs/unsupported/freebsd-g++/qplatformdefs.h src/corelib/tools/qdatetime.cpp src/corelib/tools/qsimd.cpp src/corelib/tools/qsimd_p.h src/network/access/access.pri src/network/access/qnetworkreplynsurlconnectionimpl.mm src/network/access/qnetworkreplynsurlconnectionimpl_p.h src/plugins/platforms/cocoa/qnsview.mm src/plugins/printsupport/windows/qwindowsprintdevice.cpp tests/auto/corelib/kernel/qobject/tst_qobject.cpp tests/auto/network/access/qnetworkreply/BLACKLIST tests/auto/widgets/widgets/qopenglwidget/BLACKLIST Change-Id: I4b32055bbf922392ef0264fd403405416fffee57
| | * Fix bugs causing Thin font weights to be ignored or mishandled.Jake Petroules2016-06-011-2/+1
| | | | | | | | | | | | | | | | | | Task-number: QTBUG-53196 Change-Id: If12b3cab3d8de5e0e452fca844b0a484c29e9e86 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* | | Add line feed and carriage return to blacklisted charactersEskil Abrahamsen Blomfeldt2016-05-241-2/+10
|/ / | | | | | | | | | | | | | | | | | | | | In order to avoid loading and checking all fonts on the system when the string contains a line separator, we blacklisted it in 98a23b974509bd1b6d9459e6c79677bdcbaa0108 in Qt 4. The same logic applies for paragraph separators, line feeds and carriage returns. Task-number: QTBUG-51934 Change-Id: I121dce17a8ac79b5b790e24c6596438e501e871a Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
* | Merge remote-tracking branch 'origin/5.6' into 5.7Liang Qi2016-04-041-0/+5
|\| | | | | | | Change-Id: I35ca979395620e104e50b06366d0869433a4ffc2
| * QFontEngine: Add handle() functionGabriel de Dietrich2016-03-291-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Both QFont::handle() and QFont::freetypeFace() used to be available in Qt 4 but were removed in Qt 5. There's currently no API to get access to the native font handle, which the font engine holds in a way or another. Similar to the way it was in Qt 4, the actual handle type depends on the font engine currently in use. The types map as follows: Font Engine Native Handle ------------------------------------ DirectWrite IDWriteFontFace * Freetype FT_Face Mac CTFontRef Win HFONT All other font engines return a null handle. Change-Id: I3bea8259ac1378fd24079723aa6603bf9e74834c Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>
* | QFontEngine: use RAII for font_, face_ membersMarc Mutz2016-03-041-19/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Wrap the pairs of (void *ptr, void (*dtor)(void*)) in essentially a std::unique_ptr. This simplifies code and provides the correct implicit destruction, so we can drop the explicit glyph-cache clear()ing in ~QFontEngine(), leaving that job to ~QLinkedList. A subsequent change will turn the QLinkedList into a C array, the clearing of which would otherwise cause excessive code bloat. Since we can't use std::unique_ptr, yet, provide a hand-rolled replacement for now, marking it for replacement with unique_ptr once we can use it. Make that a local type instead of providing a Qt-wide unique_ptr so we don't accidentally lock ourselves into a half-baked std clone we can't get rid of anymore. To prepare unique_ptr use with the same type-erased deleter (function pointer) as now, replace a nullptr destroy_function with a no-op function, so ~unique_ptr doesn't crash when we port to it later. Because QFreetypeFace contains the same construct and shares payloads with QFontEngine, use the Holder there, too. Even saves 150b in text size on optimized GCC 5.3 AMD64 builds. Change-Id: I5ca11a3e6e1ff9e06199124403d96e1b280f3eb2 Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com> Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* | Merge remote-tracking branch 'origin/5.6' into 5.7Liang Qi2016-02-181-4/+4
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | This also reverts commit 018e670a26ff5a61b949100ae080f5e654e7bee8. The change was introduced in 5.6. After the refactoring, 14960f52, in 5.7 branch and a merge, it is not needed any more. Conflicts: .qmake.conf src/corelib/io/qstandardpaths_mac.mm src/corelib/tools/qsharedpointer_impl.h tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp Change-Id: If4fdff0ebf2b9b5df9f9db93ea0022d5ee3da2a4
| * QtGui: Use QImage::constBits()/constScanLine() in non-const contexts.Friedemann Kleint2016-02-131-4/+4
| | | | | | | | | | | | | | | | | | Prevent potential detaching by using constBits()/constScanLine() instead of bits()/scanLine(). Change-Id: If03f8d4d3b8ed4c07aed5eff7f580e57ca771919 Reviewed-by: Gunnar Sletta <gunnar@sletta.org> Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* | Merge remote-tracking branch 'origin/5.6' into devLiang Qi2016-02-021-1/+1
|\| | | | | | | | | | | | | | | | | Conflicts: config.tests/unix/compile.test src/plugins/platforms/cocoa/qcocoahelpers.mm src/tools/qlalr/cppgenerator.cpp Change-Id: I0103ca076a9aca7118b2fd99f0fdaf81055998c3
| * QFont*: Optimize by caching the QFontCache::instance() resultKonstantin Ritt2016-01-261-1/+1
| | | | | | | | | | | | | | | | | | | | The QFontCache instance is stored in QThreadStorage and thus calling QFontCache::instance() isn't really cheap; avoid calling it multiple times where possible. Change-Id: I1b7a83089698a06c49dac08b2a3a8e9c3c75a500 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com> Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>
* | Updated license headersJani Heikkinen2016-01-151-14/+20
|/ | | | | | | | | | | From Qt 5.7 -> LGPL v2.1 isn't an option anymore, see http://blog.qt.io/blog/2016/01/13/new-agreement-with-the-kde-free-qt-foundation/ Updated license headers to use new LGPL header instead of LGPL21 one (in those files which will be under LGPL v3) Change-Id: I046ec3e47b1876cd7b4b0353a576b352e3a946d9 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* Fix falsely reported style for fallback fontEskil Abrahamsen Blomfeldt2015-11-161-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In change 8f6b3284106fa11129e4fa6e5ec3adc6cb1f489f we override the fontDef of the fallback font with the fontDef of the original font (with the family name replaced) to fix a regression where boldness was not inherited by the fallback font. This caused a bug, though, since the contents of the fontDef would now misrepresent the actual font used. The side effect of this was that isSmoothlyScalable() returned false because the family and styleName combination we claim to have did not exist in the font database. Result: We fell back to native rendering for the font even though it's scalable. Weight and style are the only parts that should be inherited, since they are synthesized. So rather than overwriting the fontDef completely, we copy the weight and style when needed. The bug in QTBUG-42963 is still fixed after this change. [ChangeLog][Text] Fixed problem where fallback fonts for text with certain styles would be reported as unscalable. Change-Id: I95ef67f818852aea5a6ae8df789a52364ecb59a6 Task-number: QTBUG-47547 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com> Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
* QFontEngine: Check for AAT support only with HB-NGKonstantin Ritt2015-11-131-5/+3
| | | | | | | HB-old is unable to handle these anyways. Change-Id: Ibe69b5d030134b8a0a76dc966b6dfc6b5ff9a883 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* Remove historical +4 padding in QFontEngine::alphaMapForGlyph()Eskil Abrahamsen Blomfeldt2015-10-271-1/+1
| | | | | | | | | | | | | | | | | | | | | | Back in the old days, we would pad the output from the font engines to work around problems with the GL1 paint engine such as issues with linear sampling, etc. This is no longer needed. Padding is moved into the glyph cache, and in addition to reducing performance, the extra padding is also making alphaMapForGlyph() and alphaMapBoundingBox() fall out of sync when you fall back to QPainterPath drawing the glyph. The result of this was that, when prepared, the glyph cache was sometimes not made large enough to hold what alphaMapForGlyph() actually produced, depending on the size and order of glyphs, and glyphs ending up at the end of rows would sometimes be missing from the output. [ChangeLog][Text] Fixed some instances of missing glyphs when drawing large fonts. Change-Id: Ia5982392fe1637f6ebc740db9f226fbb91f75166 Task-number: QTBUG-47547 Reviewed-by: Gunnar Sletta <gunnar@sletta.org> Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
* Support overlapping contours in glyph rasterizer fallbackEskil Abrahamsen Blomfeldt2015-10-261-0/+1
| | | | | | | | | | | | | | | | | | Truetype fonts should be rasterized with a winding fill as documented in e.g. Microsoft's specs. Failing to do this caused a bug when doing native rendering in Qt Quick for fonts that were large enough that the fallback path was taken when drawing the glyphs into the cache. If the glyph had overlapping contours, they would be subtracted from the shape. [ChangeLog][Text] Fixed an uncommon rendering error with fonts containing overlapping contours. Task-number: QTBUG-41197 Change-Id: I0e4a4432ba3f902bc3ea59d8f4dbd12a295630b2 Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
* QFontEngine: Read minimum left and right glyph bearings from 'hhea' tableTor Arne Vestbø2015-09-221-19/+55
| | | | | | | | | | | | | | This table has values precomputed based on every single glyph in the font, not just the subset we use as a fallback, which should improve both performance and correctness. The fallback codepath of computing the minimum values based on a subset of the characters in the font is left in, as we still need that for bitmap fonts, and some font tables that have invalid values. Change-Id: I71aac1e09c9f9de80446b023ba15a9e2afe7d226 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>
* Move min left/right bearing calculations to QFontEngine baseclassTor Arne Vestbø2015-09-021-6/+54
| | | | | | | | | | | | | | | | The logic used in the FreeType font engine can be generalized and move to the QFontEngine baseclass. This allows the CoreText font engine to correctly report the minimum left/right bearings, which decreases the chance that an optimization in QTextLayout's line breaking algorithm will produce wrong results. The calculation of left and right bearing has been moved to the glyph_metrics_t type to reduce code duplication. This allows us to use the with and height of the bounding box to determine if the glyph has any contours. Change-Id: I864697d3f31ed56f22f04666199b6c5023c5e585 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>
* Merge "Merge remote-tracking branch 'origin/5.4' into 5.5" into refs/staging/5.5Oswald Buddenhagen2015-08-121-51/+161
|\
| * Merge remote-tracking branch 'origin/5.4' into 5.5Oswald Buddenhagen2015-07-171-51/+161
| |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: doc/global/manifest-meta.qdocconf src/corelib/global/qnamespace.qdoc src/corelib/io/qstorageinfo_unix.cpp src/corelib/tools/qtools_p.h src/sql/drivers/psql/qsql_psql.cpp Change-Id: I23a15ac84e03ad61d865e3df872b013eb0752949
| | * Better handling of invalid font tables5.4Eskil Abrahamsen Blomfeldt2015-07-101-51/+161
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Specifically when reading files with broken cmap tables, we could get some undeterministic results. We handle this more gracefully by verifying that the offsets are sane and bailing out early if not. This replaces the current pattern throughout the font engine for consistency. Change-Id: I507bba49c0be634afca77d1eb3d199a427451bee Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | | [QFontDatabase] Defer the fallback families list initializationKonstantin Ritt2015-07-311-7/+7
|/ / | | | | | | | | | | | | | | | | | | Use the same trick the WebKit related path has used for years: if there is no explicit list that takes a precedence over the default one (i.e. QFont("Arial,SimHei")), then defer the fallback families list initialization until it gets requested. Change-Id: If5a74294bdebb24865c619bc0d7328b3e706de76 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>