System Information
Operating system: Windows-10-10.0.17763 64 Bits
Graphics card: GeForce GTX 1080/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 390.77
Blender Version
Broken: version: 2.80 (sub 74), branch: master, commit date: 2019-07-03 09:54, hash: rBf990c23bcfb5
Worked: (optional)
Short description of error
See the two attached screenshots- in the first, it is a 4k monitor with windows dpi scaling set to 150%. The second screenshot is a 1080p monitor with the default dpi scaling (100%). The attached script was written and targeted for the 4k monitor, but shows up for 1080p users as in the second shot. There is no way that I have found to reconcile this difference.
4k:
1080p:
Exact steps for others to reproduce the error
Execute the following script on a 4k display, and again on a 1080p display to reproduce the attached results.
import bpy
import bgl
import blf
def draw():
font_size = 16
font_dpi = 72
line_height = font_size * 1.25 # ensures a bit of space between each line
# Draw 3 lines of text just below the selected object name in the 3D viewport.
lines = ["The quick brown fox", "jumped over the lazy", "bug report"]
# calculate the top and left position based on whether or not the toolbar and header is visible so the text aligns with the built-in viewport text
tool_region = None
header_region = None
window_region = None
for r in bpy.context.area.regions:
if r.type == "TOOLS":
tool_region = r
if r.type == "HEADER":
header_region = r
if r.type == "WINDOW":
window_region = r
desired_top = int(window_region.height) - 100
left = 30
if tool_region != None:
left = tool_region.width + left
if header_region != None:
desired_top -= header_region.height
blf.size(0, font_size, font_dpi)
actual_top = desired_top - int(line_height * len(lines))
for i, line in enumerate(lines):
y_offset = (i - len(lines)) * -1
blf.position(0, left, actual_top + (y_offset * line_height), 0)
blf.draw(0, line)
try:
bpy.types.SpaceView3D.draw_handler_remove(draw, "WINDOW")
except:
# wasn't added yet, first run.
pass
bpy.types.SpaceView3D.draw_handler_add(draw, (), 'WINDOW', 'POST_PIXEL')


