summaryrefslogtreecommitdiffstats
path: root/src/gui/text/windows/qwindowsfontdatabase_ft.cpp
Commit message (Collapse)AuthorAgeFilesLines
* QWindowsFontDatabase: port local QSets to QDuplicateTrackerMarc Mutz2021-07-301-5/+5
| | | | | | | | | | Apart from a more fitting, minimal, API, QDuplicateTracker also transparently uses C++17 pmr::monotonic_buffer_resource to avoid, or at least reduce, memory allocations. Change-Id: I155f5518190c5f8f6d21fbec3fcecd6bcc7ff852 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Revert "Windows: Add synthesized fonts also when there is a style name"Eskil Abrahamsen Blomfeldt2021-06-301-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a partial revert of commit f385b8827a75688b8a2cbd51e8da8a602d7f9567. This causes issues because we may overwrite genuine styles with synthetic ones. Lets say for instance that we register "Roboto Bold" and then later we register "Roboto Thin". When we register "Roboto Thin" we also register an alternative font which is called "Roboto" (because this is the typographical family name of the font) with bold weight, because we know Windows can synthesize this. This would work fine, except that on Windows we also store the original face name of the font as a user-pointer in the database. This contains the legacy name of the font: "Roboto Thin". This will override the font that is already stored. When we look up "Roboto" + bold weight in the database later, we will find this synthetic font, replace the requested family name with the legacy one "Roboto Thin" and use this instead. The right fix for now is to revert the cause of the regression. If we want to re-fix the original bug, we might be able to reintroduce f385b8827a75688b8a2cbd51e8da8a602d7f9567 and then make sure we always prefer the "real" font when there are conflicts (this would mean marking synthetic fonts in the database). [ChangeLog][Windows] Fixed a regression where different font styles and/or weights would not be available. Fixes: QTBUG-94781 Task-number: QTBUG-91398 Pick-to: 5.15 6.1 6.2 Change-Id: I092022b14ebf1d56685eaa3b8efe55f015659adc Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Windows: Add synthesized fonts also when there is a style nameEskil Abrahamsen Blomfeldt2021-05-111-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since Windows can synthesize certain font traits for us, we used to register these in the font database so that we could match against them. But after change 469b13916983aff4625657eecbb7d2399cac901d, this in principle no longer happens, because we opt out whenever there is a style name (which there usually is, this could be e.g. "Regular" for a normal font). The result of this was that if we looked for a bold variant of a font, we would not find it. In cases where a multi-engine was used, the request for bold would still survive in the multi engine's fontDef, so we would still pick it up later and apply the synthesis. But when NoFontMerging was set, then we would override the weight in the fontDef with the one from the font database. Since the comment documents that the additional registrations are there to make sure all the variants that Windows can synthesize are available for matching, it does not make sense to skip them just because the font has a style name. So this is a partial revert of 469b13916983aff4625657eecbb7d2399cac901d. Note: This exposed an error in QFontDatabase::isSmoothlyScalable(). The style parameter here is not the "styleName" (as in sub-family), but actually predates that API. Instead it is the "style" as returned by QFontDatabase::styles(), which may be the style name, but it can also be the generated description of the style and weight. In the latter case, we would return false for fonts that are actually smoothly scalable, which is incorrect. This caused a failure in tst_QFontMetrics::metrics(). To remedy this, we add an additional condition, and also match the style if it matches the generated descripion of the style key. [ChangeLog][Windows] Fixed an issue where bold/italic would not be synthesized for fonts if QFont::NoFontMerging was set. Pick-to: 5.15 6.1 Fixes: QTBUG-91398 Change-Id: Id2166a47ae2d386536cf6e5e27ff09165ae8a23a Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* QFont: Prefer setFamilies() over setFamily()Andy Shaw2020-11-201-2/+2
| | | | | | | | | | | | | | | | 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>
* Windows: Fix clang error about copy on loopKai Koehne2020-09-141-1/+1
| | | | | | | | | | | clang on Windows shows an error: qtbase/src/gui/text/windows/qwindowsfontdatabase_ft.cpp:122:25: error: loop variable 'key' of type 'const QString' creates a copy from type 'const QString' [-Werror,-Wrange-loop-construct] for (const auto key : keys) { ^ Change-Id: Icdfa5e2a6753450213dcb96df70247c5a71c2293 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Doc: Fix documentation warnings for Qt GUITopi Reinio2020-08-281-2/+2
| | | | | | | | | | | | * Drop deprecation warnings for now-dropped items * Use the 'qt6' define and a new \nothing doc macro to conditionally document items on Qt 6 * Add a custom module header for docs that pulls in also Vulkan headers * Add \internal command for internal classes/functions * Move QtGUI-related code snippets from widgets to gui docs Change-Id: Ieb386b96631a49568d09059906d307c45c01d93a Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Use OpenType font weightsJonas Karlsson2020-08-281-1/+1
| | | | | | | Task-number: QTBUG-42248 Change-Id: Icdb301b27d6699c2b842c4563fbef9df73c23cbc Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* Use QList instead of QVector in gui implementationJarek Kobus2020-07-071-1/+1
| | | | | | | Task-number: QTBUG-84469 Change-Id: I366e845249203d80d640355a7780ac2f91a762f1 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Port platformsupport to QStringViewLars Knoll2020-06-151-2/+2
| | | | | | Task-number: QTBUG-84319 Change-Id: I8032382904bc8481fe0a147ca38f3de9cfb1890f Reviewed-by: Karsten Heimrich <karsten.heimrich@qt.io>
* Move windows font databases into QtGuiFriedemann Kleint2020-06-111-0/+444
Requires adapting a few config checks since cmake currently does not detect directwrite. Task-number: QTBUG-83255 Task-number: QTBUG-83931 Change-Id: I521f1924f701260b41dccbcecf87b19f08df5ccc Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>