Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions src/Mike42/Escpos/PrintBuffers/EscposPrintBuffer.php
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,8 @@ public function writeTextRaw(string $text)
$outp = str_repeat(self::REPLACEMENT_CHAR, $l);
for ($i = 0; $i < $l; $i++) {
$c = substr($text, $i, 1);
if ($c == "\r") {
/* Skip past Windows line endings (raw usage). */
if ($c == "\r" && substr($text, $i + 1, 1) == "\n") {
/* Skip past Windows line endings CRLF (raw usage). */
continue;
} elseif (self::asciiCheck($c, true)) {
$outp[$j] = $c;
Expand Down Expand Up @@ -296,6 +296,12 @@ private static function asciiCheck(string $char, bool $extended = false)
if ($num == 10) { // New-line (printer will take these)
return true;
}
if ($num == 13) { // Carriage-return (printer will take these)
return true;
}
if ($num == 9) { // Horizontal-tab (printer will take these)
return true;
}
if ($extended && $num > 127) {
return true;
}
Expand Down