From e5128321d0c23cd52f55c1027f2ddfea981dd9a6 Mon Sep 17 00:00:00 2001 From: fra87 <5077242+fra87@users.noreply.github.com> Date: Sat, 26 Aug 2023 18:20:07 +0200 Subject: [PATCH 1/3] Fixed text_distance not applied in guarded mode --- barcode/writer.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/barcode/writer.py b/barcode/writer.py index b63e5ea..cf5bb92 100755 --- a/barcode/writer.py +++ b/barcode/writer.py @@ -284,7 +284,7 @@ def render(self, code): # Split the ean into its blocks self.text = self.text.split(" ") - ypos += pt2mm(self.font_size) + ypos += pt2mm(self.font_size) + self.text_distance blocks = self.text for text_, xpos in zip(blocks, text["xpos"]): From 5f94fefd396eb7cf155a78f62ec557ac56158d4f Mon Sep 17 00:00:00 2001 From: fra87 <5077242+fra87@users.noreply.github.com> Date: Sat, 26 Aug 2023 18:20:35 +0200 Subject: [PATCH 2/3] Fixed wrong height calculation --- barcode/writer.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/barcode/writer.py b/barcode/writer.py index cf5bb92..7101438 100755 --- a/barcode/writer.py +++ b/barcode/writer.py @@ -127,7 +127,7 @@ def calculate_size(self, modules_per_line, number_of_lines): number_of_text_lines = len(self.text.splitlines()) if self.font_size and self.text: height += ( - pt2mm(self.font_size) / 2 * number_of_text_lines + self.text_distance + pt2mm(self.font_size) * number_of_text_lines + self.text_distance ) height += self.text_line_distance * (number_of_text_lines - 1) return width, height From 8800b413ee07cf66d0265d10e39b87bbc54c0bde Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Sat, 26 Aug 2023 16:23:35 +0000 Subject: [PATCH 3/3] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- barcode/writer.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/barcode/writer.py b/barcode/writer.py index 7101438..779f928 100755 --- a/barcode/writer.py +++ b/barcode/writer.py @@ -126,9 +126,7 @@ def calculate_size(self, modules_per_line, number_of_lines): ) number_of_text_lines = len(self.text.splitlines()) if self.font_size and self.text: - height += ( - pt2mm(self.font_size) * number_of_text_lines + self.text_distance - ) + height += pt2mm(self.font_size) * number_of_text_lines + self.text_distance height += self.text_line_distance * (number_of_text_lines - 1) return width, height