Use ASCII [ ] / [x] for inline checkboxes on CP437 printers.
Unicode and ESC graphics failed on the micro-printer; ASCII is the option that stays in the native text line. Co-authored-by: Cursor <cursoragent@cursor.com>
@@ -81,10 +81,10 @@ Wrapped lines use a hanging indent:
81
81
82
82
| Syntax | Printed result |
83
83
|--------|----------------|
84
| `[]` or `[ ]` | ☐ (U+2610) |
85
| `[x]` or `[X]` | 🗹 (U+1F5F9) |
84
| `[]` or `[ ]` | `[ ]` |
85
| `[x]` or `[X]` | `[x]` |
86
86
87
Emitted as UTF-8 text (experiment). Many ESC/POS printers only speak CP437 and may show garbage or blanks instead.
87
ASCII only — stays inline in the native CP437 font. Unicode ☐/🗹 and ESC `*`/`&` graphics were tried and rejected for this stack (CJK mojibake / not inline).
88
88
89
89
Parameters work inside any text, and inside barcode/QR/image directives (below).
90
90
@@ -269,7 +269,7 @@ Parse errors include 1-based line and column. Typical causes:
269
269
| `# heading` | Double width/height ON → text → OFF |
270
270
| `## heading` | Bold ON → text → OFF |
271
271
| `- item` | ASCII `* ` bullet + hanging wrap |
272
| `[]` / `[ ]` / `[x]` | UTF-8 ☐ / 🗹 (trial; CP437 printers may not render) |
272
| `[]` / `[ ]` / `[x]` | ASCII `[ ]` / `[x]` (CP437-safe, inline) |
273
273
| `:center:` | Justification center |
274
274
| `@feed n` / blank line | ESC d n |
275
275
| `@cut` | GS V partial cut |
@@ -81,10 +81,10 @@ Wrapped lines use a hanging indent:81
81
82
| Syntax | Printed result |82
| Syntax | Printed result |83
|--------|----------------|83
|--------|----------------|84
| `[]` or `[ ]` | ☐ (U+2610) |84
| `[]` or `[ ]` | `[ ]` |85
| `[x]` or `[X]` | 🗹 (U+1F5F9) |85
| `[x]` or `[X]` | `[x]` |86
86
87
Emitted as UTF-8 text (experiment). Many ESC/POS printers only speak CP437 and may show garbage or blanks instead.87
ASCII only — stays inline in the native CP437 font. Unicode ☐/🗹 and ESC `*`/`&` graphics were tried and rejected for this stack (CJK mojibake / not inline).88
88
89
Parameters work inside any text, and inside barcode/QR/image directives (below).89
Parameters work inside any text, and inside barcode/QR/image directives (below).90
90
@@ -269,7 +269,7 @@ Parse errors include 1-based line and column. Typical causes:269
| `# heading` | Double width/height ON → text → OFF |269
| `# heading` | Double width/height ON → text → OFF |270
| `## heading` | Bold ON → text → OFF |270
| `## heading` | Bold ON → text → OFF |271
| `- item` | ASCII `* ` bullet + hanging wrap |271
| `- item` | ASCII `* ` bullet + hanging wrap |272
| `[]` / `[ ]` / `[x]` | UTF-8 ☐ / 🗹 (trial; CP437 printers may not render) |272
| `[]` / `[ ]` / `[x]` | ASCII `[ ]` / `[x]` (CP437-safe, inline) |273
| `:center:` | Justification center |273
| `:center:` | Justification center |274
| `@feed n` / blank line | ESC d n |274
| `@feed n` / blank line | ESC d n |275
| `@cut` | GS V partial cut |275
| `@cut` | GS V partial cut |@@ -82,12 +82,12 @@ Long items wrap with a hanging indent (printed/previewed as ASCII `*`):
82
82
83
83
### Checkboxes
84
84
85
Inline checkboxes print as Unicode ☐ / 🗹 (UTF-8 trial on the printer). Preview shows the same glyphs.
85
Inline checkboxes use ASCII so they print correctly on CP437 ESC/POS printers (same font as surrounding text):
86
86
87
87
| Syntax | Result |
88
88
|--------|--------|
89
| `[]` or `[ ]` | ☐ |
90
| `[x]` or `[X]` | 🗹 |
89
| `[]` or `[ ]` | `[ ]` |
90
| `[x]` or `[X]` | `[x]` |
91
91
92
92
```markdown
93
93
[] Unchecked
@@ -95,6 +95,8 @@ Inline checkboxes print as Unicode ☐ / 🗹 (UTF-8 trial on the printer). Prev
95
95
[x] Done
96
96
```
97
97
98
Unicode ballot boxes and custom bit-images are not used: UTF-8 becomes garbage/CJK on CP437 printers, and ESC `*` / ESC `&` graphics often leave the text line on micro-printers.
99
98
100
### Horizontal rule
99
101
100
102
```markdown
@@ -82,12 +82,12 @@ Long items wrap with a hanging indent (printed/previewed as ASCII `*`):82
82
83
### Checkboxes83
### Checkboxes84
84
85
Inline checkboxes print as Unicode ☐ / 🗹 (UTF-8 trial on the printer). Preview shows the same glyphs.85
Inline checkboxes use ASCII so they print correctly on CP437 ESC/POS printers (same font as surrounding text):86
86
87
| Syntax | Result |87
| Syntax | Result |88
|--------|--------|88
|--------|--------|89
| `[]` or `[ ]` | ☐ |89
| `[]` or `[ ]` | `[ ]` |90
| `[x]` or `[X]` | 🗹 |90
| `[x]` or `[X]` | `[x]` |91
91
92
```markdown92
```markdown93
[] Unchecked93
[] Unchecked@@ -95,6 +95,8 @@ Inline checkboxes print as Unicode ☐ / 🗹 (UTF-8 trial on the printer). Prev95
[x] Done95
[x] Done96
```96
```97
97
98
Unicode ballot boxes and custom bit-images are not used: UTF-8 becomes garbage/CJK on CP437 printers, and ESC `*` / ESC `&` graphics often leave the text line on micro-printers.99
98
### Horizontal rule100
### Horizontal rule99
101
100
```markdown102
```markdown@@ -29,7 +29,7 @@ Target **Epson ESC/POS** compatible printers (58 mm / 80 mm thermal).
29
29
| Line feed | LF (text lines), ESC d (`@feed` / blank lines) | Text ends with LF; blank/`@feed` use ESC d |
30
30
| Raster flush | LF after GS v 0 | Ensures spacing after images/barcodes/QR rasters |
31
31
| List bullet | ASCII `*` | `- item` lines in templates |
32
| Inline checkbox | UTF-8 ☐ / 🗹 | `[]` / `[ ]` / `[x]` (trial glyphs) |
32
| Inline checkbox | ASCII `[ ]` / `[x]` | `[]` / `[ ]` / `[x]` — CP437-safe, same font as text |
33
33
| Partial cut | GS V 66 0 | `@cut` in template only |
34
34
| Barcode | GS k | Native symbologies; raster via GS v 0 |
35
35
| QR Code | GS ( k | Model 2; or raster GS v 0 |
@@ -29,7 +29,7 @@ Target **Epson ESC/POS** compatible printers (58 mm / 80 mm thermal).29
| Line feed | LF (text lines), ESC d (`@feed` / blank lines) | Text ends with LF; blank/`@feed` use ESC d |29
| Line feed | LF (text lines), ESC d (`@feed` / blank lines) | Text ends with LF; blank/`@feed` use ESC d |30
| Raster flush | LF after GS v 0 | Ensures spacing after images/barcodes/QR rasters |30
| Raster flush | LF after GS v 0 | Ensures spacing after images/barcodes/QR rasters |31
| List bullet | ASCII `*` | `- item` lines in templates |31
| List bullet | ASCII `*` | `- item` lines in templates |32
| Inline checkbox | UTF-8 ☐ / 🗹 | `[]` / `[ ]` / `[x]` (trial glyphs) |32
| Inline checkbox | ASCII `[ ]` / `[x]` | `[]` / `[ ]` / `[x]` — CP437-safe, same font as text |33
| Partial cut | GS V 66 0 | `@cut` in template only |33
| Partial cut | GS V 66 0 | `@cut` in template only |34
| Barcode | GS k | Native symbologies; raster via GS v 0 |34
| Barcode | GS k | Native symbologies; raster via GS v 0 |35
| QR Code | GS ( k | Model 2; or raster GS v 0 |35
| QR Code | GS ( k | Model 2; or raster GS v 0 |@@ -30,5 +30,5 @@ fn main() {
30
30
println!("Printing checkbox test to: {}", device.display_name);
31
31
let mut transport = open_printer(&device.target).expect("open printer");
32
32
print_bytes(&mut transport, &bytes).expect("print");
33
println!("OK — check paper for Unicode ☐ / ☐ / 🗹 (may be blank/garbage on CP437-only printers)");
33
println!("OK — check paper for ASCII [ ] / [ ] / [x] inline with normal text");
34
34
}
@@ -30,5 +30,5 @@ fn main() {30
println!("Printing checkbox test to: {}", device.display_name);
30
println!("Printing checkbox test to: {}", device.display_name);
31
let mut transport = open_printer(&device.target).expect("open printer");
31
let mut transport = open_printer(&device.target).expect("open printer");
32
print_bytes(&mut transport, &bytes).expect("print");
32
print_bytes(&mut transport, &bytes).expect("print");
33
println!("OK — check paper for Unicode ☐ / ☐ / 🗹 (may be blank/garbage on CP437-only printers)");
33
println!("OK — check paper for ASCII [ ] / [ ] / [x] inline with normal text");
34
}
34
}
@@ -141,12 +141,15 @@ pub enum Inline {
141
141
},
142
142
}
143
143
144
/// Checkbox glyphs sent as UTF-8 (trial: ballot box / ballot box with bold check).
144
/// ASCII checkbox glyphs — CP437-safe so they stay inline with the native font.
145
///
146
/// True ballot-box Unicode (☐/🗹) is misread as multi-byte CJK on this printer;
147
/// ESC `*` / ESC `&` graphics do not stay in the text line on many micro-printers.
145
148
pub fn checkbox_glyph(checked: bool) -> &'static str {
146
149
if checked {
147
"🗹" // U+1F5F9 BALLOT BOX WITH BOLD CHECK
150
"[x]"
148
151
} else {
149
"☐" // U+2610 BALLOT BOX
152
"[ ]"
150
153
}
151
154
}
152
155
@@ -141,12 +141,15 @@ pub enum Inline {141
},
141
},
142
}
142
}
143
143
144
/// Checkbox glyphs sent as UTF-8 (trial: ballot box / ballot box with bold check).
144
/// ASCII checkbox glyphs — CP437-safe so they stay inline with the native font.
145
///
146
/// True ballot-box Unicode (☐/🗹) is misread as multi-byte CJK on this printer;
147
/// ESC `*` / ESC `&` graphics do not stay in the text line on many micro-printers.
145
pub fn checkbox_glyph(checked: bool) -> &'static str {
148
pub fn checkbox_glyph(checked: bool) -> &'static str {
146
if checked {
149
if checked {
147
"🗹" // U+1F5F9 BALLOT BOX WITH BOLD CHECK
150
"[x]"
148
} else {
151
} else {
149
"☐" // U+2610 BALLOT BOX
152
"[ ]"
150
}
153
}
151
}
154
}
152
155
@@ -399,14 +399,14 @@ mod tests {
399
399
}
400
400
401
401
#[test]
402
fn encodes_inline_checkboxes_as_unicode_glyphs() {
402
fn encodes_inline_checkboxes_as_ascii() {
403
403
let doc = parse("[] hello [x]").unwrap();
404
404
let mut enc = EscPosEncoder::new(PosMetadata::default());
405
405
let bytes = enc.encode_document(&doc).unwrap();
406
406
let text = String::from_utf8_lossy(bytes);
407
407
assert!(
408
text.contains("☐ hello 🗹\n"),
409
"expected Unicode ballot glyphs inline, got: {text:?}"
408
text.contains("[ ] hello [x]\n"),
409
"expected ASCII checkbox glyphs inline, got: {text:?}"
410
410
);
411
411
}
412
412
@@ -399,14 +399,14 @@ mod tests {399
}
399
}
400
400
401
#[test]
401
#[test]
402
fn encodes_inline_checkboxes_as_unicode_glyphs() {
402
fn encodes_inline_checkboxes_as_ascii() {
403
let doc = parse("[] hello [x]").unwrap();
403
let doc = parse("[] hello [x]").unwrap();
404
let mut enc = EscPosEncoder::new(PosMetadata::default());
404
let mut enc = EscPosEncoder::new(PosMetadata::default());
405
let bytes = enc.encode_document(&doc).unwrap();
405
let bytes = enc.encode_document(&doc).unwrap();
406
let text = String::from_utf8_lossy(bytes);
406
let text = String::from_utf8_lossy(bytes);
407
assert!(
407
assert!(
408
text.contains("☐ hello 🗹\n"),
408
text.contains("[ ] hello [x]\n"),
409
"expected Unicode ballot glyphs inline, got: {text:?}"
409
"expected ASCII checkbox glyphs inline, got: {text:?}"
410
);
410
);
411
}
411
}
412
412