summaryrefslogtreecommitdiffstats
path: root/src/gui/text/qfont.cpp
Commit message (Collapse)AuthorAgeFilesLines
* doc: Update note about variable axes on WindowsEskil Abrahamsen Blomfeldt6 days1-3/+1
| | | | | | | | Since Qt 6.8, the DirectWrite backend is the default, so we need to invert the warning. Change-Id: I0d32c06c3507664ecd5b1bc3ae3fcabeedee12b7 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* Introduce optional smarter font merging with ContextFontMergingEskil Abrahamsen Blomfeldt2024-04-261-1/+9
| | | | | | | | | | | | | | | | | | | | | | This introduces an optional, slightly more expensive approach to font merging which takes the full string into account, instead of just going character by character. This addresses the issue that you may sometimes get multiple fonts to cover one string of text in a single language. With Chinese, this is especially an issue because many fonts will only support parts of the very large character set. The new algorithm detects if the string was incompletely covered by the font and tries the fallback fonts in order to find the best match. This is obviously more expensive, especially if no perfect match is found and we have to check all the fallbacks in the list, but it is opt-in and only enabled if the ContextFontMerging flag is set. Task-number: QTBUG-121131 Change-Id: I8c7874d0918640bd83418e3c4726c89f43a220a3 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* Convert "(added in)" enum warnings to [since] syntaxAllan Sandfeld Jensen2024-04-181-1/+1
| | | | | | | | | | With the since syntax we can now mark since more standardized Pick-to: 6.7 Change-Id: I3c53010043a40e8887f1899cde2689ee80e530ae Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Jaishree Vyas <jaishree.vyas@qt.io>
* Doc: explain how to check for the existence of a font familyMitch Curtis2024-03-191-1/+32
| | | | | | | | | | | | | bb6d68703b67e042e2a7254c2ca6a004a1441cc5 fixed warnings in the Universal style by using a faster alternative. It's possible that users will run into these warnings too, and they should be provided with information to make a more informed choice about which approach they can use. Fixes: QTBUG-123360 Pick-to: 6.5 6.6 6.7 Change-Id: I4170e9ade40c4b54dbc2bd73d124b2ade4d8c939 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* QFont::Tag: use new comparison helper macrosVolker Hilsheimer2023-12-081-3/+2
| | | | | | Task-number: QTBUG-104111 Change-Id: Id57b075d00e657c2606b6c1a8f1215ed0d067cbd Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
* Support arbitrary variable axis valuesEskil Abrahamsen Blomfeldt2023-12-041-7/+186
| | | | | | | | | | | | | | | | | | | | | | | | This adds API to set arbitrary values for axes in variable fonts to QFont. It also implements support for the API in CoreText, FreeType (on all platforms) and DirectWrite. Note that in order for the mechanism to work with application fonts on DirectWrite, we need to keep the loader for the fonts around for the life time of the font (otherwise they cannot be reloaded with different parameters). The way this was handled before (just re-creating and throwing away the loader every time) was not ideal anyway, and this finally gives us a good reason to fix it. Fixes: QTBUG-119421 Fixes: QTBUG-117835 Fixes: QTBUG-117838 Fixes: QTBUG-117839 Change-Id: I3d1fe95fba1f9df52f34aa42e1ac5fa47dbe6d1a Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Add missing detach when clearing font featuresEskil Abrahamsen Blomfeldt2023-11-281-0/+4
| | | | | | | | Same as when setting the features, we need to detach (but keep the engine data) when clearing them. Change-Id: I3adcadfb24c4abfff9c9e1c4f42ed4af919c71f0 Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
* doc: Remove outdated comment about DirectWriteEskil Abrahamsen Blomfeldt2023-11-221-6/+0
| | | | | | | | | Qt 6 does not support any Windows versions without DirectWrite and no special configuration flag is needed to build it anymore. Pick-to: 6.2 6.5 6.6 Change-Id: I6553c4d1c70e5616f8cb3ec8fe6343c600a74462 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Remove obsolete font tag helpers and \preliminary tag from documentationVolker Hilsheimer2023-10-201-49/+6
| | | | | | Fixes: QTBUG-117046 Change-Id: I7e68298ba1c52bea9bdc2fca0c1f082df76d952e Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* Replace MAKE_TAG macro with QFont::TagVolker Hilsheimer2023-10-201-10/+6
| | | | | | Task-number: QTBUG-117046 Change-Id: I26e0af634fed87199bb49d57e3aa3f4e3fea0e39 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* QFont: add a tag type for features and other advanced propertiesVolker Hilsheimer2023-10-201-73/+188
| | | | | | | | | | | | | | | | | | | | Instead of overloads and generic string literals with runtime checks, use a dedicated Tag type for specifying the font feature. The Tag type can only be instantiated with a string literal of exactly 4 characters (plus the terminating null)l; longer or shorter literals result in a compile time error. Constructing a Tag from any other string type is possible through the named fromString constructor, in which case we can only check the length and warn at runtime. The type's API is almost completely constexpr so that we can use it to calculate e.g. enum values. Task-number: QTBUG-117046 Change-Id: I31038c7c6fd2b843a105b032f021e506b0b60822 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* Mark feature API in QFont as preliminaryEskil Abrahamsen Blomfeldt2023-09-131-0/+10
| | | | | | | | | | | | | | | | | | | | | | | Using ints for the tags is not ideal. There is no type safe way to do conversions from strings, and how the int corresponds to the four-byte tag is not clear from the API, so user code can end up being less readable due to this. Especially since this type of tag is a data type used several places in fonts, and we will need them again for implementing support for variable axes, it's worth giving this an extra round of polish. Since it was not addressed in a timely manner and we don't want this to delay the upcoming release, we mark the API as preliminary for now, to give ourselves the option of changing it to something. Pick-to: 6.6 Fixes: QTBUG-116929 Change-Id: I498478785dcd5ece954151f01f1a017828d6b8b8 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* gui: use const methods moreAnton Kudryavtsev2023-09-091-3/+3
| | | | | | | to avoid implicit detach Change-Id: I2c7ae56e0866941e0f0b040129bfc40a9a961f3c Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Doc: Delete links to removed examplesAndreas Eliasson2023-08-181-1/+1
| | | | | | | | | | The examples have been removed as part of the examples revamp project. This patch resolves a number of qdoc warnings. Pick-to: 6.6 6.5 Change-Id: Ie3d2f5637136c631d7e9f7a8ffd93baea52f77d8 Reviewed-by: Kai Köhne <kai.koehne@qt.io> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* API update: Don't expose QHash storage in APIEskil Abrahamsen Blomfeldt2023-06-291-62/+94
| | | | | | | | | | | | | To maintain flexibility in how we store the features, we introduce accessors through indirection rather than accessing the property directly. Made as response to API review. Pick-to: 6.6 Change-Id: I3e5d4ddabe93f67796af4626fddefe028ded9888 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Lars Knoll <lars@knoll.priv.no>
* doc: Remove bogus step in font resolution algorithmEskil Abrahamsen Blomfeldt2023-06-131-2/+0
| | | | | | | | | | | This is a left-over from when setFamilies() and setFamily() were setting two different properties, for compatibility reasons. There is no longer a special step for the singular family, and the sentence is also a bit obfuscated, so we just remove it. Pick-to: 6.2 6.5 6.6 Change-Id: Ia3c244d41f550a5062de8de63053770258dcacba Reviewed-by: Andy Shaw <andy.shaw@qt.io>
* Change QFont::fontFeatures() -> QFont::features()Eskil Abrahamsen Blomfeldt2023-05-241-56/+56
| | | | | | | | The 'font' is redundant here, and we don't prefix any other properties like that. Change-Id: Iee1f492b232e5bbcae399b472d7478406d8a81ef Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Doc: fix warnings from parameters not matching the documentationVolker Hilsheimer2023-05-241-2/+2
| | | | | | Change-Id: I6588336e12db0a3af9b9dfd2ab22a3e1b7c54238 Reviewed-by: Safiyyah Moosa <safiyyah.moosa@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Implement API for enabling / disabling OpenType featuresEskil Abrahamsen Blomfeldt2023-05-091-2/+208
| | | | | | | | | | | | | Similar to the font-features-settings in CSS, this is a low-level API that allows you to pass the information to the shaper in order to enable or disable specific font features by name. [ChangeLog][QtGui][Text] Added an API to QFont which makes it possible to enable and disable specific typographic features in OpenType fonts. Change-Id: Ib48c678f3b97a5a562b08ae34dc895800c8885c0 Reviewed-by: Lars Knoll <lars@knoll.priv.no>
* QObject: implement startTimer(int) in terms of startTimer(chrono)Ahmad Samir2023-03-111-5/+7
| | | | | | | | | | I.e. use chrono first, this means the API isn't limited by the size of int, but by the size of whatever chrono::milliseconds uses (typically int64_t), and chrono units are much more readable as well. Task-number: QTBUG-110059 Change-Id: Ie7f2d90864782361a89866693011803be6f8545e Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Document max size for QFont::setPixelSizePaul Wicking2022-12-151-1/+2
| | | | | | | Pick-to: 6.5 6.4 6.2 Fixes: QTBUG-102989 Change-Id: I9a63a2ab8ac6eadf1b5a5865a0a084700d9e85d2 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* QFont: replace a QVLA with a C arrayMarc Mutz2022-12-071-3/+5
| | | | | | | | | | | | | | | | | | | | | QVarLengthArray doesn't allocate, but is nevertheless dynamically initialized, incl. thread-safe static overhead. Turn the QVLA<QPair<int,int>> into a std::array<int,2>[] instead. This container has constant initialization and the use of array<int> instead of pair<int, int> means we can use the bool inverted argument as an index into the array instead of having to switch over .first and .second. Saves ~600B in text size and ~100B in BSS on optimized Clang 15 AMD64 Linux builds, and the copying, under mutex protection, of the data at runtime. Amends 3558704ed5c3d2c6dc6d024dfa454997469ca75f. Pick-to: 6.4 Change-Id: Iad48eca4eef77011d4094125670ea302e8beae46 Reviewed-by: Jonas Karlsson <jonas.karlsson@qt.io>
* Port from container::count() and length() to size() - V5Marc Mutz2022-11-031-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a semantic patch using ClangTidyTransformator as in qtbase/df9d882d41b741fef7c5beeddb0abe9d904443d8, but extended to handle typedefs and accesses through pointers, too: const std::string o = "object"; auto hasTypeIgnoringPointer = [](auto type) { return anyOf(hasType(type), hasType(pointsTo(type))); }; auto derivedFromAnyOfClasses = [&](ArrayRef<StringRef> classes) { auto exprOfDeclaredType = [&](auto decl) { return expr(hasTypeIgnoringPointer(hasUnqualifiedDesugaredType(recordType(hasDeclaration(decl))))).bind(o); }; return exprOfDeclaredType(cxxRecordDecl(isSameOrDerivedFrom(hasAnyName(classes)))); }; auto renameMethod = [&] (ArrayRef<StringRef> classes, StringRef from, StringRef to) { return makeRule(cxxMemberCallExpr(on(derivedFromAnyOfClasses(classes)), callee(cxxMethodDecl(hasName(from), parameterCountIs(0)))), changeTo(cat(access(o, cat(to)), "()")), cat("use '", to, "' instead of '", from, "'")); }; renameMethod(<classes>, "count", "size"); renameMethod(<classes>, "length", "size"); except that the on() matcher has been replaced by one that doesn't ignoreParens(). a.k.a qt-port-to-std-compatible-api V5 with config Scope: 'Container'. Added two NOLINTNEXTLINEs in tst_qbitarray and tst_qcontiguouscache, to avoid porting calls that explicitly test count(). Change-Id: Icfb8808c2ff4a30187e9935a51cad26987451c22 Reviewed-by: Ivan Solovev <ivan.solovev@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Port from container.count()/length() to size()Marc Mutz2022-10-041-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is semantic patch using ClangTidyTransformator: auto QtContainerClass = expr(hasType(namedDecl(hasAnyName(<classes>)))).bind(o) makeRule(cxxMemberCallExpr(on(QtContainerClass), callee(cxxMethodDecl(hasAnyName({"count", "length"), parameterCountIs(0))))), changeTo(cat(access(o, cat("size"), "()"))), cat("use 'size()' instead of 'count()/length()'")) a.k.a qt-port-to-std-compatible-api with config Scope: 'Container'. <classes> are: // sequential: "QByteArray", "QList", "QQueue", "QStack", "QString", "QVarLengthArray", "QVector", // associative: "QHash", "QMultiHash", "QMap", "QMultiMap", "QSet", // Qt has no QMultiSet Change-Id: Ibe8837be96e8d30d1846881ecd65180c1bc459af Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Apply Q_CONSTINIT where beneficialSona Kurazyan2022-09-011-1/+1
| | | | | | | | | | Applied Q_CONSTINIT to variables with static storage duration, but skipped the POD types with core constant initializers. Task-number: QTBUG-100486 Change-Id: Iaabf824e9cb0f29a405a149912200d4e4b3573c1 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* QFont: don't detach the families list in family()Thiago Macieira2022-06-271-1/+1
| | | | | | Pick-to: 6.3 6.4 Change-Id: Id0fb9ab0089845ee8843fffd16f93a8b9306b89b Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* QFont: remove support for comma split setFamily()Janne Juntunen2022-06-171-12/+1
| | | | | | | | | | In the documentation it is said that from Qt 6.2 onwards setFamily() only sets a single family but so far this hasn't been the case. Fixes: QTBUG-102768 Pick-to: 6.4 Change-Id: I2a5037ea1385cb8c6644d1e256b89e167c590967 Reviewed-by: Andy Shaw <andy.shaw@qt.io>
* Use SPDX license identifiersLucie Gérard2022-05-161-38/+2
| | | | | | | | | | | | | 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>
* QtGui: includemocsMarc Mutz2022-04-291-0/+2
| | | | | | | | | | | 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: stop using QLatin1Char constructor for creating char literalsSona Kurazyan2022-04-131-7/+7
| | | | | | | | | 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>
* 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>
* QGuiApplication: invert meaning of qt_is_gui_usedMarc Mutz2022-02-021-3/+3
| | | | | | | | | | | | | | | | | | The default value was true, which is non-zero, forcing the variable out of the BSS and into the DATA segment. Fix by inverting the meaning so the default value can be false. Since qt_is_gui_unused sounds a bit complicated, however, take a cue from the variable's only writer and rename it qt_is_tty_app. Pick-to: 6.3 Change-Id: I198e9786f7e71178d69fecb5179287bf39b3a1d6 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Fix deserializing Qt 5.x fonts through QDataStreamEskil Abrahamsen Blomfeldt2021-11-181-3/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In Qt 5, fonts had both singular family and plural families properties, and both were stored separately when streaming through QDataStream. The families list was treated as an extension of family in this case, and the primary font family was always the singular family property. In Qt 6, it has been merged into one and family() is now just a convenience for families().at(0). But when reading files generated with Qt 5, we would ignore the fact that these were previously separated. We would first read the family entry into the families list, and then we would later overwrite this with an empty families list. Instead, we detect streams created with Qt 5.15 or lower and make sure we append the families list instead of overwriting it in this case. In addition, we need to make sure we split up the list again when outputting to Qt 5.x. This adds a file generated with QDataStream in Qt 5.15 to the test to verify. [ChangeLog][Fonts] Fixed a problem deserializing the family of fonts that had been serialized using QDataStream in Qt 5. Pick-to: 6.2 Fixes: QTBUG-97995 Change-Id: Id3c6e13fc2375685643caee5f8e3009c00918ccb Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Andy Shaw <andy.shaw@qt.io>
* gui: Fix typos in documentationJonas Kvinge2021-10-121-1/+1
| | | | | | Pick-to: 5.15 6.2 Change-Id: I533f5a55cd0cd60a76990b552d7dab51a301ac1c Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
* Doc: Replace broken link to Roman Czyborra's personal pageLuca Di Sera2021-10-011-2/+2
| | | | | | | | | | | | | | | | | | | | The `QFont` documentation refers to Roman Czyborra's personal page with the intent of providing information about encodings. The page seems to have been down for many years and may contain information that is now deprecated such that it is now replaced with a link to the Unicode Technical Report 17 about the Unicode Character Encoding Model. The new link was chosen as a substitute as it seems to cover or provide the intuition for, standing by the last captured version of Roman Czyborra's personal page on the Wayback Machine, many of the same concepts. Task-number: QTBUG-96127 Pick-to: 6.2 Change-Id: Ibf901b5023688c14efb3d6f77a10609f7ba80e72 Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* QFontCache: don't start cleanup timer if we are not in the main threadVolker Hilsheimer2021-10-011-15/+26
| | | | | | | | | | | | | We can only start timers in threads started via QThread, and even then we cannot assume that the thread runs an event loop. So only start the timer when we are in the main thread. Add a test that verifies that we don't get the warning message. Pick-to: 6.2 Change-Id: I40d7d9ff115720f9ecd3eedaebbade2643daf843 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Undeprecate QFont(QString) since this is still useful for manyAndy Shaw2021-08-111-4/+0
| | | | | | | | Fixes: QTBUG-95441 Pick-to: 6.2 Change-Id: Ib1f78a5a797c7b7d7eb252a7bfa11b5c003ce0d3 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io> Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* Doc: Ensure deprecated APIs in Gui are documented as suchNico Vertriest2021-07-261-4/+7
| | | | | | | | | | | Added missing #if-ery and deprecation macros to a QFont constructor that was only documented as deprecated. Fixes: QTBUG-94521 Fixes: QTBUG-95310 Pick-to: 6.2 6.1 Change-Id: I3d0418a3f7dca191a9068cc22627fe4deb7c53c5 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Doc: Use \deprecated instead of \obsoletePaul Wicking2021-05-261-4/+4
| | | | | | Task-number: QTBUG-93990 Change-Id: I4e512354a49dde6678ca89cabc56bc76ba666bb3 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Fix memory leak when using small caps fontEskil Abrahamsen Blomfeldt2021-05-201-4/+8
| | | | | | | | | | | | | | | The small caps version of a font is kept as a QFontPrivate* which is manually reference counted, but we neglected to actually delete it when the reference count went to 0. [ChangeLog][Fonts] Fixed a memory leak when initializing a small caps font. Fixes: QTBUG-93068 Pick-to: 6.1 5.15 Change-Id: Icc7fb7a59bf523da84d2e6fa026940a7d1230525 Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com> Reviewed-by: Robert Löhning <robert.loehning@qt.io>
* Remove Qt6 switches from QtGuiAllan Sandfeld Jensen2021-05-051-10/+0
| | | | | | | Removing now dead code Change-Id: I021539da6517fdb8443f8ae9431fc172b7910cfc Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Doc: Add details to QFont::toStringPaul Wicking2021-01-121-1/+20
| | | | | | | | | Add details that explain the return value. Pick-to: 6.0 5.15 Fixes: QTBUG-81467 Change-Id: Ifad407a27259711fc9abe1bacc7ba9db105bdcc0 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Return an empty QStringList if the family string is emptyAndy Shaw2020-11-271-0/+2
| | | | | | | | Since doing a split will create an empty entry, then we can save time and just return an empty QStringList in this case Change-Id: I86a6532e7243151493ea4021bfcc05e4c2a9cbf0 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Return a QString() if the families list is emptyAndy Shaw2020-11-241-2/+2
| | | | | | Fixes: QTBUG-88781 Change-Id: Iafed2be29e2e0c3029e832986ba58d19446214eb Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Fix weight when reading old serialized QFontsEskil Abrahamsen Blomfeldt2020-11-201-1/+4
| | | | | | | | | | | | | | | | | | The QFont::fromString() needs to differ between strings produced before and after Qt 6.0 when interpreting the weight value, since in older strings this will be the legacy scale. Luckily the number of tokens in the string can be used for this purpose, since many tokens were added in Qt 6.0. This broke KDE, where font settings are stored in QSettings and serialized using QFont::toString() from Qt 5. Fixes: QTBUG-88589 Pick-to: 6.0.0 6.0 Change-Id: I199737fed61917f8b9d8f86176ead29a89eb8e0c Reviewed-by: Andy Shaw <andy.shaw@qt.io>
* QFont: Prefer setFamilies() over setFamily()Andy Shaw2020-11-201-60/+96
| | | | | | | | | | | | | | | | By depending on setFamilies() then we can be sure that font names with spaces, commas, quotes and so on are correctly handled without being misinterpreted. For now it will split on the comma when a string containing one is passed to setFamily. But from Qt 6.2 this will be removed to preserve the family string as a convenience function. [ChangeLog][QtGui][QFont] Indicated that setFamilies/families is preferred over setFamily/family to ensure that font family names are preserved when spaces, commas and so on are used in the name. Change-Id: Id3c1a4e827756a4c928fed461a4aafa5a0f06633 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* Fix a few qdoc warningsVolker Hilsheimer2020-11-061-2/+2
| | | | | Change-Id: I7cc284ec56f02049d43a23c81659db94bfc3ff42 Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Fix a bunch of qdoc warningsVolker Hilsheimer2020-11-061-1/+1
| | | | | | | Remove or fix references to removed APIs, and some qdoc syntax fixes. Change-Id: I67d71062cd7a29f4eb74b02199b1482af5e59fc0 Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Deprecate QFontDatabase constructorVolker Hilsheimer2020-11-031-5/+5
| | | | | | | | Move private methods into the private class. Fixes: QTBUG-88114 Change-Id: I92fa52980ed5a0675eee310359d8875f614921e6 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* Add deprecated accessors for legacy font weightEskil Abrahamsen Blomfeldt2020-11-031-0/+62
| | | | | | | | | | | | | | In 3558704ed5c3d2c6dc6d024dfa454997469ca75f we changed the font weights to use the OpenType weights rather than our own non-standard scale. This can cause difficulty for people who have legacy font weights stored as ints and no way to convert them. Therefore, we add accessors for the legacy font weights to ease the transition. Change-Id: I2a591c62895dfa1a2310d9a2d0cdcf08de08f3a4 Reviewed-by: Lars Knoll <lars.knoll@qt.io>