Squares in text where carriage returns should be

Bug #1285184 reported by Alan Pope 🍺🐧🐱 🦄
30
This bug affects 6 people
Affects Status Importance Assigned to Milestone
Ubuntu UI Toolkit
Fix Released
Critical
Tim Peeters
qtbase-opensource-src (Ubuntu)
Fix Released
Undecided
Timo Jyrinki

Bug Description

In some apps I've noticed under qt5.2 that there are boxes in text.

For example the app 'Eyire' in the store shows boxes in the "About" page. This is the code in the About.qml:-

                        text: "Author: Mike Sheldon <email address hidden>\n\nReleased
under the GPL, version 3.0 or later.";

The boxes appear where the "\n" is. There seems to be a valid carriage return along with these spurious boxes. Other apps are similarly affected.

Tags: qt5.2

Related branches

Revision history for this message
Zsombor Egri (zsombi) wrote :

Can this bve reproduced with simple QML TextEdit component instead of TextArea?

I suspect yes, which brings us to Qt5.2 text rendering being screwed.

A small test qml file which reproduces the error would also be appreciated.

Changed in ubuntu-ui-toolkit:
assignee: nobody → Zsombor Egri (zsombi)
Changed in ubuntu-ui-toolkit:
importance: Undecided → High
status: New → Incomplete
Revision history for this message
Michał Sawicz (saviq) wrote :

Even Text shows that issue, so it's not a UITK but Qt 5.2 issue:

import QtQuick 2.0

Text {
    width: 50
    height: 50
    maximumLineCount: 2
    text: "foo\nfoo"
}

Changed in ubuntu-ui-toolkit:
status: Incomplete → Confirmed
Revision history for this message
Zsombor Egri (zsombi) wrote :

Checked on Mac OSX with Qt5.2.1, with Ubuntu font installed. Rendering is all fine, font is also fine.

Revision history for this message
Zsombor Egri (zsombi) wrote :
Revision history for this message
Andrew Starr-Bochicchio (andrewsomething) wrote :

Seeing this with in-line HTML as well. Both in Ubuntu.Components Label and QtQuick Text.

Example:

import QtQuick 2.0
import Ubuntu.Components 0.1

Rectangle {
    width: units.gu(40)
    height: units.gu(30)

    Text{
        anchors.fill: parent
        text: "<h1>Bug</h1><br><p>Line breaks are shown.</p>"
    }
}

Revision history for this message
Andrew Starr-Bochicchio (andrewsomething) wrote :
Zoltan Balogh (bzoltan)
Changed in ubuntu-ui-toolkit:
importance: High → Critical
Revision history for this message
Tim Peeters (tpeeters) wrote :

I think it is the Ubuntu font that causes the problem.

This works fine:
import QtQuick 2.0

Text {
    font.family: "Helvetica"
    width: 200
    height: 200
    maximumLineCount: 2
    text: "foo\nfoo"
}

This gives the problem:

import QtQuick 2.0
Text {
    font.family: "Ubuntu"
    width: 200
    height: 200
    maximumLineCount: 2
    text: "foo\nfoo"
}

Without specifying font.family, the problem is there because Ubuntu font is chosen by default (I don't know why, probably a system setting). When I uninstalled the ttf-ubuntu-font-family package, the app ran without the problem when not specifying font.family.

Changed in ubuntu-ui-toolkit:
assignee: Zsombor Egri (zsombi) → Tim Peeters (tpeeters)
Revision history for this message
Tim Peeters (tpeeters) wrote :

The problem persists with both renderType: Text.QtRendering and renderType: Text.NativeRendering

Revision history for this message
Tim Peeters (tpeeters) wrote :

No problem with a Qt Widgets application that uses the Ubuntu font.

Revision history for this message
Tim Peeters (tpeeters) wrote :

I modified availableFonts.qml (from qt 5.2.1 souces) to show a newline for each font, and it exposes this problem for many fonts (but not all).

Run this program with qmlscene and you'll see: http://pastebin.ubuntu.com/7108737/plain/

Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in qtdeclarative-opensource-src (Ubuntu):
status: New → Confirmed
Revision history for this message
Tim Peeters (tpeeters) wrote :

I tried the same with QtQuick1 (and qmlviewer), and the bug is not present in qtquick1

Revision history for this message
Andrew Starr-Bochicchio (andrewsomething) wrote :

I can confirm that it also happens in Debian, so if the bug isn't upstream it is something about our environment that we share with them.

Revision history for this message
Tim Peeters (tpeeters) wrote :

It seems not an ubuntu-only bug:

00:06:56 < special> t1mp: reproduces for Cantarell and Arial in fedora 20

Revision history for this message
Tim Peeters (tpeeters) wrote :

QT_HARFBUZZ=old qmlscene texttest.qml
and the bug is gone

Revision history for this message
Loïc Molinari (loic.molinari) wrote :

I don't know what's the reason for using HarfBuzz (text shaping) that's still marked as experimental in Qt (I guess there's a good one), but the bug comes from qtbase when built with HarfBuzz support. QT_HARFBUZZ=old disables the use of HarfBuzz, as if not built in, so we can force that environment variable, we can switch back to a non-HarfBuzz build or we can backport that patch from trunk : https://codereview.qt-project.org/#change,78991

Revision history for this message
Loïc Molinari (loic.molinari) wrote :

The Qt font engine maintainer has just proposed to backport the patch too : https://codereview.qt-project.org/#change,81150

Revision history for this message
Timo Jyrinki (timo-jyrinki) wrote :

It seems it builds on top of a couple of patches. I'm fetching them all and building in a landing PPA for testing.

affects: qtdeclarative-opensource-src (Ubuntu) → qtbase-opensource-src (Ubuntu)
Changed in qtbase-opensource-src (Ubuntu):
status: Confirmed → In Progress
assignee: nobody → Timo Jyrinki (timo-jyrinki)
Tim Peeters (tpeeters)
Changed in ubuntu-ui-toolkit:
status: Confirmed → In Progress
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package qtbase-opensource-src - 5.2.1+dfsg-1ubuntu9

---------------
qtbase-opensource-src (5.2.1+dfsg-1ubuntu9) trusty; urgency=medium

  * debian/patches/Fix-access-after-delete-with-Harfbuzz-NG-code-path.patch
  * debian/patches/Fix-log_clusters-calculation-in-HarfBuzz-NG-code-pat.patch
  * debian/patches/HarfBuzz-NG-Hide-characters-that-should-normally-be-.patch
  * debian/patches/Minor-optimization-for-QTextEngine-shapeText.patch
    - Cherry-pick latest HarfBuzz-NG changes from upstream including the one
      fixing the glyph issue https://codereview.qt-project.org/#change,81150
      (LP: #1285184)
 -- Timo Jyrinki <email address hidden> Tue, 18 Mar 2014 06:00:49 +0000

Changed in qtbase-opensource-src (Ubuntu):
status: In Progress → Fix Released
Changed in ubuntu-ui-toolkit:
status: In Progress → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.