summaryrefslogtreecommitdiffstats
path: root/src/gui/text/windows/qwindowsfontenginedirectwrite.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Windows: Change default hinting preference for high-dpiEskil Abrahamsen Blomfeldt2022-01-251-8/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | When high-dpi is enabled, we would previously default to QFont::PreferVerticalHinting which maps to the asymmetric antialiasing strategy, where only horizontal antialiasing is enabled. The idea behind this is that it provides crisper text, especially for smaller font sizes, but for larger font sizes the aliasing artifacts outweigh the added sharpness. Inspecting native Windows applications, such as the system settings, it looks like asymmetric antialiasing is used up to a certain font size threshold. The documentation uses a font size of 16 as the suggested threshold. In accordance with the documentation, we use PreferNoHinting for font sizes above this threshold. [ChangeLog][Windows] When high-dpi scaling is active, the default text antialiasing has been set to symmetric for larger fonts (pixel size higher than 16 px). The old default can be selected manually as QFont::PreferVerticalHinting. Fixes: QTBUG-99066 Change-Id: Ibf53556f6e2cbbe1dc5d30c6c1743a499a99a90b Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Fix printing with unhinted fontsEskil Abrahamsen Blomfeldt2021-08-161-0/+16
| | | | | | | | | | | | | | | | | | On high-dpi displays or when you explicitly select an unhinted font, we pick a DirectWrite font engine. This hit an uncovered code path on Windows, because we relied on being able to get the HFONT from the font engine. To fix this, we introduce an alternative code path which gets the HFONT based on the DirectWrite font when this font engine is active. [ChangeLog][Windows] Fixed an issue where the characters in printed text would look too small. Pick-to: 6.1 6.2 Fixes: QTBUG-95720 Change-Id: Ifd609e92512e1f25f0ee2aace35cb5ccedf09030 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Fix right-to-left text with DirectWrite engine + QPainterPathEskil Abrahamsen Blomfeldt2021-06-181-1/+2
| | | | | | | | | | | | | | | | | When QPainterPath was used for RTL text, either directly or because the target text size exceeds 64 pixels, we would pass true for "isRightToLeft" to DirectWrite, causing it to do adaptation internally for this. But the RTL layout had already been handled by Qt, so we would essentially reverse the layout twice and also move the text to negative X coordinates. Passing false instead fixes this, as it will then just use the positions we pass in blindly. Fixes: QTBUG-94175 Pick-to: 5.15 6.1 6.2 Change-Id: Ie9a47e56e97fc867ede10ab21ac5e3f003ddcacb Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Fix mingw compiler warningsMÃ¥rten Nordheim2021-02-111-11/+11
| | | | | | | | Mark overridden functions with override. Remove unused static function. Change-Id: I06bd52c66ac7b970dfced0e553eac9c4a4d44d79 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Implement vertical subpixel positioning where availableEskil Abrahamsen Blomfeldt2021-01-251-12/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For some use cases, vertical subpixel positioning may be useful, as it allows you to vertically align text with other painting primitives. This does impose an overhead, so we make it opt-int with a render hint on the painter. Note that this is only supported on Freetype currently. It might be possible to support on older macOS versions, prior to Mojave (which has disabled subpixel positioning entirely), but since it would have limited usefulness and Freetype is cross-platform anyway, I skipped that. Note: This drive-by-fixes an issue with subpixel positioning where glyphs would always be offset by 1/64, because we added the aliasing offset *after* we had determined the closest subpixel position. The idea of this, as far as I can understand, is rather to snap to nearest subpixel position upwards, not to add an offset to all glyphs, so it should be added before finding the correct position. It had a subtle visual effect when animating the position. It might be that we could get rid of it entirely, as I haven't been able to reproduce any issues with that, but I have moved it instead, to match what I believe the intention was. [ChangeLog][QtGui][Text] Added render hint flag QPainter::VerticalSubpixelPositioning which will position text at subpixel positions vertically whenever supported. In absence of this, text position will be rounded vertically as before. Fixes: QTBUG-35682 Change-Id: I8ce7a72a64e5a0924dac7c244e3e07c2938bfd09 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Fix Windows Font database code to use configure featuresFriedemann Kleint2020-06-121-17/+3
| | | | | | | | | Use QT_CONFIG, QT_REQUIRE_CONFIG instead of custom macros. Task-number: QTBUG-83255 Task-number: QTBUG-83931 Change-Id: Id067448dd59f4810a6bc8042d3fbe4244d5cc88a Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Move windows font databases into QtGuiFriedemann Kleint2020-06-111-0/+1030
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>