Skip to content

Commit

Permalink
Skip rendering text when font size would be zero (WhyNotHugo#218)
Browse files Browse the repository at this point in the history
  • Loading branch information
akx authored Nov 28, 2023
1 parent 6591846 commit 12148e1
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions barcode/writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -448,6 +448,8 @@ def _paint_module(self, xpos, ypos, width, color):

def _paint_text(self, xpos, ypos):
font_size = int(mm2px(pt2mm(self.font_size), self.dpi))
if font_size <= 0:
return
font = ImageFont.truetype(self.font_path, font_size)
for subtext in self.text.split("\n"):
pos = (
Expand Down

0 comments on commit 12148e1

Please sign in to comment.