tests
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -231,7 +231,7 @@ def calculate_text_scaling(text, font, target_width, target_height):
|
||||
current_height = bbox[3] - bbox[1]
|
||||
|
||||
if current_width == 0 or current_height == 0:
|
||||
return 1.0, 1.0
|
||||
return 1.0, 1.0, 1.0
|
||||
|
||||
# Calculate scaling factors
|
||||
width_scale = target_width / current_width
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+36
-1
@@ -29,4 +29,39 @@ def is_free_version():
|
||||
|
||||
def is_full_version():
|
||||
"""Check if this is the full version."""
|
||||
return VERSION_TYPE == "full"
|
||||
return VERSION_TYPE == "full"
|
||||
|
||||
def sync_margin_values(props, margin_type='all'):
|
||||
"""Synchronize margin values across properties
|
||||
|
||||
Args:
|
||||
props: Properties object containing margin values
|
||||
margin_type: Type of margin sync ('all', 'horizontal', 'vertical')
|
||||
"""
|
||||
if not props:
|
||||
return
|
||||
|
||||
try:
|
||||
# Get base margin value
|
||||
base_margin = getattr(props, 'text_fitting_margin', 10.0)
|
||||
|
||||
if margin_type == 'all':
|
||||
# Sync all margins to base margin
|
||||
if hasattr(props, 'prepend_margin'):
|
||||
props.prepend_margin = base_margin
|
||||
if hasattr(props, 'append_margin'):
|
||||
props.append_margin = base_margin
|
||||
|
||||
elif margin_type == 'horizontal':
|
||||
# Sync horizontal margins
|
||||
if hasattr(props, 'prepend_margin') and hasattr(props, 'append_margin'):
|
||||
avg_margin = (props.prepend_margin + props.append_margin) / 2
|
||||
props.prepend_margin = avg_margin
|
||||
props.append_margin = avg_margin
|
||||
|
||||
elif margin_type == 'vertical':
|
||||
# Sync vertical margins (if any exist in future)
|
||||
pass
|
||||
|
||||
except Exception as e:
|
||||
print(f"Warning: Failed to sync margin values: {e}")
|
||||
Reference in New Issue
Block a user