From 89a25a3ef169cb42c54ef1ddcb28f70b24f923ab Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Sun, 9 Jun 2019 20:01:36 +0200 Subject: Don't count all engines as "in use" in cache Back in 36cb3f3f655a9090c82de609010cbfb88651a0f3, we started properly reference counting font engines as they were entered into the font cache. Prior to this, ref.load == 0 would mean that the engine was essentially owned by the cache. When the change was made, the condition that an engine must be in use if its reference is != 0 remained, and the result of this was used to calculate the limit for when the cache should be flushed. Since this limit was miscalculated, the cache would keep growing, even if it only contained unused font engines. [ChangeLog][QtGui][Text] Fixed a bug which could cause the font cache to grow larger than it was supposed to. Task-number: QTBUG-76219 Change-Id: I4d1541756f3bdf5bd9b0301bf47c6db2e220716a Reviewed-by: Konstantin Ritt --- src/gui/text/qfont.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/gui/text') diff --git a/src/gui/text/qfont.cpp b/src/gui/text/qfont.cpp index 69255fd59d..fe4fa4929a 100644 --- a/src/gui/text/qfont.cpp +++ b/src/gui/text/qfont.cpp @@ -2970,7 +2970,7 @@ void QFontCache::decreaseCache() it.value().data->ref.load(), engineCacheCount.value(it.value().data), it.value().data->cache_cost); - if (it.value().data->ref.load() != 0) + if (it.value().data->ref.load() > engineCacheCount.value(it.value().data)) in_use_cost += it.value().data->cache_cost / engineCacheCount.value(it.value().data); } -- cgit v1.2.3 From ac68ef1efc27669e9c8fc255298345d72d198d68 Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Fri, 3 May 2019 13:45:53 +0200 Subject: Don't duplicate font family names in the fallback list Fixes: QTBUG-75333 Change-Id: Iaaf4b13d50c6b9b52e629b81d5e9cbc552a0202c Reviewed-by: Allan Sandfeld Jensen --- src/gui/text/qfontdatabase.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/gui/text') diff --git a/src/gui/text/qfontdatabase.cpp b/src/gui/text/qfontdatabase.cpp index fa9573441a..6dad5196e8 100644 --- a/src/gui/text/qfontdatabase.cpp +++ b/src/gui/text/qfontdatabase.cpp @@ -707,7 +707,8 @@ static QStringList familyList(const QFontDef &req) if ((str.startsWith(QLatin1Char('"')) && str.endsWith(QLatin1Char('"'))) || (str.startsWith(QLatin1Char('\'')) && str.endsWith(QLatin1Char('\'')))) str = str.mid(1, str.length() - 2); - family_list << str.toString(); + if (!family_list.contains(str)) + family_list << str.toString(); } } // append the substitute list for each family in family_list -- cgit v1.2.3 From a4f79313f065815451610dabdbbb33b8a35f0a86 Mon Sep 17 00:00:00 2001 From: Eirik Aavitsland Date: Mon, 3 Jun 2019 14:45:07 +0200 Subject: Fix: QTextDocument::find backward search crossing paragraphs If the start position of a backward string search was the at the start of a paragraph, the code would start searching at an illegal position (at the eol character) in the preceding paragraph. That caused that whole paragraph to be skipped, so any matches there would not be found. Fix by making sure the search starts at legal position. Fixes: QTBUG-48035 Change-Id: Id6c0159b6613ec75ec617a0a57096ceef2b4cbd0 Reviewed-by: Konstantin Ritt --- src/gui/text/qtextdocument.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/gui/text') diff --git a/src/gui/text/qtextdocument.cpp b/src/gui/text/qtextdocument.cpp index 4f187c6701..c2020f3f86 100644 --- a/src/gui/text/qtextdocument.cpp +++ b/src/gui/text/qtextdocument.cpp @@ -1358,6 +1358,8 @@ QTextCursor QTextDocument::find(const QString &subString, int from, FindFlags op blockOffset = 0; } } else { + if (blockOffset == block.length() - 1) + --blockOffset; // make sure to skip end-of-paragraph character while (block.isValid()) { if (findInBlock(block, subString, blockOffset, options, &cursor)) return cursor; -- cgit v1.2.3 From 83dccf00ccf75da27551b68652d5c3c1b4f7ebff Mon Sep 17 00:00:00 2001 From: Eirik Aavitsland Date: Thu, 11 Apr 2019 15:29:44 +0200 Subject: Fix printing of table headers in multi-frame QTextDocuments The calculation of page position of table headers would only work correctly for tables in the root frame of a QTextDocument. Fix by including the relative positions of subframes. Fixes: QTBUG-59000 Change-Id: I2cc7e21bddf806f7f5f9b0675ac014c339ba2453 Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/gui/text/qtextdocumentlayout.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'src/gui/text') diff --git a/src/gui/text/qtextdocumentlayout.cpp b/src/gui/text/qtextdocumentlayout.cpp index bed0a2c450..cf02e2f9c8 100644 --- a/src/gui/text/qtextdocumentlayout.cpp +++ b/src/gui/text/qtextdocumentlayout.cpp @@ -970,8 +970,14 @@ void QTextDocumentLayoutPrivate::drawFrame(const QPointF &offset, QPainter *pain if (pageHeight <= 0) pageHeight = QFIXED_MAX; - const int tableStartPage = (td->position.y / pageHeight).truncate(); - const int tableEndPage = ((td->position.y + td->size.height) / pageHeight).truncate(); + QFixed absYPos = td->position.y; + QTextFrame *parentFrame = table->parentFrame(); + while (parentFrame) { + absYPos += data(parentFrame)->position.y; + parentFrame = parentFrame->parentFrame(); + } + const int tableStartPage = (absYPos / pageHeight).truncate(); + const int tableEndPage = ((absYPos + td->size.height) / pageHeight).truncate(); qreal border = td->border.toReal(); drawFrameDecoration(painter, frame, fd, context.clip, frameRect); -- cgit v1.2.3