blf.dimensions incorrect on Darwin builds #46371

Closed
opened 2015-10-04 23:51:02 +02:00 by jon denning · 16 comments
Member

We have created a help text box in python that draws text to 3D viewport when our tools run modal. This help box automatically wraps the text if it is too wide to fit in the space given. Our line breaking code uses blf.dimensions(0,text)- [x] to determine the width of the text.

On Linux and Windows machines, this works as expected, but on OSX machine it is off by factor of ~1.2. For example, blf.dimensions(0,text)- [x] gives 155.4 on OSX and 186.0 on Linux when text = 'Contours Help (click to hide help):'. Note: it should report 186.0 for both machines.

We have seen this issue since at least Jan 12, but thought it was a bug in our code. We are using the default font at size = 12 with DPI = context.user_preferences.system.dpi, which is 72 on all our test machines (Linux, Windows, OSX).

We have created a help text box in python that draws text to 3D viewport when our tools run modal. This help box automatically wraps the text if it is too wide to fit in the space given. Our line breaking code uses `blf.dimensions(0,text)- [x]` to determine the width of the text. On Linux and Windows machines, this works as expected, but on OSX machine it is off by factor of ~1.2. For example, `blf.dimensions(0,text)- [x]` gives 155.4 on OSX and 186.0 on Linux when `text = 'Contours Help (click to hide help):'`. *Note*: it **should** report 186.0 for both machines. We have seen this issue since at least Jan 12, but thought it was a bug in our code. We are using the default font at size = 12 with `DPI = context.user_preferences.system.dpi`, which is 72 on all our test machines (Linux, Windows, OSX).
Author
Member

Changed status to: 'Open'

Changed status to: 'Open'
Author
Member

Added subscriber: @gfxcoder

Added subscriber: @gfxcoder

Added subscriber: @patmo141-3

Added subscriber: @patmo141-3

Removed subscriber: @patmo141-3

Removed subscriber: @patmo141-3

Added subscriber: @JonathanWilliamson

Added subscriber: @JonathanWilliamson
Member

Added subscribers: @ideasman42, @Blendify

Added subscribers: @ideasman42, @Blendify
Member

@ideasman42 think this one is for you

@ideasman42 think this one is for you

Added subscriber: @brecht

Added subscriber: @brecht

What are the steps to reproduce this problem, just running this in the python console?

import blf; blf.size(0, 12, 72); blf.dimensions(0, 'Contours Help (click to hide help):')[0]

Does the OS X machine have a retina display? I would expect a 2x factor for that though, not 1.2x.

Are you testing with factory settings on both platforms?

What are the steps to reproduce this problem, just running this in the python console? ``` import blf; blf.size(0, 12, 72); blf.dimensions(0, 'Contours Help (click to hide help):')[0] ``` Does the OS X machine have a retina display? I would expect a 2x factor for that though, not 1.2x. Are you testing with factory settings on both platforms?
Author
Member

Running import blf; blf.size(0, 12, 72); blf.dimensions(0, 'Contours Help (click to hide help):')- [x] gives:

Linux: 186.046875
OSX: ~155.4
Windows: ~186.047

The OSX machine does not have a retina display. Factory settings for Linux and Windows. Fairly certain OSX has factory settings (not my machine), but I'll double-check on this.

Running `import blf; blf.size(0, 12, 72); blf.dimensions(0, 'Contours Help (click to hide help):')- [x]` gives: Linux: `186.046875` OSX: ~`155.4` Windows: ~`186.047` The OSX machine does not have a retina display. Factory settings for Linux and Windows. Fairly certain OSX has factory settings (not my machine), but I'll double-check on this.

Testing with Blender 2.75 and 2.76 RC3 on OS X 10.11, I'm seeing 186.046875, both when running Blender in retina and low resolution.

I would expect there's something in the user preferences influencing this. So testing with File > Load Factory Settings would be good to confirm if that's the case. Perhaps something under Themes > Text Style, or a custom interface font under System.

Testing with Blender 2.75 and 2.76 RC3 on OS X 10.11, I'm seeing `186.046875`, both when running Blender in retina and low resolution. I would expect there's something in the user preferences influencing this. So testing with File > Load Factory Settings would be good to confirm if that's the case. Perhaps something under Themes > Text Style, or a custom interface font under System.

It would seem it is indeed something with my user preferences.

Running with factory settings I get 186.046875 as well.

It would seem it is indeed something with my user preferences. Running with factory settings I get `186.046875` as well.

So, we need to figure out what exactly is causing this. An addon, theme setting, something else? If you can't find it, could you attach your userpref.blend?

So, we need to figure out what exactly is causing this. An addon, theme setting, something else? If you can't find it, could you attach your userpref.blend?

Added subscriber: @mont29

Added subscriber: @mont29

Changed status from 'Open' to: 'Archived'

Changed status from 'Open' to: 'Archived'
Bastien Montagne self-assigned this 2015-10-17 11:00:31 +02:00

No news since one week…

No news since one week…
Sign in to join this conversation.
No Milestone
No project
No Assignees
6 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender-addons#46371
No description provided.