Skip to content

Commit 130d5f0

Browse files
committed
Fix: also consider bitmap width when decided whether a newline is needed
1 parent 47a4c85 commit 130d5f0

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

common/src/logger.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -100,11 +100,11 @@ impl Logger {
100100
'\n' => self.newline(),
101101
'\r' => self.carriage_return(),
102102
c => {
103-
if self.x_pos >= self.width() {
103+
let bitmap_char = get_bitmap(c, FontWeight::Regular, BitmapHeight::Size14).unwrap();
104+
if self.x_pos + bitmap_char.width() > self.width() {
104105
self.newline();
105106
}
106-
let bitmap_char = get_bitmap(c, FontWeight::Regular, BitmapHeight::Size14).unwrap();
107-
if self.y_pos >= (self.height() - bitmap_char.height()) {
107+
if self.y_pos + bitmap_char.height() > self.height() {
108108
self.clear();
109109
}
110110
self.write_rendered_char(bitmap_char);

0 commit comments

Comments
 (0)