Test page: replace inverted section banners with plain '=' rules, frame page with '-'
deploy / deploy (push) Successful in 10s

Matches the style settled on for the print-issues receipt -- '=' for
labeled section breaks, '-' for the plain top/bottom frame, no more
fully blacked-out rows.
This commit is contained in:
randy committed 2026-09-13 12:40:00 +02:00
1 parent a58d4b66ea
commit 4308850a2e
2 files changed
+18 -8

No files matched your search

+14 -5
View File
@@ -65,17 +65,26 @@ class ReceiptBuilder
self
end
# White-on-black reverse video (GS B n) -- the closest this direct-thermal
# printer gets to a second "color" for a separator/banner.
# White-on-black reverse video (GS B n) -- available if a receipt ever
# wants a real highlight, but plain "=" rules read better for routine
# section breaks than a fully blacked-out line.
def invert(enable = true)
@buffer << (enable ? "\x1D\x42\x01" : "\x1D\x42\x00")
self
end
# A full-width inverted banner line, e.g. section_separator("SECTION").
# A single "=" rule with an optional label centered in it, e.g.
# section_separator("SECTION") -> "========= SECTION =========".
def section_separator(label = '', width: 48)
padded = label.empty? ? (' ' * width) : " #{label} ".center(width)
feed(1).invert.text(padded[0, width]).invert(false).feed(1)
line = if label.empty?
'=' * width
else
mid = " #{label} "
pad = [width - mid.length, 0].max
left = pad / 2
('=' * left) + mid + ('=' * (pad - left))
end
feed(1).text("#{line}\n").feed(1)
end
def size(mode)