summaryrefslogtreecommitdiffstats
path: root/src/gui/text/qfont.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Doc: Describe updating fonts with substitutes5.14Leena Miettinen2020-04-241-1/+10
| | | | | | Fixes: QTBUG-82577 Change-Id: I40662240da69c0d93d0386172c10f375fbb5fefc Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Merge remote-tracking branch 'origin/5.13' into 5.14Qt Forward Merge Bot2019-11-061-1/+6
|\ | | | | | | | | | | | | | | | | | | | | Conflicts: .qmake.conf mkspecs/features/mac/default_post.prf src/corelib/tools/qsimd_p.h src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm util/qfloat16-tables/gen_qfloat16_tables.cpp Change-Id: If48fa8a3bc3c983706b609a6d3822cb67c1352a4
| * If only family is set, prefer that in the families list after resolvingAndy Shaw2019-11-051-1/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If a font with only a family set is resolved with one that has been setup with setFamilies() then the family needs to be prepended to the families list after resolving. This is so that the font still prefers the one set as just a family with no famillies set. This also amends the QFontDialog test to account for this too. [ChangeLog][QtGui][Text] Resolving a font that just has a family set with families set will prepend the family to the families so that it is still the first preference for the font. Task-number: QTBUG-46322 Change-Id: Icc4005732f95b2b4c684e592b06b31e133270e44 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* | Fix double free when debug printing QFont with non-default verbosityTor Arne Vestbø2019-10-081-2/+1
| | | | | | | | | | | | Change-Id: Ieb7fa19e8bdd98f5283f7f6d8751e6532c8e0fc4 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* | Merge remote-tracking branch 'origin/5.13' into 5.14Liang Qi2019-09-301-5/+6
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/corelib/global/qrandom.cpp src/corelib/io/qfileinfo.cpp src/corelib/kernel/qeventdispatcher_win.cpp src/corelib/kernel/qeventdispatcher_win_p.h src/gui/text/qfontdatabase.cpp src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm src/plugins/platforms/windows/qwindowsglcontext.cpp src/testlib/qtestcase.cpp Done-With: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Done-With: Edward Welbourne <edward.welbourne@qt.io> Change-Id: I4893212471aa24be804c989a581810e2f714545c
| * Ensure that QFont::fromString() doesn't parse empty font specificationsShawn Rutledge2019-09-241-5/+6
| | | | | | | | | | | | | | | | Fixes: QTBUG-78236 Change-Id: Iba060e7a24080cdc8f317ecb6dc616b2cd918acb Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de> Reviewed-by: Konstantin Shegunov <kshegunov@gmail.com> Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* | QFont: remove unused member QFontPrivate::screenChristian Ehrlicher2019-08-221-5/+3
| | | | | | | | | | | | | | | | | | QFontPrivate::screen was not used anywhere so remove it. Change-Id: Ie9381d08b59b93c4e7bcaad58ebf1b389aa0a2e6 Reviewed-by: Thorbjørn Lund Martsum <tmartsum@gmail.com> Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com> Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* | QtGui: port from QMutex::Recursive to QRecursiveMutexMarc Mutz2019-07-061-1/+1
| | | | | | | | | | Change-Id: I1ce4fcfa1bfb9a89fe3ebe61d049b9b3100fd700 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Optimize some atomic countersMarc Mutz2019-06-271-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | Define the static QAtomic at file scope to avoid GCC's pessimisation with function-static QAtomic (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79561), and make sure the initial value is 0, so it ends up in BSS, not TEXT. In QRhi..., don't create a static instance of the wrapper class, use a file- static atomic, too. This turns the class into a glorified namespace. Change-Id: I707f628e2b434330028077223071716d5704ba32 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Port from QAtomic::load() to loadRelaxed()Giuseppe D'Angelo2019-06-201-15/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Semi-automated, just needed ~20 manual fixes: $ find \( -iname \*.cpp -or -iname \*.h \) -exec perl -pe 's/(\.|->)load\(\)/$1loadRelaxed\(\)/g' -i \{\} + $ find \( -iname \*.cpp -or -iname \*.h \) -exec perl -pe 's/(\.|->)store\(/$1storeRelaxed\(/g' -i \{\} + It can be easily improved (e.g. for store check that there are no commas after the opening parens). The most common offender is QLibrary::load, and some code using std::atomic directly. Change-Id: I07c38a3c8ed32c924ef4999e85c7e45cf48f0f6c Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* | Merge remote-tracking branch 'origin/5.13' into devLiang Qi2019-06-141-1/+1
|\| | | | | | | | | | | | | | | | | | | Conflicts: qmake/generators/makefile.cpp qmake/generators/unix/unixmake2.cpp src/corelib/thread/qthread_unix.cpp tests/auto/corelib/tools/qsharedpointer/tst_qsharedpointer.cpp Change-Id: I1df0d4ba20685de7f9300bf07458c13376493408
| * Merge remote-tracking branch 'origin/5.12' into 5.13Qt Forward Merge Bot2019-06-141-1/+1
| |\ | | | | | | | | | Change-Id: I53a50669face6f68ddc046fd2102de8c1f888b4b
| | * Don't count all engines as "in use" in cacheEskil Abrahamsen Blomfeldt2019-06-091-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Back in 36cb3f3f655a9090c82de609010cbfb88651a0f3, we started properly reference counting font engines as they were entered into the font cache. Prior to this, ref.load == 0 would mean that the engine was essentially owned by the cache. When the change was made, the condition that an engine must be in use if its reference is != 0 remained, and the result of this was used to calculate the limit for when the cache should be flushed. Since this limit was miscalculated, the cache would keep growing, even if it only contained unused font engines. [ChangeLog][QtGui][Text] Fixed a bug which could cause the font cache to grow larger than it was supposed to. Task-number: QTBUG-76219 Change-Id: I4d1541756f3bdf5bd9b0301bf47c6db2e220716a Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
* | | Replace Q_DECL_NOEXCEPT with noexcept in QtGuiAllan Sandfeld Jensen2019-04-051-1/+1
| | | | | | | | | | | | | | | Change-Id: I43803b88fea8083782d73ce157c466b022208740 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | | Merge remote-tracking branch 'origin/5.13' into devQt Forward Merge Bot2019-02-201-0/+3
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp Added tests/auto/testlib/selftests/expected_crashes_5.txt to work round the output of the crashes test (which exercises UB, see QTBUG-73903) being truncated on one test platform. Change-Id: I9cd3f2639b4e50c3c4513e14629a40bdca8f8273
| * | Add deprecation exclusion around deprecated calls in deprecated codeFriedemann Kleint2019-02-061-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fix: io/qdir.cpp:1087:16: warning: ‘static void QResource::addSearchPath(const QString&)’ is deprecated: Use QDir::addSearchPath() instead [-Wdeprecated-declarations] io/qprocess.cpp:1178:34: warning: ‘void QProcess::finished(int)’ is deprecated: Use QProcess::finished(int, QProcess::ExitStatus) instead [-Wdeprecated-declarations] image/qpixmap.cpp:997:48: warning: ‘static QPixmap QPixmap::grabWidget(QObject*, const QRect&)’ is deprecated: Use QWidget::grab() instead [-Wdeprecated-declarations] text/qfont.cpp:2218:29: warning: ‘QString QFont::lastResortFamily() const’ is deprecated [-Wdeprecated-declarations] itemviews/qitemdelegate.cpp:1008:41: warning: ‘static QPixmap* QPixmapCache::find(const QString&)’ is deprecated: Use bool find(const QString &, QPixmap *) instead [-Wdeprecated-declarations] Change-Id: I51259edc175b1f55f61ded3af50ebfffd8c304a8 Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
* | | Allow more fine grained control over QFont debug outputTor Arne Vestbø2019-02-111-1/+98
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | With verbosity level 0, only the resolved properties are included in the debug output, which is useful when debugging font resolving. With verbosity level 1, the family, size, and weights are included, plus any resolved property that is different from the default value. Verbosity level 2, the QDebug default, has been kept unchanged, except removing quotes and spaces by adding nospace() and qPrintable. Verbosity level 3 includes all properties, regardless of whether or not they have been resolved. Levels 1 and 3 also include the resolve mask, to aid debugging. This gives the following results for a QFont set to 100pt: QFont(100pt) QFont(".SF NS Text", 100pt, Weight::Normal, resolveMask=SizeResolved) QFont(.SF NS Text,100,-1,5,50,0,0,0,0,0) QFont(".SF NS Text", 100pt, StyleHint::AnyStyle, StyleStrategy::PreferDefault, Weight::Normal, StyleNormal, underline=false, overline=false, strikeOut=false, fixedPitch=false, AnyStretch, kerning=true, MixedCase, letterSpacing=0 (PercentageSpacing), PreferDefaultHinting, styleName="", resolveMask=SizeResolved) Change-Id: Ib4aebd7346ef4a2946cc4450c12730cf7844c3bc Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | Use QStringLiteral instead of QString::fromLatin1Frederik Gladhorn2018-12-201-1/+1
| | | | | | | | | | | | | | | | The value is returned, so it would be converted to QString anyway. This saves the allocation. Change-Id: I1a4ec4e16bccdd23e662be9b3dd7f8f09b4197ee Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
* | Use a QMultiMap for the fontengine cacheLars Knoll2018-12-071-2/+2
| | | | | | | | | | | | | | Cosmetic, so we can avoid using QMap::insertMulti(). Change-Id: If7c971e127af0537dd28bd25f7803804e7e01170 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* | Merge remote-tracking branch 'origin/5.12' into devLiang Qi2018-11-221-1/+1
|\| | | | | | | | | | | | | | | | | | | Conflicts: src/corelib/io/qdir.cpp src/corelib/kernel/qtimer.cpp src/corelib/kernel/qtimer.h Done-With: Edward Welbourne <edward.welbourne@qt.io> Change-Id: I683d897760ec06593136d77955f8bc87fdef3f9f
| * Doc: Qt GUI: Fix documentation warningsTopi Reinio2018-11-061-1/+1
| | | | | | | | | | | | | | | | | | These are minor typos or documentation warnings that snuck in with new features. Task-number: QTBUG-71502 Change-Id: I03669cfecc3c3d80168ff7b1ca8bca7571e06d25 Reviewed-by: Martin Smith <martin.smith@qt.io>
* | Fix constness of QPaintDevice argumentsLuca Beldi2018-11-191-2/+13
| | | | | | | | | | | | | | | | | | | | | | | | QFont, QFontMetrics, QFontMetricsF and QTextLayout constructors use only const methods of QPaintDevice so there is no reason for them to require a non-const pointer argument Fixes: QTBUG-65967 Change-Id: Ibfcdef2a25f0cd4284dad76135fc4c9bf5667d7a Reviewed-by: Samuel Gaist <samuel.gaist@idiap.ch> Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de> Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* | Handle fonts that have commas/quotes in the family nameAndy Shaw2018-11-081-1/+66
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | Deprecate QFont::lastResortFamily() and QFont::lastResortFont()Eskil Abrahamsen Blomfeldt2018-10-091-37/+32
|/ | | | | | | | | | | | | | | | | | | | | | | | These functions have not been used by the font selection algorithm in Qt 5. Calling lastResortFamily() always gave you "helvetica" and lastResortFont() would actually crash. Since we cannot remove them before Qt 6, we deprecate them for now and update the documentation to give a more accurate description of how the font matching works in Qt 5. Note that in the non-native QFontDialog, it tries to implement its own font matching algorithm and therefore was calling lastResortFamily(). Since fixing QFontDialog is not within the scope of this patch, I have just replaced the call by "helvetica" directly, so that it will continue to behave the same. [ChangeLog][QtGui][Text] Deprecated QFont::lastResortFamily() and QFont::lastResortFont() which are not in use in Qt 5 and did not provide any useful information. Task-number: QTBUG-60813 Change-Id: Id8fe7bfdd427292ef86bc8405de03cb466b9b62a Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Modernize the "thread" featureUlf Hermann2018-08-171-13/+0
| | | | | | | | | | Add it to configure.json and replace all occurrences of QT_NO_THREAD with QT_CONFIG(thread). Add conditions for other features that depend on thread support. Remove conditions where we can use the QMutex and QThreadStorage stubs. Change-Id: I284e5d794fda9a4c6f4a1ab29e55aa686272a0eb Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* Doc: Fix wrong link in QFont documentationPaul Wicking2018-08-031-1/+1
| | | | | | Task-number: QTBUG-62072 Change-Id: I587534fc5723b3d198fe2065fbcf1bee4871a768 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Document QFont::PreferNoShaping as being since 5.10Sergio Martins2018-03-051-1/+1
| | | | | | | "since format" copied from QEvent's documentation. Change-Id: Ib11609cd11f9cb9906d947f46c2cd61c7abd853a Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* Merge remote-tracking branch 'origin/5.10' into devLiang Qi2017-11-231-5/+17
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/network/access/qhttp2protocolhandler_p.h src/network/kernel/kernel.pri src/network/ssl/qsslkey_qt.cpp src/plugins/platforms/cocoa/qcocoascreen.mm src/plugins/platforms/windows/accessible/iaccessible2.cpp src/plugins/platforms/windows/accessible/iaccessible2.h src/plugins/platforms/windows/accessible/qwindowsaccessibility.cpp src/plugins/platforms/windows/accessible/qwindowsmsaaaccessible.cpp src/plugins/platforms/windows/accessible/qwindowsmsaaaccessible.h src/widgets/widgets/qmenu_p.h tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp tests/auto/other/qaccessibility/tst_qaccessibility.cpp tests/auto/testlib/selftests/expected_cmptest.lightxml tests/auto/testlib/selftests/expected_cmptest.teamcity tests/auto/testlib/selftests/expected_cmptest.txt tests/auto/testlib/selftests/expected_cmptest.xml Done-with: Edward Welbourne <edward.welbourne@qt.io> Change-Id: I4217cc7d840cbae3e3dd28574741544469c4c6b9
| * Merge remote-tracking branch 'origin/5.9' into 5.10Liang Qi2017-11-151-5/+17
| |\ | | | | | | | | | Change-Id: I2f8f6b1d196548087219739faa3ad1517626da1e
| | * Document interaction of style name and other style propertiesAllan Sandfeld Jensen2017-11-121-5/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Setting style name to "Regular" and then setting bold to true, results in platform depending behavior, and should be avoided. Also removes comment about style name not working on Windows, it has been working since 5.8.0. Task-number: QTBUG-63792 Change-Id: Ie5be7215a673f5751dbeb6512df8ec7bfaef4d0a Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io> Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* | | Replace Q_NULLPTR with nullptr where possibleKevin Funk2017-09-191-2/+2
|/ / | | | | | | | | | | | | | | | | | | | | | | | | 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-0/+5
|/ | | | | | | | | | | | | | | | | | | | | | 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>
* QFont: fix fromString(toString()) when application font has styleNameDavid Faure2017-01-111-0/+2
| | | | | | | | | | The style name needs to be cleared if not present in the string, otherwise the style name from qApp->font() (which propagates to any default-constructed QFont) remains. Change-Id: I9b6522a39a38526cced8a11ed02ae32582026480 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io> Reviewed-by: Konstantin Shegunov <kshegunov@gmail.com>
* Merge dev into 5.8Oswald Buddenhagen2016-08-221-2/+2
|\ | | | | | | Change-Id: I41ee7b50534b01cf042bed8bb8824ba2e5026a29
| * Merge remote-tracking branch 'origin/5.7' into devLiang Qi2016-08-161-2/+2
| |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: qmake/doc/src/qmake-manual.qdoc src/corelib/global/qglobal.cpp src/corelib/tools/qstring.cpp src/network/socket/qabstractsocket.cpp src/network/socket/qnativesocketengine_unix.cpp src/plugins/platforms/eglfs/api/qeglfsglobal.h Change-Id: Id5dfdbd30fa996f9b4b66a0b030b7d3b8c0ef288
| | * Merge remote-tracking branch 'origin/5.6' into 5.7Liang Qi2016-08-131-2/+2
| | |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/corelib/global/qglobal.cpp src/corelib/io/qsettings.cpp src/corelib/itemmodels/qstringlistmodel.cpp tests/auto/gui/image/qimagewriter/tst_qimagewriter.cpp Change-Id: I1c6c306ef42c3c0234b19907914b19da706b4a03
| | | * Doc: Change instances of '(Mac) OS X' to 'macOS'Topi Reinio2016-08-121-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As of version 10.12 (Sierra), the name of Apple's desktop operating system will be macOS. Change the occurrences where the Mac platform is discussed to use a macro \macos, which expands to 'macOS'. This helps with adapting to future renaming. Update the instructions on mac-specific Q_OS_* macro usage. Add a \target for the old 'Qt for OS X' topic to keep links working for other documentation modules that try to link with the old name. Change-Id: Id33fb0cd985df702a4ae4efb4c5fd428e77d9b85 Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
* | | | Avoid synthesizing stretch on condensed font familiesAllan Sandfeld Jensen2016-08-151-5/+11
|/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If an entire font family is condensed or stretched and we match by family name, the default stretch factor of 100 will make the font engine try to synthesize it back to medium stretched font. The existing code is already made to deal with a stretch of 0 that is no longer used. This patch reintroduces 0 stretch to indicate no specific stretch has been requested. Specifically setting stretch to 100 on a QFont will introduce the old behavior. [ChangeLog][QtGui][QFont] The default value of QFont::stretch() is now 0 to indicate any default stretch is acceptable. Task-number: QTBUG-48043 Change-Id: I574747f980fd4f9893df828818aae99a07b41623 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* / / Save QFont's style name if presentKonstantin Shegunov2016-08-031-2/+11
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Font style names are quite irregular and the simplistic matching implemented in QFontDatabase::styleString(const QFont &) is unable to properly resolve the style name when font is recreated from a string. This causes the fonts before and after serialization to be considered different, even though they are not. The from/toString methods were made to write and respect the exact font style. [ChangeLog][QtGui][Important Behavior Changes] QFont::toString() and QFont::key() were modified to save the font's style name if one is set, invalidating any stored font identifiers. QFont::fromString() was also adjusted to accommodate the change. Task-number: QTBUG-54936 Change-Id: Ibc7c54119acdd8f0950d6049cc89f859bf981504 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
* | Merge remote-tracking branch 'origin/5.6' into 5.7Edward Welbourne2016-07-261-3/+5
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/corelib/io/qtemporarydir.cpp One side encapsulated a repeated piece of #if-ery in a local define; the other added to the #if-ery. Made its addition to the other's. src/corelib/kernel/qeventdispatcher_unix_p.h One side moved some members into a struct; this collided with a #undef check that neither side now has. Discarded the #undef part. src/gui/opengl/qopengltexturehelper_p.h 5.7 deleted a bunch of methods; not clear why merge got confused. src/tools/moc/moc.cpp One added a name to the copyright header; another changed its URL. Change-Id: I9e9032b819f030d67f1915445acf2793e98713fa
| * Fix performance regression when changing fontsEskil Abrahamsen Blomfeldt2016-07-221-3/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Change e109b8a0f3c89c595f0da689e7ee847130e2ee47 introduced a performance regression when rapidly switching fonts as long as the number of different fonts is over a relatively small number, since the cost of fonts can be high compared to the limits set on the cache. Since the original patch was intended to avoid exceeding the open file limit when using Freetype on Windows, we add an additional check on the number of engines in the cache as well for the added, synchronous cache flush. The limit is set to 256 to make it unlikely that it is exceeded during a single paint event, but it can also be configured when building Qt if a higher limit is needed. [ChangeLog][QtGui][Text] Fixed performance regression when rapidly switching between a large set of fonts. Task-number: QTBUG-54180 Change-Id: I92b9fbe14fca4f11c9c6dfdcdbec6d19a61b86a7 Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
* | QtGui: use QStringRef to optimize memory allocationAnton Kudryavtsev2016-06-021-2/+2
| | | | | | | | | | | | | | | | | | | | | | Replace substring functions that return QString with corresponding functions that return QStringRef where it's possible. Create QString from QStringRef only where necessary. Change-Id: Id83c60cc7568b20ef008b51c582cfdf466a47e35 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* | QFont::exactMatch() should return false for aliasesEskil Abrahamsen Blomfeldt2016-05-121-3/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a partial revert of 992f233c in Qt 4 repo. The rest of the change cannot be reverted, since it added public API, but that API might be useful anyway. The patch was wrong, basically. QFont::exactMatch() should not claim that you can get an exact match for a typeface alias. It also introduced some weird inconsistencies: For instance, if the first font the alias resolved to in FontConfig did not exist, then exactMatch() would return false, even if it then resolved to the next one which existed. This caused a test failure on OpenSuse, where the preferred font for "sans" is Arial, which doesn't exist, so Roboto will be used instead. [ChangeLog][QtGui][Important Behavior Changes] QFont::exactMatch() now returns false when the provided typeface is an alias. Task-number: QTBUG-46054 Change-Id: I7532d2879b492544620aa0d1d87dd493a4923af9 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* | Merge remote-tracking branch 'origin/5.6' into 5.7Liang Qi2016-03-211-2/+2
|\| | | | | | | | | | | | | | | | | Conflicts: src/widgets/styles/qgtkstyle_p.cpp tests/auto/corelib/io/qtextstream/test/test.pro tests/auto/corelib/plugin/plugin.pro Change-Id: I512bc1b36acf3933ed2b96c00f476ee3819c1f4b
| * Correct qt_defaultDpi X/Y with just a QCoreApplicationAllan Sandfeld Jensen2016-03-161-2/+2
| | | | | | | | | | | | | | | | | | Makes the 96DPI attribute check avoid undefined behavior by using QCoreApplication::instance() directly, instead of calling through qApp, which performs an invalid cast to QGuiApplication. Change-Id: Ib86e7d2461b462a2d623f1364414f7d4d2293f22 Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* | QtGui: eradicate Q_FOREACH loops [already const]Marc Mutz2016-02-111-1/+1
| | | | | | | | | | | | | | | | | | (or trivially marked const) ... by replacing them with C++11 range-for loops. Change-Id: I3cce92b9d77a3ff96fad877d1d989145e530646f Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com> Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* | Merge remote-tracking branch 'origin/5.6' into devLiang Qi2016-02-021-0/+7
|\| | | | | | | | | | | | | | | | | Conflicts: config.tests/unix/compile.test src/plugins/platforms/cocoa/qcocoahelpers.mm src/tools/qlalr/cppgenerator.cpp Change-Id: I0103ca076a9aca7118b2fd99f0fdaf81055998c3
| * QFontCache: Centralize the engine type safety checkKonstantin Ritt2016-01-281-0/+7
| | | | | | | | | | | | | | | | | | We depend on the assumption QFontCache::findEngine(key) for key.multi=1 returns a font engine of type QFontEngine::Multi; guarantee that by checking it in a single place. Change-Id: I287da4fd62deb22fc5520cde5b0505bc44547609 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>
* | Merge remote-tracking branch 'origin/5.6' into devLiang Qi2016-01-211-1/+11
|\| | | | | | | | | | | | | | | | | | | | | Conflicts: src/corelib/io/qiodevice_p.h src/corelib/kernel/qvariant_p.h src/corelib/tools/qsimd.cpp src/gui/kernel/qguiapplication.cpp tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp Change-Id: I742a093cbb231b282b43e463ec67173e0d29f57a
| * Merge remote-tracking branch 'origin/5.5' into 5.6Liang Qi2016-01-191-1/+11
| |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: config.tests/common/atomic64/atomic64.cpp configure src/3rdparty/forkfd/forkfd.c src/corelib/io/forkfd_qt.cpp src/widgets/kernel/qwidgetwindow.cpp tests/auto/corelib/statemachine/qstatemachine/tst_qstatemachine.cpp tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp tools/configure/configureapp.cpp Change-Id: Ic6168d82e51a0ef1862c3a63bee6722e8f138414