summaryrefslogtreecommitdiffstats
path: root/src/gui/text
Commit message (Collapse)AuthorAgeFilesLines
* QTextDocument/QGraphicsTextItem: skip layout in setTextWidth(0)David Faure2022-05-172-5/+10
| | | | | | | | | | | | | | | | | | In a QGraphicsTextItem without a width yet, there's no need to do any layouting. The use case is obviously items with an app-defined size, not the default where text items adapt to their contents. Results: 0.065 msecs to create a QGraphicsTextItem with some text (layouted) 0.036 msecs to set everything up in a QGraphicsTextItem with 0 width QTextEdit was abusing the width 0 to mean "no wrap, width comes from contents", but since the value -1 means that already in QTextDocument, QTextEdit now uses a width of -1 for that meaning. Change-Id: I67ad59c305e5dd34830886e4e6c56dde03c93668 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Use SPDX license identifiersLucie Gérard2022-05-16114-4334/+230
| | | | | | | | | | | | | Replace the current license disclaimer in files by a SPDX-License-Identifier. Files that have to be modified by hand are modified. License files are organized under LICENSES directory. Task-number: QTBUG-67283 Change-Id: Id880c92784c40f3bbde861c0d93f58151c18b9f1 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* Add QTextDocFragment::to/fromMarkdown() & QTextCursor::insertMarkdown()Shawn Rutledge2022-05-144-6/+88
| | | | | | | | | | | | | | | | | | | | | Also add the beginnings of an autotest for QTextCursor::insertHtml(), for comparison purposes. We can see that the block to be inserted is merged with an existing block by default rather than being inserted as a new one, with both HTML and Markdown insertions. So now we test for leading and trailing newlines in the markdown to be inserted, to determine whether we need a new block into which to insert, and to "hit enter" at the end of the insertion. QSKIP the toMarkdown() comparisons if GeneralFont is mono. This happens on Boot2Qt systems in CI. Task-number: QTBUG-76105 Task-number: QTBUG-94462 Task-number: QTBUG-100515 Task-number: QTBUG-103484 Change-Id: I51a05c6a7cd0be4f2817f4a922f45fa663982293 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Atomics: workaround GCC 12 warning about overflowing d->stateThiago Macieira2022-05-111-0/+7
| | | | | | | | | | | | | | | | | | I don't see a way this can be anything but a bogus warning. In member function ‘std::__atomic_base<_IntTp>::__int_type std::__atomic_base<_IntTp>::fetch_or(__int_type, std::memory_order) [with _ITp = int]’, inlined from ‘static T QAtomicOps<X>::fetchAndOrRelaxed(std::atomic<T>&, typename QAtomicAdditiveType<T>::AdditiveT) [with T = int; X = int]’ at qatomic_cxx11.h:449:33, inlined from ‘T QBasicAtomicInteger<T>::fetchAndOrRelaxed(T) [with T = int]’ at qbasicatomic.h:168:36, inlined from ‘int switch_on(QAtomicInt&, int)’ at qfutureinterface.cpp:97:31, inlined from ‘void QFutureInterfaceBase::setThrottled(bool)’ at qfutureinterface.cpp:194:18: atomic_base.h:648:33: warning: ‘unsigned int __atomic_or_fetch_4(volatile void*, unsigned int, int)’ writing 4 bytes into a region of size 0 overflows the destination [-Wstringop-overflow=] A few more of those appear in other modules. I'm not fixing them all, assuming GCC will soon fix the warning. Pick-to: 6.2 6.3 Change-Id: I7fb65b80b7844c8d8f26fffd16e93f68e278d048 Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* Fix -no-freetype build on WindowsEskil Abrahamsen Blomfeldt2022-05-111-1/+3
| | | | | | | | | Just a missing #ifdef. Pick-to: 6.2 6.3 Fixes: QTBUG-103370 Change-Id: I4fc4605317d423acbf6280307362a087e427761b Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* QWidgetTextControl: port to new-style connects (faster)David Faure2022-05-102-3/+4
| | | | | | | | | | | | | | | This speeds up creating a QGraphicsTextItem by 14% in an optimized build Before: 0.070 msecs per iteration After: 0.060 msecs per iteration Those connects were showing up when profiling, because of the string parsing that is necessary when using SIGNAL/SLOT macros. The stacktrace was connect() => decodeMethodSignature() => argumentTypesFromString() => QArgumentType constructor => qMetaTypeInternal(const char*). Pick-to: 6.3 6.2 5.15 Change-Id: I3cf5655c5450f121005140bdb587fafa083cce6a Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Prevent crashing when FcFontList failsJoni Poikelin2022-05-101-0/+2
| | | | | | | | | FcFontList can return null pointer in failure cases which would lead to null pointer dereference further down. Pick-to: 5.15 6.2 6.3 Change-Id: I6b407cf2f27ead9eb471d3ee7a521468cebf7572 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* Implement missing QSupportedWritingSystems comparison operatorsTor Arne Vestbø2022-05-061-0/+20
| | | | | | | The operators were exported, but not implemented. Change-Id: I6c89c1f4b76040d2388b3a10afc6eeeb52638e1b Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* Use Q_CC_{GNU,MSVC}_ONLY when comparing to particular versionsMarc Mutz2022-05-061-1/+1
| | | | | | | | | | | | | | | | | This prevents false-negatives and false-positives, as e.g. Clang 10.0.0 masks as GCC 4.2, so Q_CC_GNU is 402 on that compiler. Depending on the test (Q_CC_GNU > NNN or Q_CC_GNU < NNN), the result of the test is almost random. Q_CC_<comp>_ONLY makes sure we match only GCC or MSVC, not bycatch such as Clang or ICC. Pick-to: 6.3 6.2 5.15 Change-Id: I4c550a11ecf85fc9a2216b330b69bd03d45b47e0 Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* QWindowsFontDatabase: fix handling of default EUDC fontVladimir Belyavsky2022-05-051-7/+33
| | | | | | | | | | | | There was a problem if default EUDC font is specified in user's Windows Registry as a font file name instead of full path. In that case we didn't handle this font properly and the warning was generated. Fixes: QTBUG-103003 Pick-to: 6.2 6.3 Change-Id: I946082af8dc31e6cf82cebca94ebbb03726239e0 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* QtGui: includemocsMarc Mutz2022-04-299-0/+18
| | | | | | | | | | | Including moc files directly into their classes' TU tends to improve codegen and enables extended compiler warnings, e.g. about unused private functions or fields. Pick-to: 6.3 6.2 5.15 Task-number: QTBUG-102886 Change-Id: I1945741794c25679a9d94c0d68c8642e2c823502 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* QtGui: replace remaining uses of QLatin1String with QLatin1StringViewSona Kurazyan2022-04-2810-29/+29
| | | | | | Task-number: QTBUG-98434 Change-Id: I98c27030c783f968cbf38dc966ce486dc366b302 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* QtGui: use _L1 for for creating Latin-1 string literalsSona Kurazyan2022-04-2820-420/+450
| | | | | | Task-number: QTBUG-98434 Change-Id: Idcb71c1d27125333a53b6bdd3e1af0d4c66617fa Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* QTextEngine: don't pass empty data to bidiReorderThiago Macieira2022-04-251-4/+6
| | | | | | | | | | | | | | | The algorithm in QTextEngine::bidiReorder() doesn't like an empty level and visual order list. Found by GCC 12's slightly misleading warning: qtextengine.cpp:3838:29: error: ‘levels’ may be used uninitialized [-Werror=maybe-uninitialized] qtextengine.cpp:1174:6: note: by argument 2 of type ‘const quint8*’ {aka ‘const unsigned char*’} to ‘static void QTextEngine::bidiReorder(int, const quint8*, int*)’ declared here qtextengine.cpp:3835:28: note: ‘levels’ declared here 3835 | QVarLengthArray<uchar> levels(nItems); | ^~~~~~ Pick-to: 6.2 6.3 Change-Id: If05aeeb7176e4f13af9afffd16e8490f131f160e Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* QFontDatabase: Clear font cache before emitting fontDatabaseChangedTor Arne Vestbø2022-04-231-2/+2
| | | | | | | | | Matches the ordering in QFontDatabasePrivate::invalidate() and ensures that when the fontDatabaseChanged signal is processed by clients the cache is ready to be filled again. Change-Id: I9d09060284c6090ae2748147f6ee75b9f9b173c5 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* QFontDatabase: Allow partially populating the font databaseTor Arne Vestbø2022-04-224-17/+33
| | | | | | | | | | | | | | | | | | | | | | | | | We were using the count of the registered families as the way to determine if the font database had been populated yet. As a result we needed to invalidate the font database every time an application font was added to an empty database, as once the application font was added, the font database was no longer empty, and we would end up failing to populate any of the system/platform fonts. We now have a dedicated flag for tracking whether the font database has been populated, and we track whether an application font has been populated by looking at its properties list, avoiding a second round of populating when the full initialization happens. This also opens up the possibility of the platform font database populating (lazily or fully) fonts up front, for example as part of resolving theme fonts. The Windows font database had to be taught to invalidate itself at the right moment, instead of assuming doing so during populate was okey. Change-Id: I80c893df755d8d35fb8a84dd7a83c6756a8f24a2 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* Send ThemeChange event to all windows when system theme changesTor Arne Vestbø2022-04-221-1/+1
| | | | | | | | | | | | | | | | | | | The QWSI event for theme change has an optional window parameter to specify the window affected, but most platform react to global theme changes, and end up passing nullptr into the event. The reasonable thing to do in QGuiApplication in that case is send a theme change event to every QWindow, so that they are all notified about the situation. This approach is what the Windows platform plugin was doing already, but did so by iterating manually over the windows, resulting in multiple calls to QGuiApplicationPrivate::handleThemeChanged -- one for each QWSI event. Change-Id: Ifb27b6c31231377c0df389a592cafd0075d3d8bb Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Remove last traces of old HarfbuzzEskil Abrahamsen Blomfeldt2022-04-222-38/+20
| | | | | | | | | | | | | | | | | | | | | | In Qt 6, we removed the "old" Harfbuzz and Harfbuzz-NG became the only option. But the QT_HARFBUZZ=old environment variable would still be read and would disable certain parts of the code path. This has caused some confusion when porting older applications, where QT_HARFBUZZ=old was used to work around issues with the earlier versions of Harfbuzz-NG. Setting it now causes text to disappear completely. To avoid this confusion, we remove traces of the QT_HARFBUZZ environment variable as well. [ChangeLog][Text] Fixed an issue where setting the legacy environment variable QT_HARFBUZZ=old would cause text to disappear from the application. Fixes: QTBUG-102774 Change-Id: I0f07cdb2418202fc36b82e766ad9547c34477175 Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
* QtGui: stop using QLatin1Char constructor for creating char literalsSona Kurazyan2022-04-1318-199/+193
| | | | | | | | | Required for porting away from QLatin1Char/QLatin1String in scope of QTBUG-98434. Change-Id: I308d86cefcbfd126929b68f9a853d420840c965f Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* QFontDatabase: Simplify and standardize emit of fontDatabaseChanged signalTor Arne Vestbø2022-04-071-2/+2
| | | | | Change-Id: Iabb637b52de225bf8823b1c3089e50db932c0b85 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* QFontDatabase: Add internal documentation for QFontDatabasePrivateTor Arne Vestbø2022-04-071-0/+50
| | | | | Change-Id: I40e770552110fa271c912d18197399a9c5071c56 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* QFontDatabase: Track empty slots in application font list via file nameTor Arne Vestbø2022-04-072-4/+5
| | | | | | | | This allows us to use the properties of the application font as a way to distinguish whether the font has been populated or not. Change-Id: Iccce32b23c1b987f2f75fef955227bddc2495fa3 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* QFontDatabase: Move registration of platform application fonts into call sitesTor Arne Vestbø2022-04-071-11/+9
| | | | | | | | Makes it more transparent what's going on, rather than the opaquely named static helper function. Change-Id: I9a5bd348007e9ed11214f1e55c4b39d4734328dc Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* QFontDatabase: Make match/bestFoundry/load(Single)Engine part of ↵Tor Arne Vestbø2022-04-072-15/+29
| | | | | | | | | QFontDatabasePrivate Makes it clearer where and how they are used, and to set breakpoints on them. Change-Id: Id2aaeb51ff80676ad3316d29e23661b2cad79478 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* QtGui: sweep Q_DECLARE_METATYPE → QT_DECL_METATYPE_EXTERN [2/2]: private APIMarc Mutz2022-04-056-7/+17
| | | | | | | | | | | | | It's one of our best tools to improve compile times. Can't backport to Qt 6.2 because the macros don't exist there. Pick-to: 6.3 Task-number: QTBUG-102206 Change-Id: I80734b4d43928fce0e66329b5b897a2738db9b30 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* QtGui: sweep Q_DECLARE_METATYPE → QT_DECL_METATYPE_EXTERN [1/2]: public APIMarc Mutz2022-04-052-1/+3
| | | | | | | | | | | | | It's one of our best tools to improve compile times. Can't backport to Qt 6.3 or 6.2 because this change introduces new exported symbols. Task-number: QTBUG-102206 Change-Id: Ib8224ed60afa893744f369fe7394d27e89b66c11 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* QCoreTextFontDatabase: remove 34 relocationsMarc Mutz2022-04-011-5/+5
| | | | | | | | | | | | | | | | | | | | | | Same ole trick[1] as usual: Instead of an array of pointers (causing relocations), declare an array of strings (char arrays; not causing relocations). [1] http://library.bagrintsev.me/CPP/dsohowto.pdf, Section 2.4.3. As for storage requirements: We pay a few bytes per entry for extra padding, as not all entries have length seven, but we save the per-entry pointer variable, so sizeof(void*) bytes per entry, too, so on 64-bit, at least, we're guaranteed to come out ahead. Needed to replace nullptrs with empty strings here, and adjust the sole user to check for emptiness instead of nullness. Pick-to: 6.3 6.2 Task-number: QTBUG-100536 Change-Id: I4f07d72116eda2ebf1fdb327133f315417e2b0f0 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Flush font cache when we load new application fontsEskil Abrahamsen Blomfeldt2022-04-011-2/+8
| | | | | | | | | | | | | | If new application fonts are loaded during the lifetime of the application, it's possible that we have already cached fallbacks for requests for the newly loaded font families. To make sure we redo requests for the updated database, we have to flush the cache, just like we do when removing application fonts. Task-number: QTBUG-100697 Task-number: QDS-1142 Change-Id: I2a6d2a7459187d69d14ef639e2b710c8d553b86e Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* CoreText: Resolve default font by asking for the QPlatformTheme::SystemFontTor Arne Vestbø2022-03-312-8/+1
| | | | | | | | | | We want to go through the themeFont() code path so that we resolve all variants of the font, and so that the descriptors we get are preserved until we can populate them later on. Pick-to: 6.2 6.3 Change-Id: Idbf44062078a0722bbe71c91083285f0eb9a9e09 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* QFontDatabase: Use more explicit function name for clearing familiesTor Arne Vestbø2022-03-312-11/+15
| | | | | | | | Avoids overloading on ::free() from stdlib.h Change-Id: I71d7fa4012f189cf5640968ed43d530eff79989f Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io> Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
* QFontDatabase: Move writing_system_sample() into only callerTor Arne Vestbø2022-03-311-79/+76
| | | | | | Change-Id: I225a24a73c3d0e79db5b1a33513f5582d1abf531 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io> Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
* QFontDatabase: Remove un-needed load() functionTor Arne Vestbø2022-03-311-33/+2
| | | | | | | | | | The function didn't take any of the arguments into account, and was just initializing the font database, which all but one of the call sites were already doing. Change-Id: I83cab0059014dd256ec4b453e15fc2fe4bebcbdf Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io> Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
* QFontDatabase: Centralize initialization in ensureFontDatabase()Tor Arne Vestbø2022-03-311-26/+10
| | | | | | | | | | | | | | | Instead of having multiple code paths call initializeDb(), we use the already existing ensureFontDatabase() to provide the central point of ensuring an initialized font database. A couple of locks for the fontDatabaseMutex was added since the ensureFontDatabase() function documents that as a requirement for calling the function, but these locks were presumably already needed as the original code paths accessed the database in the same way. Change-Id: I5e29a069c4c7f68902dbe0c6c949a168d54f5f0e Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io> Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
* QFontDatabase: Replace privateDb Q_GLOBAL_STATIC with instance() accessorTor Arne Vestbø2022-03-311-28/+27
| | | | | | | | | | | | The use of both a global static and a dedicated instance() function made it harder to know how and where the singleton font database was managed. As Q_GLOBAL_STATIC is no longer needed (as of C++11) for ensuring thread safe access we can contain the QFontDatabasePrivate singleton within the instance() accessor. Change-Id: Ia3d83ff2d83d326504243258a44d8ae8352d290d Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* QFontDatabase: Remove unused createDatabase() functionTor Arne Vestbø2022-03-312-4/+0
| | | | | | | | Last uses was removed in 76068d0114157c6b59523f3fb032cd8de64e9a63. Pick-to: 6.2 6.3 Change-Id: I8e1f404d2422e0f11dc28e52ce6dafa77e148126 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* CoreText: Avoid populating font family aliases if family was populatedTor Arne Vestbø2022-03-311-0/+6
| | | | | | | | | | | | | | When trying to match a font request to fonts in the database we might end up with a mismatch due to the style not being available, but the font family itself was. If that's the case there's no point in trying to populate font aliases. Fixes: QTBUG-98369 Fixes: QTBUG-99216 Pick-to: 6.3 6.2 5.15 Change-Id: I8776e5b89588a13749c9c7e414c5bfac86feab58 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* macOS: Handle changes in the available fonts by invalidating font databaseTor Arne Vestbø2022-03-304-0/+31
| | | | | | | | | | | | | | | | | The user may use the Font Book application to add or remove fonts, which affects the fonts that are available to Qt applications. As the cross platform QFontDatabase implementation currently doesn't support granular management (removal) of fonts, we need to invalidate the entire font database. Since the theme fonts on macOS (and iOS) are managed by the font database we also need to invalidate the theme fonts, and report this back to the application. Change-Id: I1f6a7900f76e0b6a1f059bd43638a04bc0808e20 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* CoreText: Populate all variants of theme/system fontsTor Arne Vestbø2022-03-302-13/+62
| | | | | | | | | | | | | | | | | | | | | We populate the various QPlatformTheme::Fonts by asking the system for the preferred font for each use-case, but that just gives us a single font descriptor with a single style and weight. If the user then tweaks the font by e.g. making it bold or italic, our font database will not have any knowledge of these variants, and will fall back to another font. To fix this we ask CoreText for all variants of each of the theme fonts, so that each of the theme font families are fully populated. The preferred way to do this on macOS 10.15/iOS 13 and above is by using the font's UI design trait. This avoids asking CoreText for private fonts by family name directly, which is not supported and may result in giving us Times or another fallback font instead. Pick-to: 6.2 6.3 Change-Id: I4aa21624df62ac09a92d7ae0bc2cdde4f6ad6e5f Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* CoreText: Add note about why we defer population of theme font descriptorsTor Arne Vestbø2022-03-301-0/+6
| | | | | | Pick-to: 6.2 6.3 Change-Id: I7018a92467c6db1b9d04b88e50113ba9c9d1a3b7 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* CoreText: Reuse descriptorForFamily helper function in populateFamilyTor Arne Vestbø2022-03-301-18/+17
| | | | | | Pick-to: 6.2 6.3 Change-Id: I2c1098309fc994fb7a131564679299a2e850870a Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* CoreText: Make population of theme fonts explicitTor Arne Vestbø2022-03-302-25/+33
| | | | | | Pick-to: 6.2 6.3 Change-Id: I95e6b535e8ec98ca13c9a58f1e4ae4358ed9f028 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* Revert "Avoid populating font family aliases if family matched"Tor Arne Vestbø2022-03-291-15/+9
| | | | | | | | | | | This reverts commit 69d525a6fa19934b3e57f503132bb4ab19f6b923. The change introduced behavior changes on Windows, where family aliases are used to build a full set of styles for a family. Change-Id: I64ca1cf5febf0a6277cbe0a0041ccdb76da72196 Pick-to: 6.3 6.2 5.15 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* FreeType: Load multiple font faces from the same file on macOSNiklas Wenzel2022-03-233-2/+77
| | | | | | | | | | | | | | Previously, if a font file contained multiple font faces, only the first could ever be loaded. This could lead to Qt loading different font styles than requested by the application. [ChangeLog][Text][Freetype] Fixed a bug where the macOS FreeType backend would fail to load font faces from font files containing multiple faces. Fixes: QTBUG-100666 Pick-to: 6.2 6.3 Change-Id: I6a126266a2e15f843dd578ab25c11748881bb932 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* CoreText: Maintain theme fonts in the font database instead of themesTor Arne Vestbø2022-03-231-0/+2
| | | | | | | | | | | | | | | | | | The ownership of the fonts were handled in the iOS and macOS themes, but the CoreText font database also kept a reference to these fonts. As there was no way for the themes to reset the font database references we could potentially end up in a situation where the font database had stale references. And as the font database would not rebuild the theme fonts once populated the themes then would not be able to build a new list of theme fonts. Moving the ownership to the font database makes semantics and management of the fonts clearer. Pick-to: 6.3 6.2 Change-Id: I61756abaf5487f28d520dfa1cf7a8ee2d716cce6 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* QtGui: compile-optimize inline swap functionsMarc Mutz2022-03-198-10/+10
| | | | | | | | | | | | | | | | | | Instead of using the overly-generic qSwap() monster, use - qt_ptr_swap() for swapping raw pointers - member-swap for swapping smart pointers - std::swap() for swapping scalars In QtCore, this has proven to give a nice reduction in compile time for Qt users, cf. b1b0c2970e480ef460a61f37fa430dc443390358. Pick-to: 6.3 6.2 Task-number: QTBUG-97601 Change-Id: I987ff95e8751a22a4f283655d8225dd16de21178 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Avoid populating font family aliases if family matchedTor Arne Vestbø2022-03-171-9/+15
| | | | | | | | | | | | | | | | | When trying to match a font request to fonts in the database we might end up with a mismatch due to the style not being available, but the font family itself was. If that's the case there's no point in trying to populate font aliases, so we explicitly propagate this fact back to QFontDatabasePrivate::findFont so that it can choose to not populate family aliases. Fixes: QTBUG-98369 Fixes: QTBUG-99216 Pick-to: 6.3 6.2 5.15 Change-Id: I14470554c73eace836f57cb65e63ada594ccf62e Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* Fix deprecated use of QColor::setNamedColorMårten Nordheim2022-03-172-6/+6
| | | | | | | 'Use fromString() instead.' Change-Id: I4efef147a8b0486f2664fd7fe6c35a9c82479b90 Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* Gui: Do not depend on transitive includesFabian Kosmale2022-03-172-0/+2
| | | | | Change-Id: I27321235d9c8428de0cff1e22a618299b9e5a97f Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* Doc: Remove mentioning of Windows 7, Vista from QFont documentationKai Köhne2022-03-151-7/+1
| | | | | | | | | We only support Windows 10 in Qt 6. Task-number: QTBUG-84433 Pick-to: 6.2 6.3 Change-Id: I0c5bacac570dbb97a71f5af04b645d69040a5fe6 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* Fix deprecated use of QBA/Q*String::countMårten Nordheim2022-03-153-5/+5
| | | | | | | 'Use size() or length() instead' Change-Id: I284fce29727c4c1ec9ea38a4e8ea13a9e0af5390 Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>