Private Use Area characters are quite valid input characters when used
in combination with a custom font. Joiners also serve an important language
purpose in semitic writing systems.
Note that there is a hack where we disregard any character produced
using CTRL or CTRL+SHIFT specifically because of German keyboards. I have chosen to
keep the hack in this patch to limit the change (though I have made an exception
for ZWJ and ZWNJ since both are produced using Ctrl+Shift on Windows), but it
will probably have to be reverted.
[ChangeLog][QtWidgets][Input] Accept characters in Private Use Area, as well as
zero-width joiners and zero-width non-joiners in input in QLineEdit and QTextEdit.
Task-number: QTBUG-42074
Task-number: QTBUG-57003
Change-Id: I73f3b7d587a8670de24e902dc52a51f7721dba5a
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Commit 2bc7a40048 taught the CoreText font database to populate the
families lazily, and in the process added a guard to ensure that we
didn't populate internal fonts (prefixed with a '.'), as these fonts
would then show up in font selection dialogs.
Commit 909d3f5c7 then added support for private fonts, by making it
possible to filter out any private fonts from font selection daialogs.
But the guard was not removed, so we were still not populating these
fonts. This guard has been removed, and the filtering function has
been updated to include the conditions of the guard.
Next, commit e5e93345c5 used [UIFont fontNamesForFamilyName:] to verify
that each family that we registered with the font database would also
have matching fonts when finally populated. This is not the right approach,
as [UIFont fontNamesForFamilyName:] does not handle internal fonts.
Instead we trust what CTFontDescriptorCreateMatchingFontDescriptors()
gives us, but make sure to register the resulting font descriptors
with the original/originating font family, instead of the one we pull
out of the font descriptor.
Finally, as of iOS 10, we can use CTFontManagerCopyAvailableFontFamilyNames
instead of [UIFont familyNames], which gives us all of the internal font
families like on macOS, instead of just the user-visible families. For
earlier iOS versions we manually add '.PhoneFallback', as we know it
will be available even if not listed in [UIFont familyNames].
The end result is that we register and populate families like '.PhoneFallback',
which is critical to supporting more esoteric writing systems.
The check in tst_QFont that styles for a given family is not empty has
been removed, as we can't guarantee that on all platforms, which is
also documented for QFontDatabase::styles().
Task-number: QTBUG-45746
Task-number: QTBUG-50624
Change-Id: I04674dcb2bb36b4cdf5646d540c35727ff3daaad
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
../tst_qfile.cpp: In member function 'void tst_QFile::handle()':
../tst_qfile.cpp:2661:38: warning: ignoring return value of 'ssize_t read(int, void*, size_t)', declared with attribute warn_unused_result [-Wunused-result]
tst_qstatictext.cpp:862:58: warning: unused parameter 'textItem' [-Wunused-parameter]
../tst_qtcpsocket.cpp: In member function 'void tst_QTcpSocket::abortiveClose()':
../tst_qtcpsocket.cpp:2254:90: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
Test.cpp: In member function 'void My4Socket::read()':
Test.cpp:66:20: warning: 'reply' may be used uninitialized in this function [-Wmaybe-uninitialized]
../tst_qlocalsocket.cpp: In lambda function:
../tst_qlocalsocket.cpp:701:51: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
../tst_qtcpserver.cpp: In member function 'void tst_QTcpServer::linkLocal()':
../tst_qtcpserver.cpp:935:92: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
../tst_qtcpserver.cpp:940:92: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
Change-Id: Ic315069768bcb63a6b333c28ac65b0b992b0d43f
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@qt.io>
Looks up the canonical names of enumerated fonts and register them under
their preferred names if present.
Also changes the logic handling registration of english aliases, so it
is always done, even if it might in rare cases cause a double
registration since that is safe.
Task-number: QTBUG-53458
Change-Id: Ia010774b26072192b55697b717cc37442c852881
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
No-break-spaces should not be counted in the space data, but rather
be treated as any other non-breakable character. We were already
taking care of this in the loop we reach if the item starts with
a character which isn't whitespace, but there is a second loop for
items that begin with whitespace characters.
The result of this was that in certain circumstances where you gave
the nbsp its own format and made the line wrap, the previous line
would count an extra trailing space and it would swallow the first
character in its following line.
[ChangeLog][QtGui][Text] Fixed a bug where a no-break space would
sometimes cause the first character of the containing line to not be
displayed.
Task-number: QTBUG-56714
Change-Id: Idd760a389052e6de70f6cc397122b217987fa5f2
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
We were throwing away important information by claiming that all
fonts support all the standard sizes in QFontDatabase on Windows
This caused the font dialog to list unsupported sizes for bitmap
fonts, unlike the native font dialog.
We would also claim to support creating bitmap fonts at
unsupported sizes, which would lead to
1. QFontInfo(font).pointSize() would return the requested size,
not the actual rendered size.
2. Bitmap fonts created at 64 pixels and higher would be invisible.
On Mac, there are no system bitmap fonts, and the use is not very
common, but installing some bitmap fonts on the system, it does
seem to ignore the sizes supported in the font and just displays
the standard list instead, so we keep the current behavior there.
[ChangeLog][QtGui][Text] Fixed list of supported sizes for
bitmap fonts on Windows.
Task-number: QTBUG-56672
Change-Id: Idbec2db9eb3381ab5ddf6259bd2befcba9b93564
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
The QTextDocument::toPlainText() converts some characters in the
text to ASCII, which can be problematic for use cases where you
want to save the precise contents of the document, e.g. in
Qt Creator. Since we don't want to change the behavior of
toPlainText(), we introduce a new function which returns the
raw text contents of the document instead, with no modifications.
[ChangeLog][QtGui][Text] Added QTextDocument::toRawText() function.
Task-number: QTBUG-56538
Change-Id: Ib6c48a16551c4c71c4c431760f993793d1af6806
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Fixes the test for width of condensed fonts so it doesn't depend
on the presence of the Liberation font on the system, and adds
another test that condensed sub-families can be matched
consistently. The latter will however not work on Windows until
QTBUG-53458 is solved.
Task-number: QTBUG-51335.
Change-Id: Id6d046274fa21b2dce0ad6b32dce7f1c8a92a4f4
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
The layout isn't actually created until endLayout() or setLineWidth() is
called. So in the case where this was not done, the height of the line
would be 0, thus multiple lines would be placed on top of each other, at
y == 0.
[ChangeLog][QtGui][Text] Fixed QStaticText when manually breaking lines
and no text width was set.
Task-number: QTBUG-56346
Change-Id: I7f6ed6260545882f05fe39b21134315eca7401b9
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
After e109b8a0f3, it is possible
that the cache will be flushed as a result of inserting a new
font rather than just when the timer event triggers. When doing
superscript and subscript text layouts, we would first get
a regular font engine, then a scaled one, and then reference
the regular font engine *after* getting the scaled one. If the
regular font engine was deleted as a result of inserting the scaled
one, we would get a dangling pointer and crash.
The situation was improved by 49926bb9ef.
You would now to switch between 256 different fonts in the layout
in order to trigger it. The test in the commit will trigger the
crash even with this change.
[ChangeLog][Qt Gui][Text] Fixed a crash that could happen if you
were doing many different text layouts with different fonts
and superscript or subscript alignment.
Task-number: QTBUG-53911
Change-Id: Ia33108252e030eff25924ef1b7c10b9d59b5bc8c
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
cf53aa21bf and 3aaa5d6b32
were reverted because of reconstruction in 5.7.
defineTest(qtConfTest_checkCompiler) in configure.pri is smart
enough to cover the case in a9474d1260.
DirectWrite: Fix advances being scaled to 0
Since 131eee5cd, the stretch of a font can be 0, meaning
"whatever the font provides". In combination with ec7fee96,
this would cause advances in the DirectWrite engine to be scaled to
0, causing the QRawFont test to fail.
Conflicts:
configure
mkspecs/features/uikit/device_destinations.sh
mkspecs/features/uikit/xcodebuild.mk
src/corelib/global/qglobal.cpp
src/corelib/global/qnamespace.qdoc
src/plugins/platforms/cocoa/qcocoamenuitem.h
src/plugins/platforms/windows/qwindowsservices.cpp
src/plugins/platformthemes/gtk3/qgtk3dialoghelpers.cpp
src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp
src/widgets/kernel/qapplication.cpp
tests/auto/widgets/dialogs/qfiledialog/tst_qfiledialog.cpp
tests/auto/widgets/dialogs/qfiledialog2/tst_qfiledialog2.cpp
Change-Id: I4656d8133da7ee9fcc84ad3f1c7950f924432d1e
[ChangeLog][QtGui][QTextDocument] Fixed a bug that would return a wrong
position when searching backward from the end of the document.
Task-number: QTBUG-48182
Change-Id: I6e88f808a50cb840f61e7bc579e2a28c5300089d
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Use the new qtConfig macro in all pro/pri files.
This required adding some feature entries, and adding
{private,public}Feature to every referenced already existing entry.
Change-Id: I164214dad1154df6ad84e86d99ed14994ef97cf4
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Cap height is an important metric of font, in particular it is
required to make decent implementation of "initial-letter"
CSS property in QtWebKit.
Note that some fonts lack cap height metadata, so we need to
fall back to measuring H letter height.
Change-Id: Icf69d92159d070889085e20d31f2e397d796d940
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
If an entire font family is condensed or stretched and we match by
family name, the default stretch factor of 100 will make the font
engine try to synthesize it back to medium stretched font.
The existing code is already made to deal with a stretch of 0 that is
no longer used. This patch reintroduces 0 stretch to indicate no
specific stretch has been requested. Specifically setting stretch to
100 on a QFont will introduce the old behavior.
[ChangeLog][QtGui][QFont] The default value of QFont::stretch() is
now 0 to indicate any default stretch is acceptable.
Task-number: QTBUG-48043
Change-Id: I574747f980fd4f9893df828818aae99a07b41623
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
Don't try to locate the text by coordinates at the edge of the text but
simply aim at the center vertically _and_ horizontally.
Task-number: QTBUG-52991
Change-Id: Ia9e84fc5d12491840e739c4eea730fe13058f3c7
Reviewed-by: Simo Fält <simo.falt@theqtcompany.com>
don't refer to non-existent feature 'OdfWriter', and test these
classes if we have a developer build.
Change-Id: I59b0d4bbba4958ed3bd76f504cd8b493dbd7f877
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Font style names are quite irregular and the simplistic matching
implemented in QFontDatabase::styleString(const QFont &) is unable to
properly resolve the style name when font is recreated from a string.
This causes the fonts before and after serialization to be considered
different, even though they are not. The from/toString methods were
made to write and respect the exact font style.
[ChangeLog][QtGui][Important Behavior Changes] QFont::toString() and
QFont::key() were modified to save the font's style name if one is
set, invalidating any stored font identifiers. QFont::fromString()
was also adjusted to accommodate the change.
Task-number: QTBUG-54936
Change-Id: Ibc7c54119acdd8f0950d6049cc89f859bf981504
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Adds parsing and handling of the indirect sibling selector, this should
mean we can at least parse all CSS3 selectors even if we do not yet
support all of them.
Also adds tests for previously added CSS3 selectors.
Change-Id: I1ce9afb9466044a38bdec167affc21a87837e4a4
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Adds the three CSS3 attribute selectors.
During this the internal naming of the existing attribute-selectors have
been changed to be more clear, and the dash-matching has been fixed to
not just be beginsWith.
A non-breaking space have also been removed from the CSS.
Change-Id: Ia4db4a5a19e3ceee8c3c8a4b744149edd1d32bdc
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
tst_QAbstractTextDocumentLayout::imageAt() is flaky and is blacklisted
Task-number: QTBUG-53648
Change-Id: Ia9b0c8934a82d7518ff9d9e1538d995ab73feedb
Reviewed-by: Heikki Halmet <heikki.halmet@qt.io>
When ShowLineAndParagraphSeparators was set, we would replace the
separator character in the user's string in some cases, since we never
detached from the input string and just const_cast the pointer to the
shared buffer.
[ChangeLog][QtGui][Text] Fixed bug where a QTextLayout with
ShowLineAndParagraphSeparators would modify the layout's input
string.
Task-number: QTBUG-42033
Change-Id: I92f9100b750f16e52b38b718245c13e5c4a0ebb9
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
To get QtWayland in the CI, we need to blacklist formatAt on OpenSUSE
42.1
Task-number: QTBUG-52991
Change-Id: I8f411ccd6ab1e1d385e98cd8cae81a5570d68a8f
Reviewed-by: Tony Sarajärvi <tony.sarajarvi@qt.io>
We need to blacklist the test since we need to get QtWayland in CI
Task-number:QTBUG-53648
Change-Id: Id98c18aa8f39766b5dbb859b085f1912c42339fe
Reviewed-by: Tony Sarajärvi <tony.sarajarvi@qt.io>
All this code was skipped on all platforms, so keeping it is just
confusing.
Change-Id: I405d2e791b22a2494fe5ccac6e3bf08905dc4e5a
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
This is a partial revert of 992f233c in Qt 4 repo. The rest of the
change cannot be reverted, since it added public API, but that
API might be useful anyway.
The patch was wrong, basically. QFont::exactMatch() should not claim
that you can get an exact match for a typeface alias. It also introduced
some weird inconsistencies: For instance, if the first font the alias
resolved to in FontConfig did not exist, then exactMatch() would return
false, even if it then resolved to the next one which existed. This
caused a test failure on OpenSuse, where the preferred font for "sans"
is Arial, which doesn't exist, so Roboto will be used instead.
[ChangeLog][QtGui][Important Behavior Changes] QFont::exactMatch() now
returns false when the provided typeface is an alias.
Task-number: QTBUG-46054
Change-Id: I7532d2879b492544620aa0d1d87dd493a4923af9
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
As of 5.7, HB-NG is the default shaper engine.
Change-Id: Ia5400444a5e387fa6b56de47fabc6f1c2c166f85
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>