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>
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>