blf.dimensions reports different text sizes with Region Overlap enabled, 3D View shown, and panels set #50372

Closed
opened 2017-01-04 20:51:29 +01:00 by jon denning · 7 comments
Member

We have found that blf.dimensions returns different text sizes (by ~10%) if Region Overlap is enabled and the 3D View is particularly configured.

To replicate:

  • Enable Region Overlap in User Prefs > System

  • Set main window to have 3D View and Python Console (other areas seem not to matter)

  • 3D View: Tool Shelf closed, Properties Panel closed

  • In Python Console:

    • >>> import blf
    • >>> blf.dimensions(0, "test")
    • (19.3125, 7.875)
  • 3D View: open Tool Shelf

  • In Python Console

    • >>> blf.dimensions(0, "test")
    • (21.703125, 8.59375)

Anything but Region Overlap enabled + Tool Shelf opened + Properties Panel closed, and blf.dimensions(0, "test") reports (19.3125, 7.875). Strangely, in Retopoflow, we found that the issue shows up when Region Overlap is enabled and Properties Panel is opened (Tool Shelf does not matter). (see https://github.com/CGCookie/retopoflow/issues/88 for results) Also, the issue does not appear if 3D View is not shown (switch to Text Editor, for ex).

Tested in fresh install of Blender 2.78a on OSX and Linux, but it seems that we've had this issue since Jan 2015.

We have found that `blf.dimensions` returns different text sizes (by ~10%) if Region Overlap is enabled and the 3D View is particularly configured. To replicate: - Enable Region Overlap in User Prefs > System - Set main window to have 3D View and Python Console (other areas seem not to matter) - 3D View: Tool Shelf closed, Properties Panel closed - In Python Console: - `>>> import blf` - `>>> blf.dimensions(0, "test")` - `(19.3125, 7.875)` - 3D View: open Tool Shelf - In Python Console - `>>> blf.dimensions(0, "test")` - `(21.703125, 8.59375)` Anything but Region Overlap enabled + Tool Shelf opened + Properties Panel closed, and `blf.dimensions(0, "test")` reports `(19.3125, 7.875)`. Strangely, in Retopoflow, we found that the issue shows up when Region Overlap is enabled and Properties Panel is *opened* (Tool Shelf does *not* matter). (see https://github.com/CGCookie/retopoflow/issues/88 for results) Also, the issue does not appear if 3D View is not shown (switch to Text Editor, for ex). Tested in fresh install of Blender 2.78a on OSX and Linux, but it seems that we've had this issue since Jan 2015.
Author
Member

Changed status to: 'Open'

Changed status to: 'Open'
Author
Member

Added subscriber: @gfxcoder

Added subscriber: @gfxcoder

Added subscriber: @JonathanWilliamson

Added subscriber: @JonathanWilliamson

Added subscriber: @mont29

Added subscriber: @mont29

Changed status from 'Open' to: 'Archived'

Changed status from 'Open' to: 'Archived'
Bastien Montagne self-assigned this 2017-01-06 11:45:40 +01:00

There is no bug here actually, this is just a matter of font size.

When Properties of 3DView is shown, last size used during text drawing for default font is 11, while it’s 12 when props are hidden.

Note that you cannot do much about this in python console, since redraw happens between each line of code, but in a 'real' script you shall call blf.size(0, 11, 72) (size 11, dpi 72) or whatever size/dpi value you need prior to computing size of the text.

Anyway, no bug here really.

There is no bug here actually, this is just a matter of font size. When Properties of 3DView is shown, last size used during text drawing for default font is `11`, while it’s `12` when props are hidden. Note that you cannot do much about this in python console, since redraw happens between each line of code, but in a 'real' script you shall call `blf.size(0, 11, 72)` (size 11, dpi 72) or whatever size/dpi value you need prior to computing size of the text. Anyway, no bug here really.
Author
Member

Thanks, @mont29! That solved the problem!

Seems we were calling blf.size(), but only after calling blf.dimensions() and before drawing the text, so the text drew correctly.

Thanks, @mont29! That solved the problem! Seems we were calling `blf.size()`, but only after calling `blf.dimensions()` and before drawing the text, so the text drew correctly.
Sign in to join this conversation.
No Milestone
No project
No Assignees
3 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#50372
No description provided.