LineBreakHelper saves previousGlyph for calculating right bearing of
this glyph when it is needed. But between the saving of this glyph and
the calculation the fontEngine can change (if we move to the different
item). So we need to save the fontEngine together with the glyph and
use this saved fontEngine for the saved glyph, while still using the
current fontEngine for calculating right bearing of the current glyph.
[ChangeLog][QtGui][QTextLine] Fixed a possible UB in the calculation
of glyph right bearing when a QTextLine layout is performed.
Change-Id: I14c729a1f761a45eaba85754c0b15a27faff7458
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>
The regular variant of Monotype's "Courier New" font, the one
which is included by default on Windows, has an EBLC table, which
overrides the ascent and descent for certain sizes. The Freetype
engine doesn't automatically respect this, so there is a hack
in place to fetch the correct values for us.
But there were two issues with that code, which lead to us getting
the wrong line spacing for that particular font: The first was that
we did not update the height metric for the font. This is used,
together with the ascent and descent, to calculate the leading of
the font. So when we set the height of text lines in a layout, we
would get a leading based on the height for the scalable font
and the ascent/descent from the EBLC table, and this would not match
up.
Also, as reported elsewhere on the Internet, the descent value in
the EBLC table for Courier New is set to a positive value instead
of a negative one. This must be a bug in the font, so we special
case it and fix the value to avoid bogus line spacing later.
[ChangeLog][Qt Gui][Text] Fixed line spacing with some scalable fonts
containing bitmaps with the Freetype font engine.
Task-number: QTBUG-50090
Change-Id: I95165dde7b8ffac6d7f9ac43baadb3eb75d28abe
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
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>
When the font in question is a color font, we should call
the appropriate function bitmapForGlyph() and return the
color bitmap from the font, rather than the alpha map in
QRawFont::alphaMapForGlyph().
Change-Id: I2c3cd66db5a93ddf0cc463f4d136dd6771b9734c
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@theqtcompany.com>
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Text is copied from corresponding QFontMetrics methods.
Change-Id: Ife79e0d1b06ca3f691f2fd8bd796b41aeaa76954
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
5971b88e is not needed in new configure.
This merge also reverts "fix QMAKE_DEFAULT_*DIRS resolution with
apple SDK", 2c9d15d7, because it breaks iOS build with new
configure system.
Conflicts:
mkspecs/features/default_pre.prf
mkspecs/features/mac/toolchain.prf
mkspecs/features/toolchain.prf
src/dbus/qdbusconnection.cpp
src/plugins/sqldrivers/mysql/qsql_mysql.cpp
src/sql/drivers/mysql/qsql_mysql.cpp
src/widgets/widgets/qmenubar.cpp
src/widgets/widgets/qmenubar_p.h
tools/configure/configureapp.cpp
tools/configure/environment.cpp
tools/configure/environment.h
Change-Id: I995533dd334211ebd25912db05b639d6f908aaec
QString::fromLatin1 always allocates memory, but there are
cases where we can avoid/reduce allocations or/and reduce
text size, e.g.:
QStringBuilder expressions
Fix: replace QString::fromLatin1 with QL1S
QString::fromLatin1().arg(String) pattern
Fix: replace with QStringBuilder
Overloaded functions with QL1S arg
Fix: replace QString::fromLatin1 with QL1S
In rare cases if there is no overloaded function
with QL1S and we have deal with string literal,
replace QString::fromLatin1 with QStringLiteral.
Change-Id: Iabe1a3cc0830f40ef78a0548afa4368583c31def
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
The calculated end position of script lines, consisting of nothing but
trailing spaces, is lower than the start position. This results in not
shaping those script lines.
Task-number: QTBUG-55255
Change-Id: Ib70c1a800d2f70b7f61e3d05c10618e275f45f12
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
QLatin1Literal is just alias of QLatin1String
for Qt4 compatibility.
So it's style cleanup patch.
Change-Id: Ia3b3e5dc3169f13a1ef819d69be576b8a8bfb258
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Otherwise we will return an empty list of fallbacks if no QFontDatabase
has been created yet.
Task-number: QTBUG-55222
Change-Id: I50508162fad3206e0acf3cc6eb39aefac5c3e197
Reviewed-by: Peter Varga <pvarga@inf.u-szeged.hu>
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@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>
The limitation of four glyph caches per font engine was to prevent memory
spikes during rotation of text. But in an application with multiple top
level OpenGL windows, each with their own context, we'd end up trashing
the list of glyph caches during rendering, even if each window just drew
the same static text.
Having a shared context between the windows helped a bit, but had other
performance issues due to the globally shared state, so the better approach
is to limit the caches to four per context.
This brings the multiwindow manual test from a grinding 4fps on macOS
to a smooth 60fps for 20 concurrent windows.
Task-number: QTBUG-52372
Change-Id: I26edd5f6edb5c7818e14b2203af062df19ae7127
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Empty QPainterPaths can have one move-to element, so the test
to detect this case was incomplete. For empty glyphs returned
from DirectWrite this would trigger a crash. This is only
reproducible after also enabling embedding of fonts with the
DirectWrite engine.
Task-number: QTBUG-54740
Change-Id: I3fbbfb8d958818550d5ab5234242d39688b84811
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Same change as in QColor (d38f86e50b).
relocs: -239
text: +2248B
data: -3872B
(optimized GCC 6.1 Linux AMD64 build). The text size increase means
we pushed the data into an immutable section.
Change-Id: Iad10c877d4a4877878dded56a7ef1e14ff92c996
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Replaces our mix of comments for annotating intended absence of break
in switches with the C++17 attribute [[fallthrough]], or its earlier
a clang extension counterpart.
Change-Id: I4b2d0b9b5e4425819c7f1bf01608093c536b6d14
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
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>
Replace substring functions that return QString
with corresponding functions that return QStringRef.
Change-Id: I3c485f89352a1ee66076fba74fd486da9349c354
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
This is a runtime setting, as the user's freetype version can differ from
the developer's, and freetype already safely handles it internally when
not available.
Task-number: QTBUG-55345
Change-Id: I26e73728196d60ae26e5f1919ecd0dadac393890
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
Fix the occurrences where the wrong classes are mentioned.
Change-Id: Ia291af77f0f454a39cab93e7376a110c19a07771
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
When adding color font support to the Freetype engine, we added
a special case to some functions based on the assumption that
color fonts do not contain the latin alphabet. The reason for
the assumption is that color fonts are currently most popular
for emojis and the most popular ones on Linux did not contain
the latin alphabet. But there is nothing special about color
fonts making them less likely to contain latin characters
than other fonts especially made for non-latin writing systems.
If we want an additional fallback when the x character is
not available, this should be implemented for all font engines
and font types.
Change-Id: I1c4aa28d49c38ba7a416c1cae50a1d1c09cbda41
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: jian liang <jianliang79@gmail.com>
The short-cuts in qdrawhelper's qt_alphargbblit_argb32 expects the
alpha value of the A32 glyphs to be 0xff.
Since the alpha value is not otherwise used, set it to that.
The reported image format is also changed to RGB32, matching
coretext and windows fontengines, and expected by the OpenGL
paintengine.
Change-Id: I0873156d716566f7f1634249155b6c9983a3d0de
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
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>
As of version 10.12 (Sierra), the name of Apple's desktop operating
system will be macOS. Change the occurrences where the Mac platform
is discussed to use a macro \macos, which expands to 'macOS'. This
helps with adapting to future renaming.
Update the instructions on mac-specific Q_OS_* macro usage.
Add a \target for the old 'Qt for OS X' topic to keep links working
for other documentation modules that try to link with the old name.
Change-Id: Id33fb0cd985df702a4ae4efb4c5fd428e77d9b85
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
With change 208496091d the space character
was replaced with a visual document terminator character. However this
meant that if the whitespace was visualized without the document
terminator character visualized then clicking after the text would cause
it to be positioned off by one.
By bringing back the space character when the terminator is not being
visualized then it will correctly place the cursor at the end of the
text.
Change-Id: I335c1773a37a654f3196bd350562e8f92ffd5369
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
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>
Conflicts:
configure
5.7 now supports clang on android; but dev re-worked configure
src/gui/kernel/qevent.h
One side renamed a parameter of a constructor; the other added an
alternate constructor on the next line. Applied the rename to both
for consistency.
tests/auto/tools/moc/tst_moc.cpp
Each side added a new test at the end.
.qmake.conf
Ignored 5.7's change to MODULE_VERSION.
configure.json
No conflict noticed by git; but changes in 5.7 were needed for the
re-worked configure to accommodate 5.7's stricter handling of C++11.
Change-Id: I9cda53836a32d7bf83828212c7ea00b1de3e09d2
The Freetype cache was almost completely disabled by
134c6db858 because after that
change, the lockedAlphaMapForGlyph() function would no longer
cut off early for empty glyphs like spaces, but rather go
through all alpha map functions before it realized that there
was nothing to render. This would in turn invalidate the cache
for every empty glyph, causing all glyphs to be rerendered for
every isolated word.
This change adds back a cut off. This is only needed in the
lockedAlphaMapForGlyph() function, since the superclass implementation
of the other alpha map functions already contains a cut off for
width/height == 0.
[ChangeLog][Qt Gui][Text] Fixed a performance regression in Freetype
engine that was introduced in Qt 5.5.
Change-Id: I381285939909e99cc5fb5f3497fecf9fa871f29a
Task-number: QTBUG-49452
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
QTextDocument is used from several different Qt modules so it needs to be
possible to access its privates from outside of Qt Gui.
Change-Id: I8087f8312e0db46bd457a6119d974caa27660d57
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
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>
When font antialising is disabled, the created alpha maps will be Mono
format. Make sure that the created QImage is valid by ensuring that
it has a color table of the right size.
Issue was earlier handled by a4e2f2e687,
but that will be partially reverted because of compatibility break.
Task-number: QTBUG-50745
Change-Id: I7c521288469ae94805a3326644771270d97ab979
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
This reverts commit 13040043b2.
It introduced a bad regression, noticeable for longer documents, as
it would cause the documentChanged(0, length) to trigger a layout of
the entire document.
The bug report for the commit (or the commit itself) does not contain
a test case, but it is regardless the wrong approach. Note that
QQuickTextEdit already listens to the contentsChange signal and
invalidates the changed parts of the document as a reaction to this,
so it should already work as expected.
[ChangeLog][Qt Gui][Text] Fixed performance hit from showing large
QTextDocuments in a QTextEdit or QTextBrowser. (Regression introduced
in Qt 5.3.0)
Task-number: QTBUG-51411
Change-Id: I6e7fbf8f62a1d68779eef5da3781de14d9fdcad8
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>
Conflicts:
src/corelib/io/qtemporarydir.cpp
One side encapsulated a repeated piece of #if-ery in a local define;
the other added to the #if-ery. Made its addition to the other's.
src/corelib/kernel/qeventdispatcher_unix_p.h
One side moved some members into a struct; this collided with a #undef
check that neither side now has. Discarded the #undef part.
src/gui/opengl/qopengltexturehelper_p.h
5.7 deleted a bunch of methods; not clear why merge got confused.
src/tools/moc/moc.cpp
One added a name to the copyright header; another changed its URL.
Change-Id: I9e9032b819f030d67f1915445acf2793e98713fa
Change e109b8a0f3 introduced a
performance regression when rapidly switching fonts as long as
the number of different fonts is over a relatively small number, since
the cost of fonts can be high compared to the limits set on the cache.
Since the original patch was intended to avoid exceeding the
open file limit when using Freetype on Windows, we add an
additional check on the number of engines in the cache as well
for the added, synchronous cache flush.
The limit is set to 256 to make it unlikely that it is exceeded
during a single paint event, but it can also be configured when
building Qt if a higher limit is needed.
[ChangeLog][QtGui][Text] Fixed performance regression when rapidly
switching between a large set of fonts.
Task-number: QTBUG-54180
Change-Id: I92b9fbe14fca4f11c9c6dfdcdbec6d19a61b86a7
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
The current QFontDatabase().writingSystemSample for Arabic is an
arbitrary text and meaningless.
This suggested text is used in LibreOffice and it makes sense for Arabic
people.
Task-number: QTBUG-53390
Change-Id: I7456d2741fbc07b4cfffd6151b421cb4427dd3e9
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Conflicts:
qmake/library/qmakebuiltins.cpp
qmake/library/qmakeevaluator.cpp
qmake/library/qmakeevaluator.h
qmake/project.h
QMakeEvaluator:
* evaluateConditional(): one side changed return type, the other
changed a parameter type.
* split_value_list(): one side changed a parameter adjacent to where ...
* expandVariableReferences(): ... the other killed one overload and
changed the survivor
src/corelib/io/qlockfile_unix.cpp
One side changed a #if condition, the other moved NETBSD's part of
what it controlled.
src/corelib/tools/qdatetime.cpp
One side fixed a reachable Q_UNREACHABLE in toMSecsSinceEpoch(), the
other moved it from the private class to the public one, in the midst
of the "short date-time" optimization, which confused diff entirely.
One side changed a QStringLiteral to QLatin1String, the other rewrote
adjoining code.
src/network/kernel/qauthenticator.cpp
Both rewrote a line, equivalently; kept the dev version.
src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm
src/platformsupport/fontdatabases/mac/qfontengine_coretext_p.h
One side changed #if-ery that the other removed.
tools/configure/configureapp.cpp
One side added a check to -target parsing; the other killed -target.
tests/auto/testlib/selftests/expected_cmptest.lightxml
tests/auto/testlib/selftests/expected_cmptest.teamcity
tests/auto/testlib/selftests/expected_cmptest.txt
tests/auto/testlib/selftests/expected_cmptest.xml
tests/auto/testlib/selftests/expected_cmptest.xunitxml
Regenerated using generate_expected_output.py
I note that quite a few other expected_* come out changed, now.
There was no git-conflict in
src/widgets/kernel/qformlayout.cpp
but it didn't compile; one side removed some unused methods; the other
found uses for one of them. Put FixedColumnMatrix<>::removeRow(int)
back for its new user.
Change-Id: I8cc2a71add48c0a848e13cfc47b5a7754e8ca584
Associates the scalableBitmapFactor with the freetype QFontEngine
so that it is preserved when caching the engine
Task-number: QTBUG-53652
Change-Id: I010f9d235ccf30679b112e0c05e01bc247a3693f
Reviewed-by: jian liang <jianliang79@gmail.com>
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
Use QStringBuilder more.
Use QL1S directly, without QString construction.
Change-Id: Iad844391367681fc1013b9725403d009e7c346e6
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Replace it with QL1S in QStringBuilder expressions
and in overloaded functions.
Replace patterns 'QString::number() + QStringLiteral'
and 'QStringLiteral + QString::number()' with
QString::asprintf.
Saves some text size.
Change-Id: Ib39b2332264dfc3df04e77f2c101b47a1030cef4
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
The new modular configuration system requires one global
header per module, that is included by all other files in
this module.
A similar scheme and naming convention is already being used
for many other modules (e.g. printsupport, qml, quick).
That header will later on #include the configuration file
for Qt Gui. For now it defines the Q_GUI_EXPORT macro for
this library.
In addition, add a private global header, qtguiglobal_p.h,
that can later on include the private config header for
Qt Gui for things we don't want to export to the world.
Change-Id: Id9ce2a4f3d2962c3592c35e3d080574789195f24
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
And blacklisted a few tests in tst_QUdpSocket.
Conflicts:
src/android/jar/src/org/qtproject/qt5/android/QtNative.java
src/corelib/global/qglobal.cpp
src/corelib/global/qsystemdetection.h
src/corelib/io/qfileselector.cpp
src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldeviceintegration.cpp
tests/auto/network/socket/qudpsocket/BLACKLIST
Task-number: QTBUG-54205
Change-Id: I11dd1c90186eb1b847d45be87a26041f61d89ef6
Usage of this macro has been removed, and so can the macro.
Task-number: QTBUG-52389
Change-Id: I28a5459e577b78f0f9907612893d6850848f405d
Reviewed-by: Yoann Lopes <yoann.lopes@qt.io>
Do the multiplication of the normal components in floating point to
avoid integer overflows. Also add an assert, since a scale of 0 here
will cause a normal of (0, 0) which will assert further into the
drawRectangle() function, and the cause is not immediately clear.
Task-number: QTBUG-51956
Change-Id: If7187d56af28eaa149f8f362050a587da5adb262
Reviewed-by: Yoann Lopes <yoann.lopes@qt.io>
Assuming a certain max height for glyphs would make it impossible
to render certain fonts. The follow up to this change is in
Qt Quick, where the code must also be adapted to make it work.
Task-number: QTBUG-52389
Change-Id: Iabebb2de21a92d1537b2965aa6603529c1d5d587
Reviewed-by: Yoann Lopes <yoann.lopes@qt.io>
The first is "exact", not "more": qCalculateBlockSize. It ensures that
there's no overflow in multiplying, adding the header size or when
converting back to an int.
The second is the replacement for qAllocMore: it calculates the block
size like the first, but increases the block size to accommodate future
appends. The number of elements that fit in the block is also returned.
Task-number: QTBUG-41230
Change-Id: I52dd43c12685407bb9a6ffff13f5da09f816e667
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Do not override the requested font-weight. This was a wrong rewrite of
a now redundant if-statement.
Change-Id: I20a745cac02d896fdeaa853f20c6b6647084fceb
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
Now that the minimum deployment target (and thus SDK) is 10.9 for OS X
and 7.0 for iOS, all code paths affecting platform versions lower than
the aforementioned are removed.
Change-Id: Id985c7259c4ac069319d88f2c29c9559ae9e8641
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
... instead of homebrew algorithm.
Saves some memory allocations and some text size.
Change-Id: I3abb49d3b247dbb132688ea99e6eae731e31615c
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
... instead of call of qstrlen(), because of ctor of QL1S
already do this work for us. The old code is Qt4 legacy.
Change-Id: I449ce7ea481af0efeade258d2cd5652db1f1a8b1
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Replace substring functions that return QString with
corresponding functions that return QStringRef where
it's possible.
Create QString from QStringRef only where necessary.
Change-Id: Id83c60cc7568b20ef008b51c582cfdf466a47e35
Reviewed-by: Edward Welbourne <edward.welbourne@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>
This allows us to pass pointers to storage that is not an array of
uchar, which it hardly ever is.
Change-Id: Ifea6e497f11a461db432ffff14490d2c2df21906
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
In order to avoid loading and checking all fonts on the system when
the string contains a line separator, we blacklisted it in
98a23b974509bd1b6d9459e6c79677bdcbaa0108 in Qt 4. The same logic
applies for paragraph separators, line feeds and carriage returns.
Task-number: QTBUG-51934
Change-Id: I121dce17a8ac79b5b790e24c6596438e501e871a
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.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>
The documentation wrongfully recommended deleting QTextFrames
directly. This would cause a crash, since the destructor didn't
update the document's layout at all. The correct way is the same
as when removing other aspects of the document.
Task-number: QTBUG-53082
Change-Id: I64f0ad08f1d063626456fa51d03611871ce6aa45
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
This patch mainly do two things:
1) Support color bitmap font for freetype fontengine. This partially
based on Corentin Jabot's patch
2) Support ARGB opengl glyph cache when workaround_brokenFBOReadBack is
true (It is always true under Android). Some code refactor has been
done in QOpenGLTextureGlyphCache.
This patch also bump the minimal required freetype version to 2.2
[ChangeLog][General][Freetype] Support color font rendering
Task-number: QTBUG-35156
Change-Id: I35aae5f98ba9a27b70a48db3f2647fc070c39c33
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
Some color bitmap fonts will have a size greater than 127 pixels,
areMetricsTooLarge() will return true(its advance exceed 127) for
these fonts and we are unable to render these fonts since
QFontEngineFT::loadGlyph() will simply do nothing if
areMetricsTooLarge() return true. To support bitmap font whose size
is between 128 and 255, we change x,y,advance of QFontEngineFT::Glyph
to short variable to make areMetricsTooLarge() return false, in this
way we will be able to render such color bitmap fonts.
Change-Id: I9ab244b14884cdde91040a462f2fbca650b91289
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
Always prefer the requested font, even if it doesn't support the
script of interest, and fallback to a font that *does* support that
script, so that the best-matching font always takes a precedence.
The result looks much closer to what CT and GDI/DW does.
Task-number: QTBUG-35836
Task-number: QTBUG-39377
Task-number: QTBUG-43408
Change-Id: I6a89593565683f318f7292ec5ecf271dadc4142a
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
Coverity, CIDs 10917, 10918. This fix looks like purely cosmetic
and unneeded: we check f->error() after f->open(). Unfortunately,
f->open() can fail without setting an error (if you provided an invalid mode).
Change-Id: Idbfcb9305b3f004e5e425cb6076b41e193b8d473
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
These types are held in QVarLengthArrays, so benefit
from being trivially relocatable. They are also part
of the private API, so there's no BC issues with
potential uses of these types in QList, except for
QPainter::PixmapFragment, which consequently has been
marked as relocatable only.
Change-Id: I90fb9a19231c6f5c71c593602fc997ffafe8f047
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
The QTextBlockFormat::FixedHeight overrides the line height
regardless of its calculated height. If the line contains
objects or text which is higher than the specified line height,
using FixedHeight will cause them to overlap with the previous
line. This is not what happens in normal web browsers. The
expected behavior is that the line height given in CSS is the
minimum height, but that we still reserve space needed to display
everything without overlaps.
To make it possible for people to retain the old behavior, we
introduce the -qt-line-height-type property, which allows them
to override the default.
This also fixes output from toHtml() to use the new property
rather than set the minimum height of the paragraph or the
"line-spacing" property, which does not exist in either CSS nor
in Qt.
[ChangeLog][QtGui][Important Behavior Changes] When line height
is specified in pixels, this is now interpreted as the minimum
line height rather than an absolute line height to avoid overlaps.
To get the old behavior, use the -qt-line-height-type property in
CSS and set it to "fixed".
Task-number: QTBUG-51962
Change-Id: Ic2dde649b69209672170dad4c2de1e1c432a1078
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
... instead of using removeAt in a loop, with quadratic complexity.
Change-Id: I38b49e56b12c396db9fc0f1b75d8fb43c503a7f6
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
In 208496091d, the behavior of
QTextOption::ShowLineAndParagraphSeparators was changed to also
include a section symbol at the end of the document. This was
an unnecessary behavioral change. Instead we add a separate flag
for this marker.
[ChangeLog][QtGui][Text] Added QTextOption::ShowDocumentTerminator
flag.
Task-number: QTBUG-52048
Change-Id: I2f6f7e5c9c894f46525682f2c6520a7003fa09bc
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
This fixes yet another bug where the selection spans both line
wraps and explicit line breaks. Offsetting the log clusters by
the text position in 342c909b34
was not entirely correct, because in some cases the script
item will refer to a specific part of the string, as indicated
by si.position, while iterator.itemStart is in the context
of the full string.
In this case, the log cluster array pointer we use refers to the
script item's part of the array, i.e. it is already offset by
si.position. Therefore, we must offset the logClusters pointer by the
text position *relative* to the current script item. Previously
we would actually offset by si.position twice in cases where
si.position != 0.
We want the text range to refer to the full string, though,
so it can be compared to other text ranges later. However,
in some cases when we are requesting only part of a script item,
then iterator.itemStart does not correspond to relativeFrom,
so in order for the text range search to work, we must pass in
the text positions we are using [relativeFrom, relativeTo],
though offset by si.position so that it refers to the full
string and not just the part addressed by the script item.
Task-number: QTBUG-51759
Change-Id: Ib69856d6d3bc1dd501db94c9d295623f436d122c
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
While extremely unlikely, there is a theoretical possibility that
the '0' glyph of a given font will have a width or height of 1 pixel,
in which case the (x + 1) / 2 way of getting the center would give us
an out of bounds pixel. We just default to true in this case, since
we cannot make any assumption based on the 0 glyph if it doesn't make
any sense. If the image is invalid, we default to false.
Change-Id: I36cea0b80c9d55aa10eb65db44d1b7ec8a40fc8c
Reviewed-by: Yoann Lopes <yoann.lopes@theqtcompany.com>
Scaled hinted glyphs looks ugly, see QTBUG-24846. It was fixed
in 6da6845f07 by disabling hinting
for them. But at the same time that commit also disabled hinting
for glyphs with the most common transformation - rotating without
scaling.
Detect this type of transformation and don't disable hinting for it.
Change-Id: I0e69a2b60e7e4bc24e9efc4fdedb984df07ad15c
Task-number: QTBUG-50574
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>
Both QFont::handle() and QFont::freetypeFace() used to
be available in Qt 4 but were removed in Qt 5. There's
currently no API to get access to the native font handle,
which the font engine holds in a way or another.
Similar to the way it was in Qt 4, the actual handle type
depends on the font engine currently in use. The types map
as follows:
Font Engine Native Handle
------------------------------------
DirectWrite IDWriteFontFace *
Freetype FT_Face
Mac CTFontRef
Win HFONT
All other font engines return a null handle.
Change-Id: I3bea8259ac1378fd24079723aa6603bf9e74834c
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>
Found by UBSan:
src/gui/text/qrawfont.cpp:647:55: runtime error: load of misaligned address 0x000001eeed26 for type 'quint32', which requires 4 byte alignment
src/gui/text/qrawfont.cpp:648:50: runtime error: load of misaligned address 0x000001eeed02 for type 'quint32', which requires 4 byte alignment
Fix by using the qFromBigEndian() overload that can read from
unaligned memory.
While touching the code, also disentangle the two loops so that
operations are now performed in memory order instead of inter-
leaved, use less magic numbers, and avoid a QByteArray detach.
Change-Id: I26fa39726f6fa2e957b60863fa160280cf1dc9ac
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
The new imageAt() method pairs with the existing anchorAt() method, and
allows retrieving the source link of the image under the cursor.
We also expose the common logic between these two methods as an
additional formatAt() method.
[ChangeLog][QtGui][QAbstractTextDocumentLayout] Added imageAt() and
formatAt() methods, which respectively can be used to retrieve the
source link of the image under the cursor, or the QTextFormat of the
text under the cursor.
Change-Id: If09815dde91de6616edcb19c72c462dbf7abd8ef
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
This has several advantages over the current “fill the rectangle with the
default text color” approach:
- When the background color for some block of text is black, the cursor will be
white and visible.
- It is possible to set the cursor width to width of a character (for example
for monospace edits), and the characters will be visible when the cursor is
displayed.
Change-Id: I2e6303166d5d63c8dd11ec4fcf3d734cdf440e7e
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>
Makes the 96DPI attribute check avoid undefined behavior by using
QCoreApplication::instance() directly, instead of calling through
qApp, which performs an invalid cast to QGuiApplication.
Change-Id: Ib86e7d2461b462a2d623f1364414f7d4d2293f22
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Found by UBSan:
qrawfont.cpp:618:60: runtime error: load of misaligned address 0x2acee92a5569 for type 'const quint32', which requires 4 byte alignment
Fix by using MAKE_TAG(), like everywhere else, instead
of a load through a type-punned and misaligned pointer.
Change-Id: I52b88ca05a57f7d8c5e5bce953384de49514079b
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
This change partially reverts 1bfc7f68 about QT_HAS_BUILTIN define
and undef in src/corelib/tools/qsimd_p.h.
This change is also squashed with "Fall back to c++11 standard
compiler flag for host builds" which is done by Peter Seiderer.
Conflicts:
mkspecs/features/default_post.prf
src/3rdparty/sqlite/0001-Fixing-the-SQLite3-build-for-WEC2013-again.patch
src/3rdparty/sqlite/sqlite3.c
src/corelib/tools/qsimd_p.h
src/gui/kernel/qevent.cpp
src/gui/kernel/qwindowsysteminterface.cpp
src/gui/kernel/qwindowsysteminterface_p.h
src/plugins/bearer/blackberry/blackberry.pro
src/plugins/platforms/cocoa/qcocoasystemsettings.mm
src/plugins/platformthemes/gtk2/gtk2.pro
src/plugins/styles/bb10style/bb10style.pro
src/sql/drivers/sqlite2/qsql_sqlite2.cpp
tools/configure/configureapp.cpp
Task-number: QTBUG-51644
Done-with: Peter Seiderer <ps.report@gmx.net>
Change-Id: I6100d6ace31b2e8d41a95f0b5d5ebf8f1fd88b44
DistanceField technique was not intended for rendering very large glyph.
In some case need the qEnvironmentVariable.
Change-Id: Ied11ed00f0c67bae3c92155e17721d8d2f224cca
Task-number: QTBUG-51714
Reviewed-by: Aram So <aram.so@lge.com>
Reviewed-by: Yoann Lopes <yoann.lopes@theqtcompany.com>
The glyph for the ellipsis could be absent in the main font, so we should
try to find it in a fallback font; otherwise fall back to "...".
Change-Id: Ic53060ed42f3c800aba055d2be2a1c7c3cfeec64
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>
Reported by UBSan:
src/gui/text/qfontengine_ft.cpp:1079:54: runtime error: null pointer passed as argument 1, which is declared to never be null
The default-constructed QScopedArrayPointer is not
reset() in every code path. In fact, in the code
path leading to this memset, the only reset() call
is in the if block right above it, so move the
memset into the if block.
Change-Id: I1f793c313ca56f3315c6bdd55456cb025cafc089
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Wrap the pairs of (void *ptr, void (*dtor)(void*)) in essentially
a std::unique_ptr. This simplifies code and provides the correct
implicit destruction, so we can drop the explicit glyph-cache
clear()ing in ~QFontEngine(), leaving that job to ~QLinkedList.
A subsequent change will turn the QLinkedList into a C array, the
clearing of which would otherwise cause excessive code bloat.
Since we can't use std::unique_ptr, yet, provide a hand-rolled
replacement for now, marking it for replacement with unique_ptr
once we can use it. Make that a local type instead of providing
a Qt-wide unique_ptr so we don't accidentally lock ourselves into
a half-baked std clone we can't get rid of anymore.
To prepare unique_ptr use with the same type-erased deleter
(function pointer) as now, replace a nullptr destroy_function
with a no-op function, so ~unique_ptr doesn't crash when we
port to it later.
Because QFreetypeFace contains the same construct and shares
payloads with QFontEngine, use the Holder there, too.
Even saves 150b in text size on optimized GCC 5.3 AMD64 builds.
Change-Id: I5ca11a3e6e1ff9e06199124403d96e1b280f3eb2
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
The printf-style version of QDebug expands to a lot less code than the
std::ostream-style version. Of course, you pay in type safety (but
compilers warn about it these days), you cannot stream complex Qt
types and streaming QStrings is awkward, but in many cases you
actually improve on readability.
But the main reason is that something that's not supposed to be
executed under normal operation has no business bloating executable
code size.
This is not an attempt at converting all qWarnings() to printf-style,
only the low-hanging fruit.
In this first part, replace
qWarning() << "...";
with
qWarning("...");
In QTransform shared warning strings.
Saves 3KiB in text size on optimized GCC 5.3 AMD64 builds.
Change-Id: I142a8020eaab043d78465178192f2c8c6d1cc4f9
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
Reviewed-by: Kai Koehne <kai.koehne@theqtcompany.com>
These are already held in QVectors.
Public API types need to wait until Qt 6, for BC reasons. Even
though Q_RELOCATABLE_TYPE deals with most of them, we lack a way
to mark a type as primitive, but still isStatic - for QList.
Change-Id: I91392b01ae6f94cc847007636e12d4e64c43b2bc
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@theqtcompany.com>
If a user selected the text "foo" and typed "bar", upon pressing undo,
the text would change to "b". This is incorrect and does not match the
functionality of QLineEdit or the default behaviours of Windows/OSX/Ubuntu.
This was fixed by a change made to always merge two sequential inserts
if they are not part of the same block. Previously the selection delete
and the "b" were part of one edit block and "ar" was part of another.
With this change, the selection delete and "bar" are part of the same
edit block.
Unit test changes are part of a separate review (Part #1) since they
required changes in qtdeclarative.
[ChangeLog][QtGui][Important Behavior Changes] Fixed QTextEdit to match
undo functionality of QLineEdit to group two sequential inserts into one
undo action.
Task-number: QTBUG-38825
Change-Id: I76bf30e331e3526277c3e0ade58cf95b611fc117
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>
This is what std::vector implementations usually do,
because it minimizes memory fragmentation and useless
allocations since no user will call clear() unless
she intends to append new data afterwards.
Fix calls to resize(0) that show how existing code
tried to work around the issue.
Adjust test. Port from QVERIFY(==) to QCOMPARE as a
drive-by.
[ChangeLog][QtCore][QVector] clear() now preserves
capacity. To shed capacity, call squeeze() or swap
with a default-constructed QVector object, see the
documentation for an example.
Change-Id: I9cebe611a97e027a89e821e64408a4741b31f1f6
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
This is a partial revert of fef629cd91.
When doing the original fix, I didn't realize that there was a
mechanism for disabling specific OpenType features in Harfbuzz.
This commit reverts the hack to disable GSUB completely and disables
the ligature features instead.
Task-number: QTBUG-44393
Change-Id: I30f0080eb3897f37219df7f2d50843f3a4556e13
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
gui/text/qfontengine_ft.cpp(1743,5) : warning: variable 'bytesPerLine' is used uninitialized whenever switch default is taken [-Wsometimes-uninitialized]
gui/text/qfontengine_ft.cpp(1743,5) : warning: variable 'format' is used uninitialized whenever switch default is taken [-Wsometimes-uninitialized]
The default branch is marked Q_UNREACHABLE, but apparently Clang does
not recognize it.
Task-number: QTBUG-50804
Change-Id: Idfce8cb2b9a481dd67a18d9952b920ad4f71e0f4
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
The enabler for finding selection ranges in Qt Quick had two bugs
which caused some selected text to disappear. Specifically, this
was the case for selected text where a line contained both an
explicit break and a break due to line wrapping.
First of all, the glyphsEnd that is passed into glyphRunsWithInfo()
is expected to be inclusive, since we are actually searching for
its index in the log cluster array. We would in certain cases
not find the glyph at all in the log clusters, thus the glyph
run would be set to overlap with any glyph run coming after it
in the same item.
Second of all, we need to start searching at the correct position
in the log clusters when searching for the correct rangeStart,
since rangeStart is initialized with textPosition. Otherwise, we
would in some cases never reach the start of the range, and
rangeStart would be set to textPosition + textLength, which is the
end of the range.
Task-number: QTBUG-49596
Change-Id: I436ba3f1c7414d4f5044d9b70aa04c60b01755e4
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
For writing systems where glyph substitutions are purely
cosmetic, we should disable them when letter spacing is set,
otherwise we get ligatures where the spacing is not applied.
To avoid changing Harfbuzz-NG upstream, we detect this
case when fetching the GSUB table and return an empty
blob instead.
Task-number: QTBUG-44393
Change-Id: Ie5f6b2d795d7fecbba0ece3941fb70ba7f04c395
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
This also reverts commit 018e670a26.
The change was introduced in 5.6. After the refactoring, 14960f52,
in 5.7 branch and a merge, it is not needed any more.
Conflicts:
.qmake.conf
src/corelib/io/qstandardpaths_mac.mm
src/corelib/tools/qsharedpointer_impl.h
tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp
Change-Id: If4fdff0ebf2b9b5df9f9db93ea0022d5ee3da2a4
Prevent potential detaching by using constBits()/constScanLine() instead
of bits()/scanLine().
Change-Id: If03f8d4d3b8ed4c07aed5eff7f580e57ca771919
Reviewed-by: Gunnar Sletta <gunnar@sletta.org>
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
QFlags::setFlag is most useful to replace explicit constructs like
if (condition) {
someFlags |= TheConditionFlag;
} else {
someFlags &= ~TheConditionFlag;
}
with
someFlags.setFlag(TheConditionFlag, condition);
Change-Id: Ie4586681c83e0af812d5bbf14965aad51941a960
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
The user-defined copy assignment and copy constructors
inhibit the move special member functions.
We cannot do something about it in Qt 5, because the
class is exported (which it shouldn't be), and because
making it trivially-copyable might change how it is
passed to functions by value, so we need to supply all
the missing member functions manually.
Change-Id: Ic710b449f6abd386449fa6df71e8bc9bd0f98d2b
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
... by replacing them with C++11 range-for loops.
The function QObject::children() returns by const-reference,
so they can be passed to range-for without further changes.
Change-Id: I8cd2921165c45020914dd3a23b1f18b519fe7900
Reviewed-by: Gunnar Sletta <gunnar@sletta.org>
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
... by replacing them with C++11 range-for loops.
To avoid detaches of these mutable Qt containers,
wrap the container in qAsConst().
Change-Id: I90fd517ad542ef92034403c15ebb8300a56ac693
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
Reviewed-by: Gunnar Sletta <gunnar@sletta.org>
Q_FOREACH over a QVarLengthArray is a partcularly
bad idea.
Use C++11 range-for (without qAsConst(), because
QVLA isn't CoW).
Change-Id: I5ee55557577f183151d3871e4518382c4adf0237
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Reviewed-by: Gunnar Sletta <gunnar@sletta.org>
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
Labels would use a statically defined font for <pre> blocks.
Use the one defined by the QPlatformTheme instead, through
QFontDatabase::systemFont(FixedFont)
Task-number: QTBUG-50564
Change-Id: I5491bd0defce651bdf809bcbc6a529a900f4959b
Reviewed-by: Milian Wolff <milian.wolff@kdab.com>
When getting the glyph runs from a QTextLayout with multiple
lines, the glyph runs would be merged if possible, but not their
bounding rects. This was an oversight.
[ChangeLog][Text][QTextLayout] QTextLayout::glyphRuns() now returns
united bounding rects for glyph runs that are merged.
Change-Id: Ibbeaa99ecfc4e82e7965342efdae7c3c2b637343
Task-number: QTBUG-50715
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
Parse the requested family before we're looking/saving into the cache,
thus hitting the cached EngineData for:
* quoted family names (eg. QFont("'Arial'"))
* non-simplified family names (eg. QFont(" Arial "))
* substituted family names (\sa QFont::insertSubstitution())
* explicit fallback list, where possible (eg. QFont("Tahoma, Arial"))
This also improves the cache hitting for the font engines in some cases.
Change-Id: I18cdc3e8d669cccec961f84e9b27329402e2b7ed
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>
This partially reverts the source and binary incompatible parts of change
d921a9bd15 that made public members in an
exported class private and changed signature in one case.
Task-number: QTBUG-50703
Change-Id: I2719f276256206347d3c27d80a16db34a4ea2888
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
We depend on the assumption QFontCache::findEngine(key) for key.multi=1
returns a font engine of type QFontEngine::Multi;
guarantee that by checking it in a single place.
Change-Id: I287da4fd62deb22fc5520cde5b0505bc44547609
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>
The QFontCache instance is stored in QThreadStorage and thus calling
QFontCache::instance() isn't really cheap; avoid calling it multiple
times where possible.
Change-Id: I1b7a83089698a06c49dac08b2a3a8e9c3c75a500
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>
For non-scalable fonts, the units_per_EM in FreeType is
documented to be undefined and will default to 0, which means
that any division by it will cause an exception.
The emSquareSize() function already checks if the font is scalable
and returns y_ppem if not, so lets use it instead in all locations
where we're not already sure the font is scalable.
[ChangeLog][Text][Freetype] Fixed a divide-by-zero exception
when accessing bitmap fonts.
Change-Id: I8839d4c83047fb3f6bb4d69af0258e94a258a4d9
Task-number: QTBUG-45963
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Makes it clear that the engine for font with no Latin WS support
won't be cached as "shared" engine and thus shouldn't be normally
expected in the cache, so don't even try to find it there.
Change-Id: I9e6275b4919607f4057a193b446825c98932bd23
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>
by inlining and reordering the condition.
Change-Id: I68a91e75071975a4cc26333094db3433afbaeb72
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>
Both constructors were taking a pointer, so they participated in
overload resolution along with QTextDocument and QTextFrame pointers.
Instead, make them take references and move them to the private section
of QTextCursor. That necessitated adding a method to QTextCursorPrivate
to access that private constructor from non-friend classes.
Change-Id: I7e6338336dd6468ead24ffff1410e3bc534d77dd
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
When called from outside of qfontdatabase, the qfontdatabase mutex will
not be locked upon entry to qt_fallbacksForFamily, so we need to add
it to the exported version.
Change-Id: I16a21708d7cca15730c12de3dbeeaab13ffbd315
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>
From Qt 5.7 -> LGPL v2.1 isn't an option anymore, see
http://blog.qt.io/blog/2016/01/13/new-agreement-with-the-kde-free-qt-foundation/
Updated license headers to use new LGPL header instead of LGPL21 one
(in those files which will be under LGPL v3)
Change-Id: I046ec3e47b1876cd7b4b0353a576b352e3a946d9
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
... so we can drop the user-defined copy special member
functions and the destructor.
As a side-effect, enables the move special member functions,
which were previously inhibited by the presence of the
now-removed functions, and makes the copy constructor safe
for self-assignment.
Change-Id: I430f83a6a08b1f5ee94b52f52e4d80fa1139d1c1
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
... instead of using erase in a loop, with quadratic complexity.
Change-Id: If30c6c99a775aec07eef9ddf953e944dc916b5a2
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Drive-by changes:
- use auto for iterators
- add Q_UNLIKELY for conditions leading to a qWarning etc
Change-Id: Iff8f36d67c96674d354a501b26640f73c15ce58d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Sérgio Martins <iamsergio@gmail.com>
When increaseCost() is called then it will convert from bytes to kilobytes
so we need to specify the cache_cost to be in bytes.
Task-number: QTBUG-47812
Change-Id: I842514c9ab4d86b60b2beb6c80979156ea0de59c
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>
It was possible for the cache to increase too quickly since it was
relying on the timer to decrease which caused problems with FreeType.
So by checking if it will be increased to be over the limit first before
adding the new font, we can decrease it earlier in preparation.
Task-number: QTBUG-47812
Task-number: QTBUG-49535
Change-Id: Iedc042d8903949140aa8c5257a9d54cde31a51be
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>
The GHS toolchain needs names for enumerations that are used for
template instantiation.
Change-Id: I4e184cd77074fd7ece89f21317536e6006ab257d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Due to kerning and other OpenType features, it's possible
that the advances from the shaping process are fractional, but
this gives uneven glyph positioning for font engines that don't
support subpixel positioning (since the glyph will not match the
expected position, some gaps will look too large and some
too small). To match how e.g. GDI renders this, we round the
advances before setting the glyph positions for engines that
do not support subpixel positions.
[ChangeLog][Windows] Fixed uneven kerning for some fonts.
Task-number: QTBUG-48546
Change-Id: Ic00dc402abf7149aab6bf9b05b42827b805c1a15
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Hyperlink added in QTextDocument becomes "<span>" tag after exporting
the document to ODF with QTextDocumentWriter. Fixed by adding "<a>" tag
around it with attribute "href" pointing to hyperlink location.
Task-number: QTBUG-48853
Change-Id: I2bd689a88c9d0a5b14369777718b9cb36e4cfa19
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
If, after checking a condition, we issue a qFatal()
or a qCritical(), by definition that check is
unlikely to be true.
Tell the compiler so it can move the error handling
code out of the normal code path to increase the
effective icache size.
Moved conditional code around where possible so that
we could always use Q_UNLIKELY, instead of having to
revert to Q_LIKELY here and there.
In some cases, simplified the expressions newly wrapped
in Q_UNLIKELY as a drive-by.
Change-Id: I67537d62b04bc6977d69254690c5ebbdf98bfd6d
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Detected with a modified (deep const propagating) shared data pointer.
Most are fixed by using copy constructor and assignment operator
of the shared pointer instead of feeding it .data(). The rest
required adding const locally.
Change-Id: I51e36b9e7040dc2211ef4c5dadfbda73ad22c414
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
0e99f3c broke tst_qquicktextinput::horizontalAlignment_RightToLeft()
and tst_qquicktextedit::hAlign_RightToLeft(). This fix was proposed
by Konstantin.
Change-Id: I602b7301d415f266224ae2c1ffd81244e9565862
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
Since the item positions are guaranteed to grow, we could safely re-use
the obtained first item while looking for the last item in the chain.
Change-Id: I5e42f5de820c62a51a109a4b227b031c697aa898
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
The documentation already states we're doing this, so stop lying
and implement it properly :)
Change-Id: Ic78980d76f61e8aa64e59ea058a8105d9c507774
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
Insert a section symbol (U+00A7) to the end of a text flow instead of a
space as many text layout applications do.
Task-number: QTBUG-49252
Change-Id: Ib1276b508c24824b6329e0458ae5171bc1a288c3
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>
Avoids in-loop check for every pixel by costs of slightly bigger code.
Change-Id: I8321d0945ac6b677786431670b2316c60e4db492
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
Use an optimized version of the intra-pixel filter found
in FreeType's _ft_lcd_filter_legacy().
Gives us somewhat better accuracy and better performance.
Change-Id: Id4200b67e6ff55f605037c3e5464fef8bb03fbde
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>
In change 8f6b328410 we override
the fontDef of the fallback font with the fontDef of the
original font (with the family name replaced) to fix a
regression where boldness was not inherited by the fallback
font.
This caused a bug, though, since the contents of the fontDef
would now misrepresent the actual font used. The side effect
of this was that isSmoothlyScalable() returned false because
the family and styleName combination we claim to have did
not exist in the font database. Result: We fell back to
native rendering for the font even though it's scalable.
Weight and style are the only parts that should be inherited,
since they are synthesized. So rather than overwriting
the fontDef completely, we copy the weight and style when
needed.
The bug in QTBUG-42963 is still fixed after this change.
[ChangeLog][Text] Fixed problem where fallback fonts for text
with certain styles would be reported as unscalable.
Change-Id: I95ef67f818852aea5a6ae8df789a52364ecb59a6
Task-number: QTBUG-47547
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Precalculate everything we can and use faster loop.
Make inlined as it is used just in a single place.
Change-Id: If3c33d60739eb4ce896020321442ae81edd1c13d
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
These tricks has no meaning to other font engines (i.e. to FreeType).
Change-Id: I0410693d4d159367d760433062506691dc7c4610
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
This fixes-up bf013c9e74 by specifying
graphite2 shaper in a "safe" shaper list, one used for non-CoreText
font engines (currently, FreeType font engine only).
Make the the comment and the code a bit cleaner about the fallback
shaper list.
Change-Id: Ib0cedc0b593023c9ee771e8e98c314d9c8f13037
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
QTextImageHandler needs it.
And QQuickImageBase will also need it.
Change-Id: Ica5d17519c4c6c06e25bab7d2b1d3733f4058425
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@theqtcompany.com>
* Georgian lari currency symbol
* A large collection of CJK unified ideographs
* Emoji symbols and symbol modifiers
* Letters to support the Ik language in Uganda, Kulango in
the Côte d’Ivoire, and other languages of Africa
* A set of lowercase Cherokee syllables, forming case pairs
with the existing Cherokee characters
* The Ahom script for support of the Tai Ahom language in India
* Arabic letters to support Arwi—the Tamil language written in the Arabic script
For more details, see http://www.unicode.org/versions/Unicode8.0.0/
[ChangeLog][QtCore] Unicode data updated to v.8.0
Change-Id: If255f95c9c45655b721369a116299da3cabbba0a
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
Back in the old days, we would pad the output from the font engines
to work around problems with the GL1 paint engine such as issues
with linear sampling, etc. This is no longer needed. Padding is
moved into the glyph cache, and in addition to reducing performance,
the extra padding is also making alphaMapForGlyph() and
alphaMapBoundingBox() fall out of sync when you fall back to
QPainterPath drawing the glyph. The result of this was that,
when prepared, the glyph cache was sometimes not made large enough
to hold what alphaMapForGlyph() actually produced, depending on
the size and order of glyphs, and glyphs ending up at the end of rows
would sometimes be missing from the output.
[ChangeLog][Text] Fixed some instances of missing glyphs when
drawing large fonts.
Change-Id: Ia5982392fe1637f6ebc740db9f226fbb91f75166
Task-number: QTBUG-47547
Reviewed-by: Gunnar Sletta <gunnar@sletta.org>
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Truetype fonts should be rasterized with a winding fill
as documented in e.g. Microsoft's specs.
Failing to do this caused a bug when doing native
rendering in Qt Quick for fonts that were large enough
that the fallback path was taken when drawing the glyphs
into the cache. If the glyph had overlapping contours,
they would be subtracted from the shape.
[ChangeLog][Text] Fixed an uncommon rendering error with
fonts containing overlapping contours.
Task-number: QTBUG-41197
Change-Id: I0e4a4432ba3f902bc3ea59d8f4dbd12a295630b2
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Implement as generic "@Nx" support in an exported
qt_findAtNxFile function.
3x devices now get one extra file existence test
in cases where @3x versions are not present. 1x
devices are still on the fast path where there are
no extra file system accesses.
Add an @3x image to the highdpi manual test.
Change-Id: I4ce3fc245ada01ea410abe1443ceb1e3abf7c17f
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@theqtcompany.com>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@theqtcompany.com>
Mark include directives in qevent.h for removal and preemptively
add missing headers in code base.
Change-Id: I81011d7bfad4a09d80deeda6d1bed67b5c0e63c2
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
'none' is a valid value specified in CSS standard. In combination
with '-qt-list-indent: 0' it allows for using lists in Qt for better
structuring text
Change-Id: I1dd324a3ea81b26e21a9d4d9f93ef9b5edcf3e93
Task-number: QTBUG-6501
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
This table has values precomputed based on every single glyph in
the font, not just the subset we use as a fallback, which should
improve both performance and correctness.
The fallback codepath of computing the minimum values based on a
subset of the characters in the font is left in, as we still need
that for bitmap fonts, and some font tables that have invalid
values.
Change-Id: I71aac1e09c9f9de80446b023ba15a9e2afe7d226
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>
By serializing the capitalization value of QFont, it ensures that it is
correctly preserved when QPicture streams it and later plays it back.
Subsequently the QDataStream version has been bumped up to account for the
change of the data format for serializing QFont.
[ChangeLog][QtGui][QFont] QFont now serializes the capitalization setting.
[ChangeLog][Important Behavior Changes] QDataStream version bumped up to
17 to account for changes in the serialization of QFont.
Task-number: QTBUG-15214
Change-Id: I042680760e5a69d18d41e786b7500a3eebbe562f
Reviewed-by: Mitch Curtis <mitch.curtis@theqtcompany.com>
qtbase/src/gui/text/qzip.cpp:797:warn:Cannot find 'FileInfo::d' specified with '\variable' in any header file
qtbase/src/opengl/doc/src/qtopengl-index.qdoc:28:warn:Can't link to 'Qt Gui'
qtbase/src/opengl/doc/src/qtopengl-module.qdoc:28:warn:Can't link to 'Qt Gui'
qtbase/src/widgets/widgets/qcombobox.cpp:3033:warn:Cannot find base function for '\reimp' in showPopupFromMouseEvent()
qtbase/src/corelib/plugin/quuid.cpp:849: warning: Can't link to 'variant()'
qtbase/src/corelib/plugin/quuid.cpp:863: warning: Can't link to 'variant()'
qtbase/src/widgets/dialogs/qsidebar.cpp:72: warning: Cannot find base function for '\reimp' in mimeTypes()
qtbase/src/widgets/dialogs/qsidebar.cpp:80: warning: Cannot find base function for '\reimp' in flags()
qtbase/src/widgets/dialogs/qsidebar.cpp:98: warning: Cannot find base function for '\reimp' in mimeData()
qtbase/src/widgets/dialogs/qsidebar.cpp:134: warning: Cannot find base function for '\reimp' in dropMimeData()
qtbase/src/widgets/dialogs/qsidebar.cpp:151: warning: Cannot find base function for '\reimp' in setData()
Change-Id: I39d6494eb8179f0f7532f99458736fa5e30cdc25
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@theqtcompany.com>
The logic used in the FreeType font engine can be generalized
and move to the QFontEngine baseclass. This allows the CoreText
font engine to correctly report the minimum left/right bearings,
which decreases the chance that an optimization in QTextLayout's
line breaking algorithm will produce wrong results.
The calculation of left and right bearing has been moved to the
glyph_metrics_t type to reduce code duplication. This allows us
to use the with and height of the bounding box to determine if
the glyph has any contours.
Change-Id: I864697d3f31ed56f22f04666199b6c5023c5e585
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>
Preparation for also using it from QCoreTextFontDatabase.
Change-Id: I9cbef59c21f343a88a5cb3fdbee1ed4791d7a36e
Reviewed-by: Morten Johan Sørvig <morten.sorvig@theqtcompany.com>
This permits text rendering consistent with other FreeType enabled platforms,
like Windows and Linux.
Task-number: QTBUG-42839
Change-Id: I8c99bcaa3fb07c16e935a0c3705af467bc3da584
Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
- Helper functions in LineBreakHelper have been renamed from
adjustFoo to calculateFoo, to signal that they do work, and
are not adjusting something relative to something else.
- The use of QFixed(1) and >= 0 has been replaced with an explicit
constant for the case of the bearing not being calculated yet.
- A helper function negativeRightBearing() has been added that
returns the absolute value of any negative right bearing, making
the width computations simpler.
- Comments have been added and rewritten to make the logic clearer.
Change-Id: I1d3a0214cfa8b4fed4551f3444b43a37d55bd69b
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@theqtcompany.com>
Build it only in -developer-build mode for tests that might depend
on exact-matching font behavior.
Return earlier to avoid doing any useless job.
Change-Id: I966ee5689f03403e45f4c957b63e3113f0467803
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>
...mainly for platforms that do not provide a native/unified way
to obtain system-defined font fallbacks list
(ie !CoreText && !FontConfig).
Change-Id: I23c5589d79ddecb6311ccc52ec8b29977f06d408
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>
Use the same trick the WebKit related path has used for years:
if there is no explicit list that takes a precedence over the
default one (i.e. QFont("Arial,SimHei")), then defer the fallback
families list initialization until it gets requested.
Change-Id: If5a74294bdebb24865c619bc0d7328b3e706de76
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>
Work around QPaintDevice::metric's int return type
by adding a new metric that returns a scaled devicePixelRatio.
Choose a scale factor that gives us more than enough
range.
The QPaintDevice::devicePixelRatio() convenience accessor
is public API and can unfortunately not be changed
to return a qreal. Add devicePixelRatioF() which
returns the (unscaled) devicePixelRatio.
Change all call sites of QPaintDevice::devicePixelRatio()
to use QPainDevice::devicePixelRatioF().
Task-number: QTBUG-46615
Change-Id: I97ec4000fe379b7ff5e1624a871ae2512790aad9
Reviewed-by: Paul Olav Tvete <paul.tvete@theqtcompany.com>
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
There were two problems:
1. qHash() hashed FaceId::uuid, but op== didn't use it for
determining equality. Thus, x == y => qHash(x) == qHash(y)
might be broken if fileName and uuid have an orthogonal
component, if you excuse my vector analogy.
2. To hash fileName and uuid, it concatenated the two,
causing a temporary QByteArray to be created just for
hashing its contents. That prevented marking qHash()
as nothrow.
Fix by using new QtPrivate::QHashCombine and adding
uuid to the list of fields compared in op==.
Change-Id: I49f2379d514d6d3669929e737562cf6de823127e
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>
QTextDocument::find has a behavior that is different from the typical
QRegExp/QRegularExpression behavior where finding a given expression is
always constrained by the paragraph (block), regardless of newline
characters in the expression.
Task-number: QTBUG-21785
Change-Id: Ia6a061c6feb5a19e6b8caa3d8009da5ca31ec422
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
... except if the function is a ctor, callers pass rvalues,
and the type has a fast move ctor. In that case, keep passing
by-value and qMove() into place.
Change-Id: I2c0be7d4436327834ddee0531c51c5af352ac74c
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Makes for much more readable callers, and, d/t NRVO, isn't less efficient
than the old code, either. Transparently enables moves when QVector should
get them, at some point, too.
Change-Id: I77327cf665272b80277deaaa6dd2ee9c00806464
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
FileInfo is larger than a void*, so holding them in a QList is needlessly
inefficient. Worse, the code could come to depend on the fragile property
of (inefficient) QLists that references to elements therein never are
invalidated.
Change-Id: I772177c5ac544a5fecce2368f628148308ef260f
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
- don't define special member functions if the compiler-generated
ones are just fine (inhibits move semantics)
- implement all remaining methods inline
- unexport
- remove unused (and, to add insult to injury, never init'ed)
d-pointer. This is private API. No need for a d-pointer,
much less an unused one.
Change-Id: I6979cb5103a361c0313c252d3bf7073a3c47addd
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
These all invoke the QFlags<>(Zero *) ctor, which is designed to
accept a 0, but no other int. But in doing so, it requires passing
a nullptr literal, and 0 is not a nullptr literal accepted under
-Wzero-as-null-pointer-constant or similar warnings.
Fix by using the QFlags::QFlags() ctor instead.
Task-number: QTBUG-45291
Change-Id: I73f9c9f4de11eeb1ba04ace6c7121d17510ea29f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This is in preparation of adding -Wzero-as-null-pointer-constant (or similar)
to the headers check.
Task-number: QTBUG-45291
Change-Id: I72ab40b21a9499b53a639564fa45884de17b6c98
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
First, all values in the array fit into 8-bit, so change the type
from ushort to quint8.
Then, instead of appending a zero as end marker, statically
determine the size of the array and use that number.
Also fixes (benign) off-by-one error in the existing reserve()
call.
Change-Id: Id05b6a56b55d2e0769b00496a55808bb7351b084
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
ItemDecoration is larger than a void*, so holding it in QLists
is needlessly inefficient. Worse, the code could come to depend
on the fragile property of (inefficient) QLists that references
to elements therein never are invalidated.
Fix by marking the type movable and holding in QVector instead.
Change-Id: I06d7a77529f7cff2ba503c5e8d6e5df0ad801a21
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
All values in the table fit into 8 bits, so don't use a
16-bit type.
Change-Id: I685727e16a264a49ea501d36eb6815c6d5aaa9b2
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Specifically when reading files with broken cmap tables, we could
get some undeterministic results. We handle this more gracefully
by verifying that the offsets are sane and bailing out early if not.
This replaces the current pattern throughout the font engine for
consistency.
Change-Id: I507bba49c0be634afca77d1eb3d199a427451bee
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Found by ICC:
qtextengine.cpp(1259): error: more than one instance of constructor "QFixed::QFixed" matches the argument list:
function "QFixed::QFixed(int)"
function "QFixed::QFixed(long)"
function "QFixed::QFixed(qreal={double})"
argument types are: (uint)
QFixed stretch = QFixed(actualFontEngine->fontDef.stretch) / QFixed(100);
^
Change-Id: I790fb4cae1abc692705253a7863291bc8743b832
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: Jake Petroules <jake.petroules@petroules.com>
Fixed a few qdoc error messages caused by errors in qmetatype.cpp and
qtextlayout.cpp and qtestcase.cpp and qpointer.cpp
Change-Id: I662aa25bedba057e125e289c34787e81793941ff
Task-number: QTBUG-46939
Reviewed-by: Martin Smith <martin.smith@digia.com>
This is a separate commit to allow other modules to do the transition
before this may vanish or cause a warning.
Change-Id: I556837bf0d2c667f067f4e1fa7918bd1a3f55025
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
Excepting QBitmap and the QTextFormat heirarchy, which don't
have 100% value semantics (still pondering them).
In QPolygon(F), adding the move assignment operator disables
the implicitly-defined copy assignment operator, which therefore
have to be made user-defined. That doesn't change the ABI of
the class, since the base class QVector already had a user-defined
copy assignment operator.
Change-Id: I0b111c1d21cf47f559ada6357c982e3dc26aca68
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Guarantee the values are exactly the same on all platforms
and avoid the macro redefinition(s) on a newer MinGW.
This also fixes a typo in #define S_IFLNK 020000 (<-- must be 0120000).
Change-Id: I4993d2a9bdb4b0871af110b89c137ce0ac0e953a
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
This is used by the scene graph to automatically switch over from distance
field text to native text rendering for the given glyph node, which allows
mixing regular text with Emoji in e.g. a Text item without having to set
renderType to Text.NativeRendering.
Change-Id: I5d96d1dab329a975e3442284bf4c5a82174177c9
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>
It was obsoleted for quite a while already and we forgot to get rid
of it the last time.
Change-Id: Ib15e71829e80648aa667a6b0af31698460b99cc1
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
... even if they are not (currently) held in Qt containers
(though FileInfo is).
Change-Id: Id14d4af89fed8bcefdbb9b28d11c1c43fccf7190
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
QPointer is larger than a void*, so holding them in a QList is needlessly
inefficient. Worse, the code could come to depend on the fragile property
of (inefficient) QLists that references to elements therein never are
invalidated.
Change-Id: I104d11cc530c9c1579e82bf4e28e3353c00b34b4
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Virtually all of these types are too large to fit into a QList.
Change-Id: If55496ef3fb26d6531e9ef1bb1558887d9077a3b
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
Looping over QList::contains() constitutes O(N²) behavior,
the more so as this QList is horribly inefficient since
WritingSystem is not a Q_MOVABLE_TYPE.
Since the range of possible unique values in the result
is severly limited (by virtue of being enumerated values),
use a bitmask to remember which WritingSystems were
encountered, then, after releaseing the mutex again, use
that bitmask to populate the QList.
Change-Id: I1d12eb487513ec17faa6f38942f8b681819dc0e8
Reviewed-by: Adam Majer <adamm@zombino.com>
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
When a font style-name is not directly available from the font we
need to generate it with the data we have, so we should include all
the new supported weights.
Change-Id: I45cc0114f8c76f45bc7a639f9d0d8096a064bc51
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: René J.V. Bertin <rjvbertin@gmail.com>
Reviewed-by: Pierre Rossi <pierre.rossi@theqtcompany.com>
This qdoc command is deprecated.
Task-number: QTBUG-46476
Change-Id: Iee36f91bdcf500c2e88022a5f8a9c3accc6048c2
Reviewed-by: Martin Smith <martin.smith@digia.com>
Since we added font matching by style name, the style name is not just
a derived property and should not be ignored in comparisons.
The QFontDef::exactMatch comparison is left unchanged, since it tests
if a loaded font matches a requested one.
Task-number: QTBUG-30851
Change-Id: I4187c5b993815001f35bcf24dc449059bfdcba6f
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>
By making the destructor (usually the first non-inline, non-pure,
virtual function, and therefore the trigger for most compilers to
emit the vtable and type_info structures for the class in that TU)
out-of-line, vtables and, more importantly, type_info structures for
the class are pinned to a single TU. This prevents false negative
dynamic_cast and catch evaluation.
In this second and last batch, we de-inline destructors of exported
public classes.
Since they are already exported, users of these classes are unaffected
by the change, but since it's public API, and the dtors may have been
de-virtualized and inlined into application code, we need to avoid
adding code to the out-of-line destructor until Qt 6.
Change-Id: Ieda9553cb4b0dae7217c37cc7cde321dd7302122
Reported-by: Volker Krause <volker.krause@kdab.com>
Task-number: QTBUG-45582
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
De-duplicates vtables and enables RTTI on this class
hierarchy.
Export, as QOpenGLStaticTextUserData (QtOpenGL) inherits it.
Change-Id: I0662870538c35f23baf6bde4594ec8b9055efae7
Reported-by: Volker Krause <volker.krause@kdab.com>
Task-number: QTBUG-45582
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
It should also be possible to use QT_STRICT_ITERATORS in Qt's own code base
Change-Id: I0914db480d4d2b06e71e3a2588163efdd3ff6d27
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
De-duplicates vtables and enables RTTI on this class
hierarchy.
Export, as QPlainTextDocumentLayoutPrivate (QtWidgets)
inherits it.
Change-Id: I8aee43b43898a72430d8bc1247ea76c7d4e9031d
Reported-by: Volker Krause <volker.krause@kdab.com>
Task-number: QTBUG-45582
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
Change-Id: Ia825ef6d932fbd45ceaf8c54a3207f207fa40994
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
QTextLayout::additionalFormats setters and getters using QList<FormatRange> have
been deprecated; port to the QVector versions.
Moved op== definition for FormatRange needed in tst_qsyntaxhighlighter.cpp
to a friend declaration in FormatRange itself, because MSVC 2008 doesn't find
it otherwise.
Change-Id: Ibab6589df057f02377d895079b56395859e3401e
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
The QTextLayout::FormatRange is larger than void* and thus should not be held in
QList. Use a QVector instead.
Other parts of Qt already hold FormatRanges in QVectors, so this also makes
handling FormatRanges more consistent.
To avoid ugly names for the getter which doesn't overload on return type alone),
rename the set of function to format (from additionalFormats).
[ChangeLog][QtGui][QTextLayout] Added QVector-based alternatives setFormat(),
format(), and clearFormat() to setAdditionalFormats(), additionalFormats(),
and clearAdditionalFormats(), resp.
Change-Id: Ie04a561b43c91c3b2befb3cac2981821f84d5f77
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
The destructor is the first virtual method. By not defining it
out-of-line, we provoke multiple copies of vtables, not all of
which can be merged by the linker. If the linker fails, RTTI
such as dynamic_cast and catch-blocks involving the type will
not work.
Additionally, QFontEngineGlyphCache was not exported, and
therefore also not its vtable, making it impossible for
users outside of QtGui to get a unique RTTI for the class.
Change-Id: Ib265945934216bb609629431eb4c71996d4fd39d
Reported-by: Volker Krause <volker.krause@kdab.com>
Task-number: QTBUG-45582
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>
A style name 'Extra Thin' or 'Thin Italic' should be parsed as Thin
font weight.
Change-Id: I8acebed7330c23231b3742d887081d8b3d0aeb19
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
The cached list didn't take fontStyle, styleHint and script into account.
As long as QFontCache isn't explicitly disabled, loadEngine() rarely
called for the same family, foundry, style and size - so avoid caching
anything here at all.
Change-Id: I7779bf33fc074edc00799f9a39d67327f8c88ccc
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
QFontDatabase::load() is the only caller that passes non-null
QFontPrivate* to QFontDatabase::findFont(), to adjust the pointSize
with regards to the font's dpi; do that right in QFontDatabase::load().
The `multi` param's meaning is, in fact, an absence of the
QFont::NoFontMerging flag,
so prefer the latter and prevent ambiguity in the future.
Change-Id: Icc7751044e454ca438e7627364faa415287bf1ae
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>
The logic this code was aimed for has been covered by a more complete
solution in QFontDatabase::load() years ago; simply drop the dead code.
Change-Id: Id8860353ff4f4d2f1529aa89810d6c5725e97d24
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>
Moves some of them to the .rodata section, the rest at least to
.data.rel.ro[.local].
Change-Id: I85676ddf22b0c0097f3f0dce4c3dc018dc29d045
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Add the noexcept attribute to all move constructors and assignment
operators in QtGui that didn't already have it.
Change-Id: Idcdf79ae8349b8793e7394b5ae7c08e6111fbc9a
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: Gunnar Sletta <gunnar@sletta.org>
It's undefined behavior to left or right-shift a signed integer such
that the sign changes. Since SymbolCsbBit is 31, make sure we use
unsigned numbers.
Found by ICC
qplatformfontdatabase.cpp(614): error #68: integer conversion resulted in a change of sign
Change-Id: Idf715b895bac4d56b4afffff13da78d294b1248e
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
This one has not been unsed for ages (since Qt3?).
Change-Id: Iaf514db1b698b34a303f34c150b72db989eb176c
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
Many times set but never used.
Change-Id: I297f21d4b9878e5f9559a2dfdb2d3de34107bb7d
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
1. Checking if `db->count == 0` inside the
`for (int x = 0; x < db->count; ++x)` loop makes absolutely no sense;
2. The family gets loaded just a line above (ensurePopulated()).
Change-Id: I72dbd42565c4f5a5d9ff8879f10ee0ece7298fa7
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
When resolve_mask is 0, the font inherits just everything, and there is
no need in checking for any resolved attributes;
the resolved font always inherits dpi, so do not check it either.
Change-Id: Ie5d7ced0859d46a9237447e29051a22569480a51
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
To avoid source-incompatibilites, wrap in QT_DEPRECATED_SINCE(5, 5)
in public headers.
Change-Id: I6117e8a6b11200d2f1a0a94a0e87d5c27538218e
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
To avoid source-incompatibilites, wrap in QT_DEPRECATED_SINCE(5, 5)
in public headers.
Change-Id: Ic3398f4f330e15a3b55065858add26b90fd70e6c
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
In compare to QTextEngine::atSpace(), this also handles the less-common
"white spaces" and the exceptional control codes.
Change-Id: I52878932926b7f9fe36c9dd01007963b9691fbf0
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
"Embedded objects, such as images, are represented by a
Unicode value U+FFFC (OBJECT REPLACEMENT CHARACTER)."
Also updated the QTextImageFormat docs with the same wording.
Task-number: QTBUG-44538
Change-Id: I64dd5f5be4a0ecc64b30758a72f8b4281c17924b
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Use GlyphInfo as a temporary buffer for storing the glyph metrics
and go through the same code for fetchMetricsOnly and !fetchMetricsOnly.
Change-Id: If8bb85056e5f09588cc3956b43dc51a54d5aecfe
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Move some variables initialization closer to the usage context.
Change-Id: I0f1de0ddc9f0fbe3ec4a56455ccc14f9e8d94e5a
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Make it consistent with fetchMetricsOnly path.
Change-Id: I6a2d2568d5579255582217515a4e598722547c60
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
...for both cached and non-cached modes, by disabling hinting
for transformed glyphs in loadGlyphFor().
Change-Id: I13766a653ebd72cbed0f5c38ca3536d042aed762
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Returning dbg.space() breaks formatting on streams that already
have nospace() set.
Change-Id: I55e38b018679a67eb40be6b4664505483a3a7d8e
Reviewed-by: David Faure <david.faure@kdab.com>
As reported by GCC 4.9.2 x86_64-linux-gnu. The error message is correct;
QCss::Property is the name of an enum.
Change-Id: I9fb29d39ac11a644b7b08227f102594b3f3017f0
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: Debao Zhang <hello@debao.me>
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
Reviewed-by: Andy Shaw <andy.shaw@digia.com>
* Two newly adopted currency symbols:
the Azerbaijan manat and the Russia ruble
* Pictographic symbols (including many emoji), geometric symbols,
arrows, and ornaments originating from the Wingdings and Webdings sets
* Twenty-three new lesser-used and historic scripts
extending support for written languages of North America, China, India,
other Asian countries, and Africa
* Letters used in Teuthonista and other transcriptional systems,
and a new notational set, Duployan
For more details, see http://www.unicode.org/versions/Unicode7.0.0/
The Properties struct's .*Diff members were narrowed down
to signed 15 bits and the unicodeVersion has been expanded to 8 bits.
[ChangeLog][QtCore] Unicode data updated to v.7.0
Change-Id: I93ab6f79fa3b05f61abc7279f1d046834c1c1a0b
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Replace it with '-' and set dontPrint to true;
later we unset the dontPrint flag if soft-hyphen appears at the
end of a line after line breaking.
Task-number: QTBUG-44234
Change-Id: I05b69bcbbe07e1ee8a5d35d24372356ce8ab9db8
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>
> Symbol character sets have a special meaning.
> If the symbol bit (31) is set, and the font file contains a 'cmap'
> subtable for platform of 3 and encoding ID of 1,
> then all of the characters in the Unicode range 0xF000 - 0xF0FF
> (inclusive) will be used to enumerate the symbol character set.
If we detected the font has a symbol character set, report no other
writing systems support.
Change-Id: I1030f3339c166ffd03c7caee1b1b26010dfdc314
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.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>
The glyph returned by loadGlyph() must be freed manually when caching
is not enabled, except when it is a placeholder for a missing glyph.
This is a fix-up for d18ccbb5be.
Task-number: QTBUG-32792
Task-number: QTBUG-44812
Change-Id: I410fa1b7703e306739d9dae35fff06af6c79dce0
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
When continuing a previous layout, we would in some cases add a wrong
margin because we would treat the current frame as preceding itself.
Task-number: QTBUG-42269
Change-Id: Idf00fadbed890ce34b073cf670cc9b8e1d4b0d5d
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
In case the loadGlyph() was called for a glyph to fetch metrics only,
loadGlyphFor() never fetches the data for that glyph
but returns a non-null result.
Change-Id: I2b258c4b7880059d41dc02f1e5a43903706d3888
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
and only cache non-scalable glyphs in defaultGlyphSet
if a requested transform is translation.
Change-Id: I49d936736871bd455e573335c014ddefe8bb915e
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
And avoid conversion when the cached FT transform could be used.
Change-Id: I9f6bf0a6c6fa166092de698f3ddbbf203e2b3820
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
QFontEngineMulti expects the fallback families list to be initialized
prior to the first call to engine(int), however in some scenarios,
the initialized and cached engine gets destroyed and re-created later,
with no fallback families list set, which causes an assertion.
Change-Id: I8d19cc91f3a067f6bf77b36bd87010dd967b4c49
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Also track the allocated buffer length and re-use the existing
buffer instead of allocating a smaller one, where possible.
Change-Id: I494519d653522622b1fe4ec80ac9035e2c3d9714
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
It was preventing some functions in the Qt namespace
from being documented and hence auto-links to these
functions failed.
Change-Id: Ie820eb7c8172deac40554e993e4d61a765a616f4
Task-number: QTBUG-44688
Reviewed-by: Topi Reiniö <topi.reinio@digia.com>
qtbase/src/corelib/itemmodels/qitemselectionmodel.cpp:1199: warning: Undocumented parameter 'model' in QItemSelectionModel::modelChanged()
qtbase/src/corelib/plugin/qpluginloader.cpp:420: warning: Can't link to 'staticPlugin()'
qtbase/src/gui/text/qtextdocument.cpp:1452: warning: No such parameter 'from' in QTextDocument::find()
qtbase/src/testlib/qtestcase.cpp:2770: warning: No documentation for 'QTest::qExtractTestData()'
Change-Id: I76758dbdf3ad7b0ae1f14de0407a6fde523827d0
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Enables optimization in the case of an already existing QPainterPath.
Change-Id: I7f038673ce245ea19e400e6d2c728f07cb55e366
Task-number: QTBUG-42853
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Reviewed-by: Yoann Lopes <yoann.lopes@theqtcompany.com>
Reviewed-by: Gunnar Sletta <gunnar@sletta.org>
Notify the translator that those are substrings used for searching.
Change-Id: I242f701ff23929fe84099c40a696acfca3388f7b
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Including math.h can pollute the default namespace, and break
some compilers if cmath versions of the method are declared as using.
Switching to C++ math functions also greatly simplifies handling of
float qreal as C++ automatically chooses the right method.
[ChangeLog][QtCore][QtMath] qmath.h no longer includes math.h, so any
sources depending on that indirect inclusion may fail to build.
Change-Id: I4d0e331dafba354ec05dc5052e61ef4ff8d387fe
Reviewed-by: Rafael Roquetto <rafael.roquetto@kdab.com>
We know the size, so use it instead of allowing QVector to reallocate.
Change-Id: I2d18c30ef0d050326bb03c54da61459c40eb7af6
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Similar to 46b2c74eaf, skip the translations at
all costs. They allocate, and are very expensive. To ensure we try harder to
skip them, also avoid checking styles at all unless one has been provided.
This increases delegates_text from 209 items to 221 items for me.
Change-Id: Ia18b07de7b48cee356e9506a0c5d7129621d79d2
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Windows+FreeType, Linux with -no-fontconfig and the forthcoming
OSX FreeType engine can now use sub pixel rendering.
The function to get the subpixel type is in QPlatformScreen because
we're moving to per screen font settings in the future.
This patch is safe, as no functionality is changed for existing users,
if one wants sub pixel rendering they'll still have to pass -DFT_CONFIG_OPTION_SUBPIXEL_RENDERING
to configure.
Task-number: QTBUG-44269
Change-Id: Ib6c22d48a1b7c7b85ee316d5d9e3b6eae0c1ecc0
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@theqtcompany.com>
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>
...where passing them by value was not intentional.
Change-Id: Ifd5036d57b41fddeeacfbd3f5890881605b80647
Reviewed-by: Shawn Rutledge <shawn.rutledge@digia.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.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>
The postfix increment(decrement) creates a temp copy of *this before the
modification and then returns that copy. It's needed only when using the
old iterator and then incrementing it.
Change-Id: I7f6702de78f5f987cec3556047e76049b4ee063a
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>