From 808cc4aeba9cbd5c47586ac72f3dc4f42f8eadc0 Mon Sep 17 00:00:00 2001 From: Philipp Klaus Date: Wed, 4 Jan 2017 14:14:56 +0100 Subject: [PATCH] margin_top and margin_bottom: new param in % of font_size --- brother_ql_web.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/brother_ql_web.py b/brother_ql_web.py index f440ae0..6bc84b4 100755 --- a/brother_ql_web.py +++ b/brother_ql_web.py @@ -64,9 +64,11 @@ def get_label_context(request): 'margin': int(d.get('margin', 10)), 'threshold': int(d.get('threshold', 70)), 'align': d.get('align', 'center'), + 'margin_top': float(d.get('margin_top', 0.24)), + 'margin_bottom': float(d.get('margin_bottom', 0.45)), } - context['margin_top'] = int(context['font_size']*0.24) - context['margin_bottom'] = int(context['font_size']*0.45) + context['margin_top'] = int(context['font_size']*context['margin_top']) + context['margin_bottom'] = int(context['font_size']*context['margin_bottom']) def get_font_path(font_family, font_style): try: