From 469c671929b8fd05eb684c40bb0c343e271a0671 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 9f64835..50dc8c6 100755 --- a/barcode/writer.py +++ b/barcode/writer.py @@ -293,7 +293,7 @@ def render(self, code: list[str]): # The last text block is always put after the last guard end text["xpos"].append(text["end"][-1] + 4 * self.module_width) - ypos += pt2mm(self.font_size) + ypos += pt2mm(self.font_size) + self.text_distance # Split the ean into its blocks blocks = self.text.split(" ") From 6d42585c18c8151f35be6d52171833079b7ad7d9 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 50dc8c6..e3c552f 100755 --- a/barcode/writer.py +++ b/barcode/writer.py @@ -155,7 +155,7 @@ def calculate_size(self, modules_per_line: int, number_of_lines: int) -> tuple: 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 32cb16f8cf0f2b7ffc2f44f14bf4e764bd6efd1c 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 e3c552f..9ff040d 100755 --- a/barcode/writer.py +++ b/barcode/writer.py @@ -154,9 +154,7 @@ def calculate_size(self, modules_per_line: int, number_of_lines: int) -> tuple: ) 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