mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-25 17:57:02 +00:00
Refactor scale_font_size to improve DPI and pixel size handling for better font scaling
This commit is contained in:
committed by
Bruno Perdigão
parent
ecaea5f776
commit
c0857c715a
@@ -1572,12 +1572,17 @@ class Blender(bonsai.core.tool.Blender):
|
|||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def scale_font_size(cls, size):
|
def scale_font_size(cls, size):
|
||||||
|
default_dpi = 72
|
||||||
|
default_pixel_size = 1.0
|
||||||
ui_style = bpy.context.preferences.ui_styles[0]
|
ui_style = bpy.context.preferences.ui_styles[0]
|
||||||
base_size = ui_style.widget.points if size is None else size
|
base_size = ui_style.widget.points if size is None else size
|
||||||
ui_scale = bpy.context.preferences.view.ui_scale
|
platform_scale = 0.5 if sys.platform == "darwin" else 1
|
||||||
platform_scale = 2 if sys.platform == "darwin" else 1
|
|
||||||
|
default_scale = default_dpi * default_pixel_size
|
||||||
|
system = bpy.context.preferences.system
|
||||||
|
system_scale = system.dpi * system.pixel_size
|
||||||
|
return (system_scale / default_scale) * base_size *platform_scale
|
||||||
|
|
||||||
return base_size * ui_scale * platform_scale
|
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def apply_transform_as_local(cls, obj: bpy.types.Object) -> bool:
|
def apply_transform_as_local(cls, obj: bpy.types.Object) -> bool:
|
||||||
|
|||||||
Reference in New Issue
Block a user