summaryrefslogtreecommitdiffstats
path: root/src/gui/text
Commit message (Collapse)AuthorAgeFilesLines
* Windows: Add synthesized fonts also when there is a style nameEskil Abrahamsen Blomfeldt2021-05-113-12/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* Allow background inheritance between non-body block elementsAllan Sandfeld Jensen2021-05-081-1/+4
| | | | | | | | | | | Most nested block elements are merged together, so while we shouldn't do real inheritance we need to do it when block elements are combined. Pick-to: 6.1 Fixes: QTBUG-91236 Change-Id: I9e37b15f705db92c79a620d0d772f25d0ee72b8d Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* Support CSS text-decoration-color in underlines, overlines, strikethroughShawn Rutledge2021-05-075-4/+13
| | | | | | | | | | | | Also add a feature to the textedit example to set this value. [ChangeLog][QtGui][CSS] The CSS text-decoration-color attribute is now supported in rich text spans with underlines, overlines and strikethrough. Fixes: QTBUG-82114 Task-number: QTBUG-39617 Change-Id: I0065cb5431833da55b0f503ce7ff2b83b74b718a Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Apply specialData font capitalization to non-rawFont textAllan Sandfeld Jensen2021-05-061-2/+12
| | | | | | | | | | | We were not using the capitalization details from specialData in the regular path of QTextEngine::itemize() causing it to be ignored. Pick-to: 6.1 5.15 Fixes: QTBUG-90840 Change-Id: I7bb71fad4009f6d0685905a946c36ac1d24d8d3c Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* macOS: Fix synthesized boldEskil Abrahamsen Blomfeldt2021-05-061-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | When a user requested bold and there was no available font for this (which is quite common with CJK fonts and in fact is the case for the official Japanese font on the system), we should synthesize the boldness. This was done by checking if the requested font weight boldness matched the one in the font's traits, and if not, we flag the font boldness to be synthesized. But when initializing the font, we would first override the requested weight with the selected font's weight, *before* performing the check above. So even if there was a mismatch, we would not catch this and as a result, e.g. the system Japanese font would never be bold. [ChangeLog][macOS] Fixed an issue where boldness would not be correctly synthesized for families with no bold variant. Fixes: QTBUG-85634 Pick-to: 5.15 6.1 Change-Id: I36da59d7689455e29cca283cb0724a0841095918 Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Windows: Work-around misreporting of Script and RomanEskil Abrahamsen Blomfeldt2021-05-061-1/+3
| | | | | | | | | | | | | | | | | | | | | | Two legacy bitmap fonts are misreported as TMPF_VECTOR on Windows: Roman and Script. This causes them to be marked as scalable, and the automatic fallback to NativeRendering in Qt Quick does not kick in - causing the text elements to look empty instead. To work around this, we exploit the peculiarity that the type of these two fonts is reported as "0" in the enumeration, which is not a valid value. No other fonts on the system is reported as type 0, so we simply detect this error case and mark the fonts as non-scalable, which is the safer choice. [ChangeLog][Windows] Fixed text in "Roman" and "Script" bitmap fonts not showing in Qt Quick applications. Pick-to: 6.1 5.15 Fixes: QTBUG-85826 Change-Id: Id889f0dedb1d529e6dd64c6da9e17e303f4a9d04 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Remove Qt6 switches from QtGuiAllan Sandfeld Jensen2021-05-054-39/+0
| | | | | | | Removing now dead code Change-Id: I021539da6517fdb8443f8ae9431fc172b7910cfc Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Fix rare integer overflow in text shapingPaul Olav Tvete2021-05-051-1/+2
| | | | | | | | | | With extreme painter scaling, linearAdvance may be too large to fit in an unsigned short. Fixes: QTBUG-91758 Pick-to: 6.1 5.15 Change-Id: I7bbe6e77ec9bcef4aa5259da1d3000ed1a8eb27a Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* Write out the HTML correctly for nested listsAndy Shaw2021-05-052-3/+27
| | | | | | | | | | | | | | When we are having nested lists then we need to ensure that the HTML is outputted correctly so that the closing list and item tags are placed in the right order. [ChangeLog][QtGui][QTextDocument] The output of toHtml() now handles nested lists correctly. Fixes: QTBUG-88374 Pick-to: 6.1 5.15 Change-Id: I88afba0f897aeef78d4835a3124097fe6fd4d55e Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Export text-decorationAllan Sandfeld Jensen2021-05-051-7/+22
| | | | | | | | | It used to be ignored because we couldn't disable it, but that works fine now. So re-enable it. Fixes: QTBUG-91171 Change-Id: I4cf966211bb200b73326e90fc7e4c4d3d4090511 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* doc: Warn about kerning in QRawFont::advancesForGlyphIndexes()Eskil Abrahamsen Blomfeldt2021-04-271-2/+12
| | | | | | | | | | | The fact that KernedAdvances does not work correctly on a majority of fonts is confusing. So we warn users that this is the case and point them to the correct function to use instead. Task-number: QTBUG-92930 Change-Id: I70f4b09ea1050fceabbff25a9c91008d1754f772 Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com> Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Draw the cursor considering the descent is 0Tang Haixiang2021-04-201-3/+3
| | | | | | | | | | | | | | When the descent of the item is 0, ascent is the height of the item, base(base = si.ascent)> sl.base. At this time, sl.descent is not considered. The calculated y value may be <0. Fixes: QTBUG-86823 Fixes: QTBUG-92468 Pick-to: 5.15 6.0 6.1 Change-Id: I9cf088dec9162595e52ff72aa90ec3153a30fb72 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Assert that engine isn't nullptr before dereferencingVolker Hilsheimer2021-04-191-0/+1
| | | | | | | | | | | The engine pointer is guaranteed to be initialized in line 1838, so we can assert that the correct value is passed into the function to fix static analyzer warning 1d9b8ce922ee0891fb0d477dc17fdb8d. Change-Id: I773bbaa579afec0d7a79d4393ee66fd26ba9629b Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com> Reviewed-by: Jonas Karlsson <jonas.karlsson@qt.io> Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* Assert that engine isn't nullptr before dereferencingVolker Hilsheimer2021-04-191-6/+8
| | | | | | | | | | | | | | | | | | | | Various checks for "engine" in the previous code suggested that engine might be nullptr by the time we want to populate the out-parameters. This must not be the case, and QFontDatabase::load asserts already that a valid engine is loaded and returned. Fix static analyzer warning 7f68daa282c72e8cc172c681eb02f559 by asserting it here as well. As a drive-by, change the tested out-parameter to the last one in the list of optional parameters. Pick-to: 6.1 Change-Id: I3d9ff0f5f7c4740014301c073480d14fef54e2fb Reviewed-by: Jonas Karlsson <jonas.karlsson@qt.io> Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* Fix handling of surrogates in QBidiAlgorithmEdward Welbourne2021-04-161-2/+2
| | | | | | | | | | | | Prior code was naively assuming the character after a high surrogate would necessarily be a low surrogate, which is buggy. Fixes oss-fuzz issue 29718. Pick-to: 6.0 6.1 5.15 Change-Id: I10f023c4b5024a0d76fea0a3672001063591ec6d Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com> Reviewed-by: Robert Löhning <robert.loehning@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Add new enum value VisualTabCharacter into QCharZhang Hao2021-04-151-1/+1
| | | | | | | | | | | | | | With this enumeration value, users can get the width of the current font TAB character more conveniently In addition, added some documentation about where users may use this enumeration. Fixes: QTBUG-92205 Done-with: Volker Hilsheimer <volker.hilsheimer@qt.io> Done-with: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Change-Id: I9794b7553e9299e351f9182de02866d07a1393fc Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Adapt to Harfbuzz 2.8.0 updateEskil Abrahamsen Blomfeldt2021-04-131-4/+11
| | | | | | | | | | | | | | | | | The Unicode 13 language tags are available since Harfbuzz 2.6.7. For compilation with earlier versions, also update the hardcoded tags to match the ones in Harfbuzz (and in iso-15924): https://unicode.org/iso15924/iso15924-codes.html Task-number: QTBUG-90217 Change-Id: I4e2cfdf61a5c4189b8aac51644c9d80c816aeebc Reviewed-by: Lars Knoll <lars.knoll@qt.io> (cherry picked from commit 910ac477f013f2af690b66f1ac41d65ab7527843) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Don't judge other people's writing systemsVolker Hilsheimer2021-04-081-10/+8
| | | | | | Pick-to: 6.1 6.0 5.15 Change-Id: Ifb8265bad4c8c96c6b20f957c376cec47e28f666 Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* QTextHtmlParserNode: Limit colspan to avoid segfaultRobert Löhning2021-04-071-1/+1
| | | | | | | | | | | | | This fixes oss-fuzz issue 29758. [ChangeLog][QtGui][Text] QTextDocument::setHtml: column spans are limited to 20480, an arbitrarily high but reasonable value. Fixes: QTBUG-92463 Pick-to: 5.15 6.0 6.1 Change-Id: Ib759e3e3ac0b0d0d483f8e8ce11002e079db3ace Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Replace QTextDocumentResourceProvider with a std::functionVolker Hilsheimer2021-03-306-179/+60
| | | | | | | | | | | | | | | | | | | | | | 376e3bd8ecf40881685714f6f19e12d68e92127e added the new class for Qt 6.1, but during header review we concluded that using a class introduces complexity wrt instance ownership and API design that can be avoided by using a std::function instead. The functionality is tied to QTextDocument, so the type definition and the default provider API is added there. Since std::function is not trivially copyable, the atomicity of the previous implementation is not maintained, and concurrent modifications of and access to the global default provider from multiple threads is not allowed. The relevant use case can be supported by implementing a resource provider that is thread safe. Task-number: QTBUG-90211 Fixes: QTBUG-92208 Pick-to: 6.1 Change-Id: I39215c5e51c7bd27f1dd29e1d9d908aecf754fb7 Reviewed-by: Kai Koehne <kai.koehne@qt.io>
* Rename QUrlResourceProvider to QTextDocumentResourceProviderVolker Hilsheimer2021-03-296-27/+41
| | | | | | | | | | | | | | | | | While the class name is now a bit more than a mouthful, it's purpose is very narrowly tied to QTextDocument, so don't use a very generic name for it. That resources are provided based on a URL is to some degree an implementation detail, and URLs are resource locators so we don't need that in the class name. Address code review comment for 6.1. Add documentation and links to existing APIs with a similar purpose. Task-number: QTBUG-90211 Task-number: QTBUG-92208 Pick-to: 6.1 Change-Id: I4f09057cc2f53a5595513c1c9422e6ccaad6ca13 Reviewed-by: Kai Koehne <kai.koehne@qt.io>
* Merge integration refs/builds/qtci/dev/1616666973Qt CI Bot2021-03-252-3/+5
|\
| * Fix deprecated macrosVolker Hilsheimer2021-03-252-3/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The QTextCharFormat::fontFamily methods are deprecated as of Qt 6.1, not as of Qt 6.0. Mark them as obsolete in the documentation and point to the replacement there as well. Address API review comment. Pick-to: 6.1 Change-Id: Id71ea1ebab6f7a385c8c3f286a35f88ba1177857 Reviewed-by: Andy Shaw <andy.shaw@qt.io>
* | Merge integration refs/builds/qtci/dev/1616659664Qt CI Bot2021-03-251-1/+1
|\ \ | |/ |/|
| * Fix compilation with experimental x11 paint engine featureEskil Abrahamsen Blomfeldt2021-03-251-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Adding support for vertical subpixel positions in d79a9b1a4f694a227ce62ccab9b44685a9755916 changed some private APIs which were used from the xcb-native-painting feature. This fixes this (it does not implement vertical subpixels but simply sets the vertical subpixel position to 0). It also adds a missing "override" which triggered the warnings-are-errors when compiling for me. Fixes: QTBUG-92011 Pick-to: 6.1 Change-Id: If214a0d19a41e623ca9ef8e6215bc145f9846ae9 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* | Fix compilation error when LTTng enabledHyungchan Kim2021-03-251-2/+2
|/ | | | | | | | Updates tracepoint for qtgui and qtopengl fit to current source code. Change-Id: I2e8ecc86a37942425734202a11bbc792e8f27bf3 Reviewed-by: Hyungchan Kim <hyungchan2.kim@lge.com> Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* Doc: Fix various documentation issuesTopi Reinio2021-03-161-2/+3
| | | | | | | | | | - Document QIODeviceBase - Document QPointerEvent::points - Fix linking issues Task-number: QTBUG-90662 Change-Id: Ib123d5708953b22e01f95c82626b39a49fff95b2 Reviewed-by: Nico Vertriest <nico.vertriest@qt.io>
* Minor robustness improvement of text codeEirik Aavitsland2021-03-161-2/+4
| | | | | | | Fix a potential issue reported by static analysis Change-Id: I41b8eaa3c0840eec054e880c4f3298ee32685b46 Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
* Support family names that end/start with spaceEskil Abrahamsen Blomfeldt2021-03-111-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | If the family name starts or ends with a space in the actual font data, then this would not be selectable by Qt. This is because we trim the family name before matching it against the contents of the database. Testing on Windows GDI, it actually does trim the spaces on the family names (matching a request for "Chibola" with a font called "Chibola " for instance), but since we read the font data ourselves, we are not doing this. To ensure we never have font names that cannot be matched in the database, we make sure we trim the family names before registering them. [ChangeLog][QtGui][Text] Fixed matching against fonts which has a family name that ends or starts with a space. Task-number: QTBUG-79140 Pick-to: 6.1 Pick-to: 6.0 Pick-to: 5.15 Change-Id: I9cdb50b78a7da2d2697f992ce462033eb1d7ada7 Reviewed-by: Andy Shaw <andy.shaw@qt.io>
* Limit value in setFontSizeFromValue()Robert Löhning2021-03-011-2/+2
| | | | | | | | | | | | Avoids overflows in QFreetypeFace::computeSize and QFontEngineBox::boundingBox Fixes oss-fuzz issue 30290 Pick-to: 5.15 6.0 6.1 Change-Id: If8e9ff74bf706a701e26832ad21b3439a3b437f7 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Make constructing QFont from families explicitVolker Hilsheimer2021-02-181-1/+1
| | | | | | | | | Disallow implicit conversion from QStringList to QFont. Address API review comment. Pick-to: 6.1 Change-Id: I73eb3a49182865e050965e97d459463e73bcddfd Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* Fix mingw compiler warningsMårten Nordheim2021-02-113-32/+22
| | | | | | | | Mark overridden functions with override. Remove unused static function. Change-Id: I06bd52c66ac7b970dfced0e553eac9c4a4d44d79 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Handle macOS 11 issues in softHyphens testAllan Sandfeld Jensen2021-02-081-2/+8
| | | | | | | | | | Calculate the effective width of the hyphen better, and compare with ceiled sizes. Pick-to: 6.1 6.0 Fixes: QTBUG-90698 Change-Id: I7ed2eb44c54240ecb2f8a38e5acf1f32608b2bfb Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* Fix crash when requesting A32 glyph on WaylandEskil Abrahamsen Blomfeldt2021-02-051-1/+5
| | | | | | | | | | | | | | | | | | | | | | | On Wayland we aren't getting any information about the subpixel layout of the screen. On Freetype, this triggers an assert / memory corruption when explicitly requesting a subpixel antialiased glyph (via QRawFont) because it needs to know the layout to render the glyphs. It might be possible to get this information in the Wayland plugin, but at least we should have a failsafe which doesn't crash when the problem occurs. This simply falls back to using A8 antialiasing when it doesn't know the subpixel layout. [ChangeLog][Freetype] Fixed crash when calling QRawFont::alphaMapForGlyph() with subpixel antialiasing on Wayland. Fixes: QTBUG-90236 Pick-to: 6.0 Pick-to: 6.1 Pick-to: 5.15 Change-Id: Iddee2e171a81664ae9e3989115881f23262b2182 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Remove false Q_UNREACHABLE from shaping codeEskil Abrahamsen Blomfeldt2021-02-031-2/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | This was added by 9ff76c27b9031ae7c49c4c9e8b5a3bea1e0e3c78 on the basis that it signifies a shaping error and would later assert or crash. But the line is easily reachable by user code. If Harfbuzz returns 0 glyphs, it just means it is unable to shape the string, for instance if the input string only contains default ignorables (like a ZWJ) and does not have any appropriate glyph to use for replacement. Qt expects there to always be at least one glyph in the output (num_glyphs == 0 is used to indicate shaping is not yet done), so to avoid asserts later on, we simply populate the output with a single 0 token, which is a required entry in the font that is reserved for representing unrepresentable characters. This also adds a test and therefore a zero-width joiner to the test font to reproduce the issue. [ChangeLog][QtGui][Text] Fixed a possible crash with certain fonts when shaping strings consisting only of control characters. Fixes: QTBUG-89155 Pick-to: 5.15 Pick-to: 6.0 Change-Id: Ia0dd6a04844c9be90dcab6c464bebe339a3dab11 Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
* Avoid overflow in text layoutEirik Aavitsland2021-01-281-0/+4
| | | | | | | | | Fixes oss-fuzz issue 29313. Pick-to: 6.0 5.15 Change-Id: Idbabd162fa9e0dbce687981bdbcc75be37189a61 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io> Reviewed-by: Robert Löhning <robert.loehning@qt.io>
* Optimize subpixel positioningAllan Sandfeld Jensen2021-01-271-1/+1
| | | | | | | Dividing by (1/x) is the same as multiplying with x. Change-Id: Ica854d1e012ad83437e32f12de0d3513a42ae6f8 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Implement vertical subpixel positioning where availableEskil Abrahamsen Blomfeldt2021-01-2513-120/+220
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* Gracefully reject requests for absurd font sizesEirik Aavitsland2021-01-211-0/+6
| | | | | | | | | Avoid overflows. Fixes: QTBUG-89899 Pick-to: 6.0 5.15 5.12 Change-Id: Ic1a83c1704fe20be3d032358dc91ee8e751f2281 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* Remove debug outputEskil Abrahamsen Blomfeldt2021-01-202-3/+0
| | | | | | | Accidentally committed in d8602ce58b6ef268be84b9aa0166b0c3fa6a96e8. Change-Id: I553503720eace59a7bd510a7b9b2aba44c2242a1 Reviewed-by: Andy Shaw <andy.shaw@qt.io>
* macOS: Fix assert with Freetype engineEskil Abrahamsen Blomfeldt2021-01-181-1/+1
| | | | | | | | | | | | d8602ce58b6ef268be84b9aa0166b0c3fa6a96e8 removed the internal usage of the singular fontDef.family, changing this to fontDef.families.first() instead, which will assert if the families list is empty. To match old behavior, we set the symbol flag to false if there is no family name. Change-Id: I594cf3dfa2798e60b37dc525c172fb2cd9aa7380 Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com> Reviewed-by: Andy Shaw <andy.shaw@qt.io>
* Disable copying of QUrlResourceProvider to avoid slicingAlexander Volkov2021-01-141-0/+2
| | | | | | | Amends 376e3bd8ecf40881685714f6f19e12d68e92127e Change-Id: Ib7b0de900c009f3bdb3f699a218444aafbe2eabe Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Windows font engine: Silence warnings about not being able to enumate font ↵Friedemann Kleint2021-01-131-2/+2
| | | | | | | | | | | families Turn the warning into a qCDebug() statement and add explanatory comment. Fixes: QTBUG-85683 Pick-to: 5.15 6.0 Change-Id: I2a6a7a089a660294f3e9c3096299c75635b3b215 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@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>
* Introduce QUrlResourceProvider to load resources for HTMLAlexander Volkov2021-01-126-2/+191
| | | | | | | | | | | | | | | | | | | | | | | | | | | QTextDocument and the text editor classes suggest to override their loadResource() methods to provide data associated with a text document. This approach has the following drawbacks: - it requires subclassing - there is no way to set a global resource provider - QLabel is missing virtual loadResource() method and it can't be added without breaking ABI QUrlResourceProvider is designed to solve these issues. One should create a derived class that implements QUrlResourceProvider::resource(). The objects of the derived class then can be set for any text document. The default resource provider can be set with QUrlResourceProvider::setDefaultProvider(). This change also adds QLabel::setResourceProvider(), which doesn't break ABI. [ChangeLog][QtGui][Text] Introduced QUrlResourceProvider that allows to load resources for HTML. It is intended to replace the use of QTextDocument::loadResource(). Change-Id: Iaf19b229f522a73508f20715257450fe58f68daf Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Doc: Explain how boundingRect handles null QRectFPaul Wicking2021-01-111-1/+3
| | | | | | | Fixes: QTBUG-87107 Pick-to: 6.0 5.15 Change-Id: Ib7f9bd58b0f3454167dc61f95e0d8e6dec52a5ed Reviewed-by: Andy Shaw <andy.shaw@qt.io>
* QPdfWriter: fix embedding fonts in pdf filesChristian Ehrlicher2021-01-091-1/+1
| | | | | | | | | | | | The container size change from int32_t to int64_t created a subtle error during font serialization. The size of a QByteArray was serialized without a proper cast and therefore now 8 bytes instead 4 bytes were written to the stream. Fixes: QTBUG-89727 Pick-to: 6.0 Change-Id: If9255a5a3124038356bc5053810f98c7c88f8a01 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Revert "Fix invalid text layout data when a full layout run is interrupted"Frederik Gladhorn2021-01-071-5/+2
| | | | | | | | | | | | | | | | This reverts commit 09ee4282e5eedf5b44245e8b28b223339f87ddfa. The commit made the layouting time go from linear to quadratic, which is problematic when rendering big documents impractical. I wrote an alternative fix for QTBUG-20354 which will come as separate change since it approaches the problem in a different way. Fixes: QTBUG-89599 Task-number: QTBUG-20354 Pick-to: 5.15 Pick-to: 6.0 Change-Id: Ie450332f06ee40e60c8e4c6c7d10834bff1acf74 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* Remove the qmake project filesJoerg Bornemann2021-01-075-215/+0
| | | | | | | | | | | | | | | | Remove the qmake project files for most of Qt. Leave the qmake project files for examples, because we still test those in the CI to ensure qmake does not regress. Also leave the qmake project files for utils and other minor parts that lack CMake project files. Task-number: QTBUG-88742 Change-Id: I6cdf059e6204816f617f9624f3ea9822703f73cc Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Kai Koehne <kai.koehne@qt.io>
* QInputControl: accept surrogate category characterLiang Qi2021-01-051-0/+3
| | | | | | | | | See also https://unicodebook.readthedocs.io/unicode_encodings.html#utf-16-surrogate-pairs . Fixes: QTBUG-89184 Pick-to: 6.0 5.15 Change-Id: I04eff7f42f0030346603a7b31e4ac854a477030c Reviewed-by: Lars Knoll <lars.knoll@qt.io>