Unearthed an off-by-one error in a QByteArray::fromRawData() call in
tst_qtextdocumentfragment. Fixed by porting to QStringLiteral.
[ChangeLog][Important Behavior Changes] All conversions from QByteArray
to QString now preserve embedded NULs. This is done in order to provide a
faster conversion from QByteArray to QString that does not involve a call to
strlen. If you need the old behavior, convert from QByteArray::constData()
instead. If you are porting from Qt 4, we suggest to make your source compile
with QT_NO_CAST_FROM_BYTEARRAY before porting to Qt 5.
Change-Id: Ibca40f503920fee6f3a5f0d74a04b38b8849796f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
When CSS is set in a head tag then it was not being inherited by the child
tags when the CSS specification indicates that the properties are in fact
inherited. This ensures that those properties are inherited and the non
inheritable ones are unchanged.
A test is added to cover the different situations with inheritance and a
fix is done for the QTextDocumentFragment test which was passing despite
having incorrect defaults.
Task-number: QTBUG-28770
Task-number: QTBUG-34153
Change-Id: I55966240845a885852a04ecb82c61926dea9f800
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
When the default font has the pixel size set instead of point
size, then pointSize() will return -1 and the output from the
HTML will include the pixel size instead. This happens e.g.
on Android when we extract font information from the system.
Change-Id: I26dc49fff215c9887cf0b78dcfff88df0f74450d
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@theqtcompany.com>
Qt copyrights are now in The Qt Company, so we could update the source
code headers accordingly. In the same go we should also fix the links to
point to qt.io.
Outdated header.LGPL removed (use header.LGPL21 instead)
Old header.LGPL3 renamed to header.LGPL3-COMM to match actual licensing
combination. New header.LGPL-COMM taken in the use file which were
using old header.LGPL3 (src/plugins/platforms/android/extract.cpp)
Added new header.LGPL3 containing Commercial + LGPLv3 + GPLv2 license
combination
Change-Id: I6f49b819a8a20cc4f88b794a8f6726d975e8ffbe
Reviewed-by: Matti Paaso <matti.paaso@theqtcompany.com>
rawMode only has an effect under X11 in pre-QPA times.
Change-Id: Iaff8fed8f4ae5af5dd0399bb3ebd9d590a39a758
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
tst_collections.cpp
tst_collections.cpp(3138) : warning C4305: 'argument' : truncation from 'size_t' to 'bool'
tst_collections.cpp(3190) : see reference to function template instantiation 'void testContainerTypedefs<QVector<int>>(Container)' being compiled
with[Container=QVector<int>]
(repeated)
tst_qringbuffer.cpp(297) : warning C4267: 'argument' : conversion from 'size_t' to 'int', possible loss of data
tst_qringbuffer.cpp(300) : warning C4309: '=' : truncation of constant value
tst_qringbuffer.cpp(306) : warning C4267: 'argument' : conversion from 'size_t' to 'int', possible loss of data
tst_qrawfont.cpp(947) : warning C4309: 'argument' : truncation of constant value
tst_qsslsocket_onDemandCertificates_member.cpp(217) : warning C4189: 'rootCertLoadingAllowed' : local variable is initialized but not referenced
Change-Id: I6143d4ad121088a0d5bdd6dd2637eb3641a26096
Reviewed-by: Kai Koehne <kai.koehne@theqtcompany.com>
The auto-hinter in the FreeType version bundled in Qt gives
slightly different advances on some glyphs. As noted in
the removed code, this was already observed on Windows and QNX,
and recently also on Android.
I'm sure it could also happen on platforms using the system library
if the system library was the same version as the one bundled in Qt.
Instead of expect-failing the test, we simply accept both the
observed results as valid.
Note that we need to accept 9 as a result for the default hinting
preference on all platforms, not just Windows, since the default
hinting preference in FreeType can be a system setting.
Change-Id: I3cc0f33f0f66dd64419770b37c10dee457706b5e
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
On e.g. Android, the tabs will be scaled by DPI. This breaks the
logic in the QTextLayout tests for tabs. It's not possible to
just scale the expected sizes either, since the whole text layout
will be affected by font sizes and scaling, and it's difficult to
predict where characters will land on different platforms and
resolutions.
To avoid breaking this test on other platforms, we just skip them
when we know they will break. Since the code tested is
cross-platform, this will hopefully not have any significant
impact on our coverage.
Change-Id: I65d6c33c9c6724665983a17f99eadcf1baedcc20
Reviewed-by: Tony Sarajärvi <tony.sarajarvi@digia.com>
Reviewed-by: BogDan Vatra <bogdan@kde.org>
The calculateTabWidth() can trigger shaping of the item, which can
cause the layout data to be reallocated, so we need to update the
local pointers to it, like we do when we explicitly invoke the
shaper.
[ChangeLog][Text] Fixed problems with text layout when using custom
tab stops.
Task-number: QTBUG-43126
Change-Id: Ifaeeeb4bfb1a55e6638b12b444f53d2679d3d1e6
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
The sample lineedit in Qt's own font dialog shouldn't have its font
affected by stylesheets.
Not only does this hampers the ability to preview the font, it actually
overrides the font selection as that one is taken directly from the
widget.
Task-number: QTBUG-41513
Change-Id: I11d0bef8c7bf7bdae4cc08b6b9276d0fc14a75fb
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@theqtcompany.com>
Even when we do not intend to display the text, we still need to go
through the processing of mnemonics to remove them from the text.
Instead of capping the max underlines to 0, the TextDontPrint option now
just saves adding the underline formats.
Task-number: QTBUG-41593
Change-Id: I67790650dbed0092de2c63e5d5a9349dc02d5846
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
Reviewed-by: Robert Loehning <robert.loehning@digia.com>
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
Currently QTextDocuement only provides find using QRegExp. This patch
aims to add support for QRegularExpression.
[ChangeLog][QtGui][QTextDocument] Support for searching with a
QRegularExpression in a document has been added.
Change-Id: I6dba10545b83995d093407038a821fe54db3d261
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
When 'cursorPos' is out of bounds ([0, lineEnd]), this method crashed.
Change-Id: Ia0540ab3afbffb5c598f7b8515263cce3b3928e4
Task-number: QTBUG-40753
Reviewed-by: Dominik Haumann <dhaumann@kde.org>
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
In Qt 5.3.0 a change was added which automatically adapts Common
script to surrounding scripts in accordance with the Unicode tr#24.
This broke *a lot* of cases of font selection because the font
selection algorithm is not prepared for handling characters with
adapted scripts. We need to disable this change for now and redo it
later with patches to font selection to avoid the regressions.
[ChangeLog][Text] Fixed several regressions in font selection when
combining different writing systems in the same text.
Task-number: QTBUG-39930
Task-number: QTBUG-39860
Change-Id: Id02b5ae2403c06542ed5d81e7c4deb2e0c7d816e
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
[ChangeLog][Important Behavior Changes] HarfBuzz-NG is now the default
shaper on all platforms. This results in a better shaping results
for various languages, better performance, and lower memory consumption.
Task-number: QTBUG-18980
Change-Id: I4d9454fc37e9050873df3857e52369dfc7f191b2
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
This takes 300ms off the total time for this test.
Change-Id: I230b8a58315797a81579f6a07da282b0dc40637d
Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
This function has been inlined in commit 4f50be8d,
but wasn't removed.
Change-Id: I1a4eb7399ab2dd87a9fb15c4c886004d777487a8
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com>
Several tests require test data to be deployed with the
application. The easiest way to achieve this on Android
is to add them to a qrc file and use the QFINDTESTDATA macro
to look up the files. This fixes several test failures
in the gui/text subdirectory for Android.
Change-Id: If944bb1fc93434a1b2d6487da829d21bd6b84e87
Reviewed-by: BogDan Vatra <bogdan@kde.org>
I've also updated the qfont test so it passes on Android now. Note that
there are no suitable cursive/fantasy fonts on Android, so the regular
default "Roboto" (or "Droid Sans" on older devices) will be picked here
instead.
[ChangeLog][Android] Fixed font selection to prefer "Droid Serif" when
Serif style hint is set on QFont.
Change-Id: I294eebcc4d79410e435bdddce552acc6044753b2
Reviewed-by: Christian Stromme <christian.stromme@digia.com>
When the platform plugin gives us specific fallbacks for a
specific script, we need to respect this, and load the correct
font family regardless of which writing systems it supports.
This is especially important since the common script is adapted
to match surrounding, proper scripts, so characters such as
digits next to e.g. Hebrew text will be marked as Hebrew. On
stock Android, there is a single Hebrew font, and this would
previously be put in all fallback slots for Hebrew regardless of
what fallback fonts were dictated by the platform plugin. Since
this font does not support the digits, they would show up as boxes.
[ChangeLog][Android] Fixed common characters like digits and
punctuation showing as boxes when positioned next to non-latin
scripts.
Task-number: QTBUG-39377
Change-Id: I1555e208a8ddc587c0bbdbfff1600cafdd9442e9
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
At some point since Qt 4.8, the nbsp character has acquired
the whitespace attribute, causing it to be treated exactly
like an ordinary space. To account for this, we add an extra
check in the layout code to avoid breaking on non-breaking
spaces even if they have the whiteSpace flag set.
This is a temporary fix for the regression. The line breaking
algorithm needs to be refactored and support Unicode tr14
properly, which it currently doesn't.
[ChangeLog][Text] Fixed lines breaking on non-breaking spaces.
Task-number: QTBUG-39832
Change-Id: Ibd7e1a11ce4b82c611ecda1542c8638a67bf3cae
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
The sanity check added in d16508a285
didn't actually catch the case where the invalid data is large
enough to contain the offset table and table directory. Added sanity
checks to all the code that accesses the font data now, so this
should fix crashes with partial data as well as invalid data.
Task-number: QTBUG-37190
Change-Id: Ie43f10d8cf0b09007783b9b1c4d91bfed8c6b0f0
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
When passing invalid data to QRawFont, we need to fail gracefully
and mark the font as invalid, instead of crashing. This crashed
because of different missing sanity checks in the Windows
and FontConfig font databases.
[ChangeLog][Text] Fixed crash when trying to load a font from
invalid data.
Task-number: QTBUG-37190
Change-Id: I62c81217ec7d873350b575c9d4ae8e6f0a939540
Reviewed-by: Michael Bruning <michael.bruning@digia.com>
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
In the justification code, we unconditionally subtracted one
from the line_length, but then compared the result to 0 afterwards,
so we did not support when the line_length is 0 initially, which
can happen if it only consists of spaces (in which case
trailingSpaces will be non-zero and line_length will be zero.)
The fix is to bail out for both strings of length 1 and length 0.
[ChangeLog][Text] Fixed an assert when justifying a QTextLine
which only contains spaces.
Task-number: QTBUG-38520
Change-Id: Ib04993f47eb2f9f7fc49c4a5400f18f9682a72f2
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
The plain text edit's smart repaint logic in
QPlainTextDocumentLayout::documentChanged assumes that during a change inside
just one block, the block is in the state before the edit and a call to
layoutBlock() is going to bring it up-to-date. Then only a comparison of the
bounding rect - before and after - is going to allow for smart repaints.
The assumption of the layout being in the same state as before the edit got
broken by commit cc57a2e90f, which introduced
code to use a QTextCursor within a slot connected to QTextDocument's
contentsChange signal. The usage of the QTextCursor there ends up updating the
layout of the block ahead of time, breaking the assumption and therefore the
optimization, in the sense that during changes in the preedit that cause a
change of height / line count, the old bounding rect in
QPlainTextDocumentLayout::documentChanged and the new bounding rect will be the
same. This causes a repaint of only the edited block, missing repaints of the
following blocks, even though the line count effectively changed.
So what's causing QTextCursor to mess with the layout is the attempt of
updating the vertical movement x property. This patch inhibits the update,
marking it as dirty for initialization later. This means that slots connected
to this low-level signal cannot rely on the cursor's visual x position, but
that doesn't seem useful anyway and isn't required for commit
cc57a2e90f.
Task-number: QTBUG-38536
Change-Id: I5fae12d646a4b2d2cc22b9f2d021e5dc8cfdda94
Reviewed-by: Paul Olav Tvete <paul.tvete@digia.com>
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Make it closer to the Unicode specs (UAX#24):
* Common now inherits the preceding character's script, if any;
* In a combining character sequence, if the base character is
of Common script, the entire sequence is treated like if it were
of the first non-Inherited, non-Common script in the sequence.
See http://www.unicode.org/reports/tr24/tr24-21.html for more details.
[ChangeLog][QtGui] Fixed regression in arabic text rendering.
Task-number: QTBUG-28813
Task-number: QTBUG-29930 (related)
Task-number: QTBUG-35836
Change-Id: Id85761965b08ca94c674d5f3613fe58b82b2ce9c
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
Reviewed-by: Ahmed Saidi <justroftest@gmail.com>
For AAT shaping support, we need either the pre-QPA shaping trick
or the new HarfBuzz on Mac; prefer the latter.
Disable some test cases aimed to test the HB-old behavior; enable ones
that should guarantee shaping-unaware behavior.
[ChangeLog][OS X] Use CoreText text shaping engine for support of
complex scripts. If required, the shaping engine used in previous
versions can be preferred by configuring Qt with -no-harfbuzz.
Alternatively, the QT_HARFBUZZ environment variable could be set to "old".
Task-number: QTBUG-18980 (relates)
Task-number: QTBUG-38246
Change-Id: Iee6fe4f5bc047e77259182b8585385c5febd02b3
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
Some data was never serialized (styleName, hintingPreference) and
some was incorrectly serialized (styleStrategy). This change also adds
auto tests for every applicable QDataStream version.
[ChangeLog][QtGui][QFont] QFont now serializes its data properly,
without any data loss.
Task-number: QTBUG-22814
Task-number: QTBUG-22946
Change-Id: I34e61b10662b7ad6c57054dacc7e1f522f5b5c5d
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com>
We don't support xlfd fonts anymore and indeed QFont::setRawName()
is an empty method.
[Changelog][QtGui] QFont::setRawName() and QFont::rawName() are
deprecated.
Change-Id: Ic52d42a9bc200ba8b246dd4e28c77f84e086dad5
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@digia.com>
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
This patch fixes an issue when a font that was added with
QFontDatabase::addApplicationFont can not be removed any more.
The reason for that is that QFontconfigDatabase::addApplicationFont
adds the font to the FontConfig application set from where it
cannot be removed any more and is picked up every time the font database
is repopulated (e.g. after a call to QFontDatabase::removeApplicationFont).
This also fixes the QFontDatabase autotest which unfortunately does
not fail on linux, because it tries to add "FreeMono" (which in most
cases is already there as a system font). So this patch removes FreeMono
and adds LED_REAL as test font.
Change-Id: I70fc823075923aa426da1eb3e052affcc416e399
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
The text shaping process has been unified for all platforms.
Task-number: QTBUG-23064
Task-number: QTBUG-24565
Task-number: QTBUG-26495
Change-Id: Ida4c4be85f1a72c04399d2e6760fa36b33a0464e
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
Reviewed-by: Lars Knoll <lars.knoll@digia.com>