font.pointSize should not be used together with units.gu()

Bug #1288819 reported by Michael Zanetti
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Ubuntu Weather App
Fix Released
Medium
Martin Borho

Bug Description

This is how the weather app looks like on my Retina screen with GRID_UNIT_PX=18:

http://i.imgur.com/XMwGBUb.png

I think the issue is that you're using font.pointSize in conjunction with units.gu(). Units.gu() converts grid units into pixels, while font points are translated, taking fonts DPI into account. This means you should

* either use font.pointSize with a hardcoded value (not so good on Ubuntu, but ok for generic QML)
* or use font.pixelSize with units.gu() (acceptable for Ubuntu, but also not really way to go)
* or replace the Text {} item with the Label {} from uitk and set the font to "small", "large" or whatever (suggested solution for Ubuntu)

Related branches

description: updated
Raúl Yeguas (neokore)
Changed in ubuntu-weather-app:
assignee: nobody → Raúl Yeguas (neokore)
Changed in ubuntu-weather-app:
assignee: Raúl Yeguas (neokore) → Martin Borho (martin-borho)
status: New → Confirmed
importance: Undecided → Medium
status: Confirmed → In Progress
Revision history for this message
Martin Borho (martin-borho) wrote :

Using Label and fontSize is ok for normal text , like the labels in the shapes at the bottom and the top.

But the font with Label and fontSize "x-large" for temperature/metric values in the center of the shapes is too small.

What way would you suggest to get a really large font? (Like the temperatures/values in the shapes)

Revision history for this message
Michael Zanetti (mzanetti) wrote :

I guess in that case using pixelSize with units.gu() should be ok. You can easily test if it scales well for different resolutions by exporting this before launching the app:

export GRID_UNIT_PX=20

Try it with a few different sizes. The default if its not set is 8.

Revision history for this message
Martin Borho (martin-borho) wrote :

Ok thanks, will try!

But I can't reproduce your error. When using trunk and changing GRID_UNIT_PX to 20, the shapes are scaling just nice.

Does it not scale only on retina displays?

Revision history for this message
Michael Zanetti (mzanetti) wrote : Re: [Bug 1288819] Re: font.pointSize should not be used together with units.gu()

On Wednesday 02 April 2014 08:42:02 Martin Borho wrote:
> Ok thanks, will try!
>
> But I can't reproduce your error. When using trunk and changing
> GRID_UNIT_PX to 20, the shapes are scaling just nice.
>
> Does it not scale only on retina displays?

Oh, I see... Yeah. I have a font DPI of 200 set in my xorg.conf. That's the
thing that makes font.pointSizes scale implicitly. But if you just stay away
from pointSize, you should be fine.

Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :

Fix committed into lp:ubuntu-weather-app at revision None, scheduled for release in ubuntu-weather-app, milestone alpha-1

Changed in ubuntu-weather-app:
status: In Progress → Fix Committed
Changed in ubuntu-weather-app:
status: Fix Committed → 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.