feat: the print file's footer line is about 1 cm tall (Dropstar, 2026-10-28)
All checks were successful
Build and deploy / Validate source (push) Successful in 5s
Build and deploy / Integration suite on a real stack (push) Successful in 3m34s
Build and deploy / Secret scan and release gate (push) Successful in 5s
Build and deploy / Publish images (push) Successful in 1m2s

It was 18 pt, about 0,6 cm. Now 31 pt, shrunk only when the line would not
fit the film's width (the 27 cm UV), measured with Helvetica's widths.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Cauê Faleiros
2026-10-28 11:13:52 -03:00
parent ebe8b29db2
commit ac22f9a2f6
3 changed files with 57 additions and 12 deletions

View File

@@ -105,7 +105,7 @@ class PrintFileTests(unittest.TestCase):
self.assertIn(b'/Logo ', pdf)
self.assertIn(b'/SMask', pdf)
self.assertNotIn(b'(DROPSTAR) Tj', content)
self.assertIn(b'/F2 18 Tf', content)
self.assertIn(b'/F2 31 Tf', content)
self.assertIn('(Pedido DTF-7 · Item 1/2 · 21/10/2026 · 1,00 m) Tj'.encode('cp1252'), content)
self.assertNotIn(b' re f', content) # no filled background
# Without the logo file, the brand's name in bold.
@@ -130,7 +130,18 @@ class PrintFileTests(unittest.TestCase):
'ordered_at': datetime(2026, 10, 23, 15, 0, tzinfo=timezone.utc)}
line = footer(job, spec)
self.assertEqual(line, 'DROPSTAR · Pedido DTF-7 · Item 2/2 · 23/10/2026 · 1,00 m · ESPELHADO')
self.assertIn(b'/F1 18 Tf ( \xb7 ESPELHADO) Tj', footer_commands(line, (100, 80)))
self.assertIn(b'/F1 31 Tf ( \xb7 ESPELHADO) Tj', footer_commands(line, (100, 80)))
# About 1 cm tall on the 57 cm film (Dropstar, 2026-10-28); on the 27 cm UV
# the line shrinks to fit the width instead of running off the film.
from app.printfile import PT_PER_CM, text_width
long_line = 'DROPSTAR · Pedido DTF-12345 · Item 10/12 · 28/10/2026 · 123,40 m · ESPELHADO'
uv = footer_commands(long_line, (100, 80), 27 * PT_PER_CM)
size = int(re.search(rb'/F2 (\d+) Tf', uv).group(1))
self.assertLess(size, 31)
logo = 1.3 * 100 / 80 * PT_PER_CM
used = 0.5 * PT_PER_CM + logo + 0.4 * PT_PER_CM + size * (
text_width('Pedido DTF-12345 · Item 10/12 · 28/10/2026 · 123,40 m') + text_width(' · ESPELHADO', True))
self.assertLessEqual(used, 27 * PT_PER_CM - 0.5 * PT_PER_CM)
self.assertNotIn(b'ESPELHADO', footer_commands(footer(job, item([placement(0, 0, 20, 10)], [source(20, 10)], 10)), (100, 80)))
# The files start with the code the Kanban copies.
self.assertEqual(file_prefix(7, 1), 'DTF-7-item-2')