mirror of
				https://github.com/pklaus/brother_ql_web.git
				synced 2024-05-25 11:56:53 +03:00 
			
		
		
		
	empty line → line containing ' ' (workaround for #5)
This commit is contained in:
		
							parent
							
								
									31348de455
								
							
						
					
					
						commit
						96cbe91b78
					
				| @ -110,6 +110,13 @@ def create_label_im(text, **kwargs): | ||||
|     im_font = ImageFont.truetype(kwargs['font_path'], kwargs['font_size']) | ||||
|     im = Image.new('L', (20, 20), 'white') | ||||
|     draw = ImageDraw.Draw(im) | ||||
|     # workaround for a bug in multiline_textsize() | ||||
|     # when there are empty lines in the text: | ||||
|     lines = [] | ||||
|     for line in text.split('\n'): | ||||
|         if line == '': line = ' ' | ||||
|         lines.append(line) | ||||
|     text = '\n'.join(lines) | ||||
|     linesize = im_font.getsize(text) | ||||
|     textsize = draw.multiline_textsize(text, font=im_font) | ||||
|     width, height = kwargs['width'], kwargs['height'] | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user