Skip to content

Commit 2e208af

Browse files
committed
fixed spacing issue
1 parent 7706280 commit 2e208af

2 files changed

Lines changed: 4 additions & 3 deletions

File tree

neosent/main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
metavar='<R G B>', help='set the foreground color') # Idem
1414
@click.option('--set-font', 'font', default="data/OpenSansEmoji.ttf",
1515
metavar='<font_path>', help='the font used')
16-
@click.option('--set-font-size', 'font_size', default=240, show_default=True, type=int,
16+
@click.option('--set-font-size', 'font_size', default=210, show_default=True, type=int,
1717
metavar='<size>', help='set the font size')
1818
@click.option('-o', 'output_file', default='', metavar='<output_file>', help='the name of the output file')
1919
@click.option('-v', 'verbose', is_flag=True, help='get verbose output')

neosent/sheetwriter.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ def _draw_text_page(self, name: str, text: str):
8484
page = ImageDraw.Draw(img)
8585
# centered text
8686

87+
spacing = round(self.dimension[1]/720)
8788
def wrap_text(text: str, width: int):
8889
"""
8990
Limits text to a maximum character size per line
@@ -93,7 +94,7 @@ def wrap_text(text: str, width: int):
9394
count = 0
9495
for c in text:
9596
if count > width and c == ' ':
96-
final_text += c + '\n'
97+
final_text += c * spacing + '\n'
9798
count = 0
9899
continue
99100
if c == '\n':
@@ -104,7 +105,7 @@ def wrap_text(text: str, width: int):
104105

105106
text = wrap_text(text, 22)
106107
page.text((self.dimension[0]/2, (self.dimension[1])/2.2), text,
107-
font=self.font, fill=self.fg_color, anchor='mm', align='left', )
108+
font=self.font, fill=self.fg_color, anchor='mm', align='left', spacing=spacing * 12)
108109
img.save(name)
109110

110111
def _draw_image_page(self, name: str, img: str):

0 commit comments

Comments
 (0)