mirror of
https://github.com/pklaus/brother_ql_web.git
synced 2024-05-25 11:56:53 +03:00
center text on die-cut labels; improved annotation in web iface
This commit is contained in:
parent
c8b3c501f0
commit
b59f981cec
|
@ -106,7 +106,11 @@ def create_label_im(text, **kwargs):
|
|||
im = Image.new('L', (kwargs['width'], height), 'white')
|
||||
draw = ImageDraw.Draw(im)
|
||||
textsize = draw.multiline_textsize(text, font=im_font)
|
||||
vertical_offset = 0 #(height - textsize[1])//2
|
||||
if 'x' in kwargs['label_size']:
|
||||
# die-cut labels
|
||||
vertical_offset = (height - textsize[1])//2
|
||||
else:
|
||||
vertical_offset = 0
|
||||
horizontal_offset = max((kwargs['width'] - textsize[0])//2, 0)
|
||||
if 'ttf' in kwargs['font_path']: vertical_offset -= 10
|
||||
offset = horizontal_offset, vertical_offset
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
<div class="row">
|
||||
<div class="col-md-4">
|
||||
<fieldset class="form-group">
|
||||
<label for="labelSize">Label Size:</label>
|
||||
<select class="form-control" id="labelSize" onChange="preview()">
|
||||
{% for label_size in label_sizes %}<option value="{{label_size[0]}}">{{label_size[1]}}</option>{% endfor %}
|
||||
</select>
|
||||
|
|
Loading…
Reference in New Issue
Block a user