From 12148e1d603a5c51a1925cf9db53aa5dfff95840 Mon Sep 17 00:00:00 2001 From: Aarni Koskela Date: Tue, 28 Nov 2023 12:42:55 +0200 Subject: [PATCH] Skip rendering text when font size would be zero (#218) Refs #217 --- barcode/writer.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/barcode/writer.py b/barcode/writer.py index e591cd3..27ca933 100755 --- a/barcode/writer.py +++ b/barcode/writer.py @@ -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 = (