The QTextCharFormat documentation said that the used style is based on
QStyle::SH_SpellCheckUnderlineStyle style hint, however in fact the
implementation (drawTextItemDecoration in qpainter.cpp) uses
themeHint(QPlatformTheme::SpellCheckUnderlineStyle) instead since Qt 5
(see commit 1f9ae50457).
Make the documentation match that behavior, and update QPlatformTheme
to use the correct default value.
Also, switch Cocoa theme to use DotLine, as that is what native macOS
applications use.
Change-Id: I2a6bb3da6c7b0686dca87ed2c251b6abc006123c
Task-number: QTBUG-50499
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@qt.io>
We currently match font family names in cross-platform code, before
asking the system to load it. In the case of an empty family name, we
will return the first font in the list which matches the other
conditions.
After that, though, we would pass the empty family name to the
platform font database, and some old platform-specific matching
was invoked. In the case of Windows, we would default to
MS Sans Serif, which is the old Windows 1.0 raster font and which
is probably used by Qt exclusively in the world at this point.
The problem in the end was that the font info would be out of sync.
If the font matched by Qt happened to be smoothly scalable, then
we would treat MS Sans Serif as smoothly scalable, giving us
random glyphs when displaying text in Qt Quick. We would also
overwrite the family name with the one matched by Qt, so even
when MS Sans Serif was used to render the text, we would report
that it was something else.
For empty font families, we therefore pass the family we have
actually matched into the platform database. This will have
the side effect of trusting the font matching in Qt, but only
for the rare case where someone actually explicitly sets the
font family to the empty string.
Note that the random glyph bug that triggered the investigation is not
happening anymore after 1eedfd0e66
because we will detect the glyph outlines as unreliable in the
MS Sans Serif font now instead of trusting the smoothly scalable
flag. But there would still be a mismatch between the font used
for rendering and the matched font.
Task-number: QTBUG-63147
Change-Id: I4a09ffddf9f8a0fabe7738e2944b6d874e4728f0
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Remaining uses of Q_NULLPTR are in:
src/corelib/global/qcompilerdetection.h
(definition and documentation of Q_NULLPTR)
tests/manual/qcursor/qcursorhighdpi/main.cpp
(a test executable compilable both under Qt4 and Qt5)
Change-Id: If6b074d91486e9b784138f4514f5c6d072acda9a
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Remaining uses of Q_DECL_OVERRIDE are in:
src/corelib/global/qcompilerdetection.h
src/corelib/global/qglobal.cpp
doc/global/qt-cpp-defines.qdocconf
(definition and documentation of Q_DECL_OVERRIDE)
tests/manual/qcursor/qcursorhighdpi/main.cpp
(a test executable compilable both under Qt4 and Qt5)
Change-Id: Ib9b05d829add69e98a86238274b6a1fcb19b49ba
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
In Qt, we have QTextOption::tabStop, QTextEdit::tabStopWidth and
QPlainTextEdit::tabStopWidth.
Neither are very good names, since the tab stop is neither a
numerical value as in the former, nor does it have any dimensions
that can be measured, as in the latter. Vertical text advances
may also be supported by Qt at some point in the future, at
which point the name would make even less sense.
At the same time, we expose the actual type of the tab stop
distance as floating point in the QTextEdit and QPlainTextEdit
API instead of always rounding it to an int.
To avoid duplicating either of these APIs in Qt Quick, we
introduce tabStopDistance as the common term instead and deprecate
the old names.
[ChangeLog][Text] Introduced tabStopDistance property in
QTextOption, QTextEdit and QPlainTextEdit as replacement for
the inconsistently named tabStop and tabStopWidth properties.
QTextOption::tabStop, QTextEdit::tabStopWidth and
QPlainTextEdit::tabStopWidth have subsequently been deprecated.
Change-Id: Ib7e01387910cddb58adaaaadcd56c0e69edc4bc2
Reviewed-by: Paolo Angelelli <paolo.angelelli@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
OpenType support missing for script 11
becomes:
OpenType support missing for "SimSun", script 11
Change-Id: I562e20d630c9cdd888f75fd99b987de5152cd77e
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
In the past, we had an undocumented text flag that worked with
one of the QPainter::drawText() overloads. This was never intended
as public API and served a specific cause in Qt WebKit at one point.
But there is a general need for such API, as disabling shaping features
easily gives 25% performance improvement on text rendering even for
fairly short strings.
This patch adds a new style strategy flag to disable shaping and
will just uses the CMAP and HDMX tables to get glyph indices and advances
for the characters. In Qt 6, the TextBypassShaping flag can be removed
completely and be replaced by the style strategy.
[ChangeLog][QtGui][Text] Added QFont::PreferNoShaping style strategy to support
improvements to performance at the expense of some cosmetic font features.
Task-number: QTBUG-56728
Change-Id: I48e025dcc06afe02824bf5b5011702a7e0036f6d
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Especially in examples, where we should show off our convenience
functions, prefer calling these functions over doing arithmetic with
M_PI (or approximations thereto) and 180 (give or take simple
factors). This incidentally documents what's going on, just by the
name of the function used (and reveals at least one place where
variables were misnamed; the return from atan is in radians, *not*
degrees).
Task-number: QTBUG-58083
Change-Id: I6e5d66721cafab423378f970af525400423e971e
Reviewed-by: Jüri Valdmann <juri.valdmann@qt.io>
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
CID 181185: Uninitialized members (UNINIT_CTOR)
Non-static class member "key" is not initialized in this constructor nor in any functions that it calls.
Change-Id: I8f2c18263a0dc81b98eb398d618184bf761c02e1
Coverity-Id: 181185
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This allows us to have the Q_DECLARE_PROPERTY before the
QVector<Property> use. Not important for Qt 5, but it helps me.
The operator!= function is never called, so it can be dropped (caught by
ICC 17 beta).
Change-Id: I149e0540c00745fe8119fffd1463c9bc1b356ec6
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Qt Quick Controls 2 needs configurable and toolable fonts for the
upcoming image-based style. Exposing these enums to the meta object
system allows the font weights, styles, etc. being specified as
enum value string names.
Change-Id: I024793656dd1af3a47d4edb5e27563a13c3b4c08
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
If you keep around QTextLines referring to the previous contents of
the layout, you can experience crashes when using these after the
layout has been cleared. Since QTextLine is a value type, this is
not very obvious in the API, so we should at least give a warning
in the docs.
Task-number: QTBUG-60804
Change-Id: I81b2b640eec5f62b0af1e878aadd9fa23654ec18
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io>
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Getting the localized family name of a font involves quite a bit of work
internally in CoreText, e.g. creating and sorting font descriptors.
By deferring population of family aliases until a font match misses
we shave off ~1 second of startup time for applications that use non-
localized font families (most applications).
Change-Id: I021952c311c0d70d7769ccf764dbf997ebf30a4b
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
CSS style such as "line-height: 1.5;" should be used as a multiplier,
but Qt uses it as percentage which makes line spacing way too small. To
workaround this, convert it to percent and use as
QTextBlockFormat::ProportionalHeight instead.
[ChangeLog][QtGui][Important Behvior Changes] Changed CSS line-height
property with multiplier to follow CSS spec
Task-number: QTBUG-56848
Task-number: QTCREATORBUG-17683
Change-Id: Icc98f7c0d4d07542a220702c287f23fa450ef875
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
The documentation of QSyntaxHighlighter still uses the deprecated
QRegExp class. This patch updates the code samples as well as cleanup
some typos.
Change-Id: I87b525fddb560b7c5bb38f96d9aaceadb594f76c
Reviewed-by: Sze Howe Koh <szehowe.koh@gmail.com>
<div>1<br/></div>2 was inserting two newlines between 1 and 2, while all
tested web browsers only insert one newline - as long as there is nothing
between the <br/> and the </div>.
This was the cause for extra newlines being inserted in KMail when
replying to HTML emails, such as those generated by gmail.
Change-Id: I5145d977701e68913264357bba22780e7cdd3f7d
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
The 'lines' and 'items' containers are both declared mutable, so
[] detaches even in const functions.
Change-Id: I29ac74302af2fab390b3cf3f9d05ea2cace6840b
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
A QStaticText object is supposed to be created and *kept* by the user,
and then used repeatedly for drawing, saving the expensive
layouting/rasterization process which would otherwise be done for each
drawText-like call.
Allowing an implicit conversion from QString is therefore surely
unwanted.
[ChangeLog][Potentially Source-Incompatible Changes][QStaticText] The
QStaticText(const QString &) constructor is now explicit.
Change-Id: Ib939a5f46638cb9a54d1cc30ff50e3a9d20be5e4
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
More fallthrough-are-errors fixed.
Change-Id: I9a6cb6efe988400ed3f9cb95d1e426dac317e6c4
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
The FreeType font engine setup is spread out between factory functions,
constructors, and init() functions, so let's at least try to share as
much as possible of it to make it easier to reason about and possibly
refactor in the future.
Change-Id: Ic39353d2b3111024e0589a70211bac80feb8498e
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
Change-Id: Ib0eae1858880e3fe2b6c6abd94c7ea0bbc2649a2
Reviewed-by: Stephan Binner <stephan.binner@basyskom.com>
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
The class does not need to be exported, as it is all-inline, and
non-polymorphic.
The class also does not need a default ctor, except that QVector
requires it, so make the default ctor private and grant QVector
friendship.
Add constexpr and noexcept.
Mark as primitive instead of movable.
Change-Id: Ia5d11de8eb993cb080002804e11176dc5226a04c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
For handling ShortcutOverride events in text-edit-like controls one must
know if a key event matches a common text edit short cut. The code that
was formerly in QWidgetTextControl is now moved into
QInputControl::isCommonTextEditShortcut to remove duplicated code in
QtQuick and to avoid adding adding a third duplicate in QtWebEngine.
Task-number: QTBUG-59053
Change-Id: I18723bb0224acd33c8ea4a8d0a601bb5e274a7a9
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
In fe97ecf408 we added support for
arbitrarily sized glyphs, since there is no guarantee that a glyph
will fit inside the em square. There was, however, a hardcoded max
size in the distance field generator, so for very tall glyphs we
could potentially get a crash.
[ChangeLog][QtGui][Text] Fixed crash for very tall glyphs
Task-number: QTBUG-57241
Change-Id: Id95c0f10d82a1294f7e7a51ac32e88a5a2e0a790
Reviewed-by: Yoann Lopes <yoann.lopes@qt.io>
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
operator=, which was only used for clearing, wasn't clearing the hash.
This led to a mismatch between the vector and the hash (given that the hash
points into the vector).
Spotted by interrupting kmail in gdb, and it was in this code
iterating over a 2000 entries hash (the first vector entries not matching
the hash, this code keep appending new entries for the same formats).
This fixes QTBUG-8862 again, the initial fix having been accidentally
reverted in 467b15a.
Change-Id: Ia34b3d002a0199e1930431a4bbdb2ec981ed4ffc
Task-number: QTBUG-8862
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Calculating the glyph widths for '/W' and '/DW' entries in
PDF documents based on QFixed leads to rounding errors, which
result in different glyph widths than the ones store into
the font program.
Use qreal-based calculation in both places, to have consistent
glyph width information across the PDF document.
Change-Id: I761809f4bc586005e35640929c4663c8b477e0e6
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Update the QSyntaxHighlighter examples to use the new QRegularExpression
class in place of QRegExp.
Fix typos. Remove duplicated snippet. Replace lengthy section of
duplicate text in highlight(..) with a note to see the detailed
description.
Task-number: QTBUG-58494
Change-Id: Id8d94bddbed52e6e52feac107f6fc84e2fe4518a
Reviewed-by: Samuel Gaist <samuel.gaist@edeltech.ch>
Reviewed-by: Sze Howe Koh <szehowe.koh@gmail.com>
that's where the files are actually used nowadays.
also removes an obsolete (and bogus) gui export.
Change-Id: I4551aad798acb6ce8c0abe43a2fcb8e5ac64a2d4
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
When glyph width more then 256 (8bits), this glyph
will be rendered with artefacts.
Task-number: QTBUG-51714
Change-Id: Id606c90c7968a8db75732abc502ca8dcd46b38ba
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
- add support for hb_font_get_{nominal,variation}_glyph() callback
introduced in 1.2.3
- add support for hb_get_font_h_extents callback
introduced in 1.1.3
- do not register dummy callbacks for which HB has a bit faster
implementation (since 1.1.2)
- mark funcs object immutable for the sake of safety
Change-Id: I05281b01d012aed32030ec7cff41a456b5540179
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
The CoreText backend will remove the PDF token from the end of
the string (instead of producing a zero-width glyph for it),
thus the output will be different from the OpenType backend
and the client will get confused. To fix this, we replace
the PDF token with a visible grapheme starter and handle it after.
Task-number: QTBUG-38113
Change-Id: I1bf6927aa2fa214d33f98afec8eb57bcab639379
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
There was a false assumption that the bidi level of text is only
used for visualizing the text, not for calculating its bounding
box. But the bidi level is required for shaping (indeed many
OpenType rules check for reading direction) and the glyphs used
to represent a given text may be different based on its
directionality. The effect would be that the bounding rect we
calculated for text would sometimes be too small for RTL text, and
we would end up clipping pixels.
[ChangeLog][QtGui][Text] Fixed clipping errors and too small
bounding rects for some right-to-left text.
Task-number: QTBUG-48005
Change-Id: Idd12ae1b0033d518034b582204ba47ae41795293
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Enables optimizing with -Og if GCC has the option available, this
should produce faster debug binaries without compromising debugability.
Is a privateConfig to limit it to the default Qt build.
Includes two fixes for false positives of maybe_uninitialized triggered
by -Og on gcc 4.9.
Change-Id: I466d7a4070295714189024369312e6cbd36cfacf
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Amends 7896ae052a. The previous change
focused only on ZWJ and ZWNJ, but there are many other formatting characters
that we need to support and that may be rejected by the German keyboard-hack.
This opens up for all characters in the Other_Format category.
Task-number: QTBUG-58364
Change-Id: Idd967a9ae5b12060c851f6030b7e019508561696
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Changes how we control if gamma-correction is done, and enables it for
the freetype CFF engine when stem-darkening is available.
The new code replaces existing hacks to force gamma-correction off
when using Freetype on X11 and Windows.
Change-Id: Ic703ca6965a3d81b204349e10f406c991b292edd
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
The license headers here were accidentally copied from Qt 5.6, since
the files were targeted for that branch originally. This updates them
to the proper LGPLv3 + GPLv2 + commercial.
Change-Id: I0623bdbf8fd4475405500b2687ef8dce2f1dbb6b
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
The style name needs to be cleared if not present in the string,
otherwise the style name from qApp->font() (which propagates to
any default-constructed QFont) remains.
Change-Id: I9b6522a39a38526cced8a11ed02ae32582026480
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Konstantin Shegunov <kshegunov@gmail.com>
They were simply not postioned correctly relative
to the functions they were meant to document.
Change-Id: I6eef94b291ae4ffe343d2728cc32477f55b2a871
Reviewed-by: Martin Smith <martin.smith@qt.io>
Some formatting characters are replaced by ASCII in the output
from toPlainText(). Since this is a bit inconsistent, we should
document it.
Task-number: QTBUG-57552
Change-Id: I46033588d37517056a8d4668d1d16d48c72ee1b5
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Private Use Area characters are quite valid input characters when used
in combination with a custom font. Joiners also serve an important language
purpose in semitic writing systems.
Note that there is a hack where we disregard any character produced
using CTRL or CTRL+SHIFT specifically because of German keyboards. I have chosen to
keep the hack in this patch to limit the change (though I have made an exception
for ZWJ and ZWNJ since both are produced using Ctrl+Shift on Windows), but it
will probably have to be reverted.
[ChangeLog][QtWidgets][Input] Accept characters in Private Use Area, as well as
zero-width joiners and zero-width non-joiners in input in QLineEdit and QTextEdit.
Task-number: QTBUG-42074
Task-number: QTBUG-57003
Change-Id: I73f3b7d587a8670de24e902dc52a51f7721dba5a
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Short-cut the case-insensitive string comparison when lengths doesn't
match.
This reduces the time spend in ucstricmp from 8% during start-up of the
textedit example, to under 1%.
Change-Id: Ib3a92900b330453289ec9eff4830dfac6a9a5da2
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This will be used in QtQuick to avoid costly string manipulation (which in turn
involves memory allocations).
Change-Id: I51a67a4cd97cc576f399483c9c0c13da1e1c6e72
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
When including a CSS file in a HTML file sent to QTextDocument, and the
CSS file starts with «@charset "UTF-8";», which is the correct way of
declaring that, the parsing fails.
If you omit the space, like «@charset"UTF-8";» the parsing succeeds,
which is wrong.
Fix this by expecting and swallowing whitespace after the @charset
tokens.
Task-number: QTBUG-54829
Change-Id: I32044e8d24bda70c1eb06bf74af50d4cabe2211d
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
This will be used by QtQuick to correct a performance regression introduced by
592614ea3e -- QFontDatabase::isSmoothlyScalable is
quite computationally expensive; and now it is unconditionally expensive
regardless of the platform.
Change-Id: I82bfa65a963c6c3c276d574f2b379da4a9ba5b69
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
When we are anyway caching the rendered glyphs in a texture,
like when doing native text rendering in the scene graph, the
outline drawing fallback does not make sense. In fact, when used
together with a dpr scale factor, it would cause text to be blurry,
since it would first render the QPainterPath at the set pixel size
and then scale the image.
In practice, there isn't any real clients of the internal outline_drawing
property in the Freetype engine anymore, since this is now handled
independently of the font engines in the
QPaintEngineEx::shouldDrawCachedGlyphs(), but in case we at any point
would want to be compatible with the X11 paint engine again, we
might as well keep it around.
Task-number: QTBUG-55856
Change-Id: Ie090c596fe5cda2b598fa152a488881d50f86d2c
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
When the dpr scale caused pixel sizes to reach 64 pixels and up,
thus triggering the outline drawing fallback, we would render
the glyphs at the original size but scale the glyph positions,
giving broken rendering. This was because we did not actually
pass the matrix to the fallback function when getting the alpha
maps.
Fixing it revealed a different problem, which was that the bounding
box for the glyphs, returned by alphaMapBoundingBox() did not
actually apply the transform when outline drawing was enabled.
[ChangeLog][QtGui][Text] Fixed rendering of large fonts when a
device pixel ratio is set and the Freetype engine is used.
Task-number: QTBUG-55856
Change-Id: I03d9066faf0e4346628a4eb630f0dd74a81ef148
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Fix compilation with topleveldomain, textodfwriter
and cssparser features disabled.
Change-Id: I3f061fb09eef36cd640256a46cf77dde85a54d3d
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Avoid looking up by key twice in a row in various locations, but instead
using iterators and index lookup.
Change-Id: I61a079115199ab9c041ad3a26d36b45ee3f775e0
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
No-break-spaces should not be counted in the space data, but rather
be treated as any other non-breakable character. We were already
taking care of this in the loop we reach if the item starts with
a character which isn't whitespace, but there is a second loop for
items that begin with whitespace characters.
The result of this was that in certain circumstances where you gave
the nbsp its own format and made the line wrap, the previous line
would count an extra trailing space and it would swallow the first
character in its following line.
[ChangeLog][QtGui][Text] Fixed a bug where a no-break space would
sometimes cause the first character of the containing line to not be
displayed.
Task-number: QTBUG-56714
Change-Id: Idd760a389052e6de70f6cc397122b217987fa5f2
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Parameter in setPageSize is QSizeF. Without a specified unit it is hard to know
what to use as input. Units depend upon the underlying paint device
Change-Id: If001b3e9587d6085cc18017680fa20396e936adb
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
Reviewed-by: Nico Vertriest <nico.vertriest@theqtcompany.com>
Reviewed-by: Steve Schilz <sschilz@pasco.com>
If qreal is float, then android-clang compilation was breaking here
Change-Id: Ieccc357ecbbea5cbb22a5808dd0791795240a985
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
In 5e3e34731b, a default implementation
of QPlatformFontDatabase::fallbacksForFamily() was added, but this
implementation included only the fonts with a matching style in
the returned list.
The result of this was that if a font face for a specific language
did not have e.g. an italic font, then we would show missing glyph
boxes instead. On Android, it would be impossible to show any
italic text in Chinese, Japanese, Hebrew, or Arabic.
[ChangeLog][QtGui][Text] Fixed synthesized oblique for non-latin
text on platforms using the basic font database, such as Android.
Task-number: QTBUG-51223
Change-Id: I494d8ad87292b65d4380a2e600c1c0dc7fc8f937
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Since 40ebda3efb, bitmap fonts are detected
as smoothly scalable on Windows. While the fontsAlwaysScalable() does say
whether or not the font engine can rasterize the fonts at any size, it does
not determine whether or not the result is "attractive" as the
documentation for isSmoothlyScalable() says.
Only outline fonts are smoothly scalable, and this fact is used in Qt Quick
to determine whether we can use the distance field renderer for the font or
if we have to fall back to the native renderer. The consequence was that
the fonts were no longer usable in Qt Quick.
We also need to revert the optimization for isBitmapScalable() since there
a font that is smoothly scalable should not be identified as bitmap
scalable (basically this means: Font is not smoothly scalable, but it
can be scaled with bitmap scaling artifacts).
[ChangeLog][QtGui][Text] Fixed a regression where raster fonts on Windows
were detected as smoothly scalable and thus rendering with said fonts
in Qt Quick would break.
Task-number: QTBUG-56659
Change-Id: Ia7db6fee8249aca347233a488388be5c3a00c2df
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
The QTextDocument::toPlainText() converts some characters in the
text to ASCII, which can be problematic for use cases where you
want to save the precise contents of the document, e.g. in
Qt Creator. Since we don't want to change the behavior of
toPlainText(), we introduce a new function which returns the
raw text contents of the document instead, with no modifications.
[ChangeLog][QtGui][Text] Added QTextDocument::toRawText() function.
Task-number: QTBUG-56538
Change-Id: Ib6c48a16551c4c71c4c431760f993793d1af6806
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
for that, qt_help_lib.prf gains the ability to write "external module
pri" files that contain suitable information for QMAKE_USE.
these files have a bunch of limitations:
- they are not installed, because a) they are not relocatable and b) the
helper libs' headers are not installed, either
- it won't work with qmake -r, which is ok, as qt5 does not build with
qmake -r anyway
- deps are not transitive, neither at build nor at use time
the freetype, harfbuzz-ng, pcre, and png helper libs have been adjusted
accordingly, and their uses replaced with QMAKE_USE instances. this also
allowed inlining the now trivial {harfbuzz,pcrc,png}_dependency.pri
files. freetype_dependency.pri remains due to its funkiness.
Change-Id: I16890eecb122e34ec49f3d3e68380d1ea71a198a
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
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>