From c7c715714154d0b1f43320c35a19b5c9bb5c3549 Mon Sep 17 00:00:00 2001 From: Simon Sawert Date: Tue, 1 Sep 2026 00:09:31 +0200 Subject: [PATCH 1/2] fix: make 1 same width as all other digits --- apps/departures/functions.py | 4 +--- lib/font_large.py | 30 +++++++++++++++--------------- lib/font_mini.py | 12 ++++++------ 3 files changed, 22 insertions(+), 24 deletions(-) diff --git a/apps/departures/functions.py b/apps/departures/functions.py index 200d0d4..912ff4f 100644 --- a/apps/departures/functions.py +++ b/apps/departures/functions.py @@ -1012,8 +1012,7 @@ def list_mode(mini=False, half=False): _max_lw = 0 for _a in trainlist: if isinstance(_a, list) and len(_a) > 1: - _lid = "1(1(" if (_a[1] == "11" and not varinit.settings["clocktime"]) else _a[1] - _w = strlen(_lid[:varinit.settings["line_length"]]) + _w = strlen(_a[1][:varinit.settings["line_length"]]) if _w > _max_lw: _max_lw = _w if large_list: line_col = _max_lw + 6 else: line_col = _max_lw + 2 if _max_lw else 0 @@ -1106,7 +1105,6 @@ def list_mode(mini=False, half=False): if varinit.settings["clocktime"]: all[2] = all[2][:11] mins = all[2] - if not varinit.settings["clocktime"]: all[1] = "1(1(" if all[1] == "11" else all[1] if mini: all[2] = mins all[1] = all[1][:varinit.settings["line_length"]] diff --git a/lib/font_large.py b/lib/font_large.py index 98c7591..5e13209 100644 --- a/lib/font_large.py +++ b/lib/font_large.py @@ -854,21 +854,21 @@ 0b0000000 ], "1": [ - 5, - 0b00110, - 0b01110, - 0b11110, - 0b00110, - 0b00110, - 0b00110, - 0b00110, - 0b00110, - 0b00110, - 0b00110, - 0b00000, - 0b00000, - 0b00000, - 0b00000 + 7, + 0b0001100, + 0b0011100, + 0b0111100, + 0b0001100, + 0b0001100, + 0b0001100, + 0b0001100, + 0b0001100, + 0b0001100, + 0b0001100, + 0b0000000, + 0b0000000, + 0b0000000, + 0b0000000 ], "2": [ 7, diff --git a/lib/font_mini.py b/lib/font_mini.py index d7dcc63..f3b602c 100644 --- a/lib/font_mini.py +++ b/lib/font_mini.py @@ -1006,12 +1006,12 @@ 0b000, ], "1": [ - 2, - 0b0010, - 0b0010, - 0b0010, - 0b0010, - 0b0010, + 4, + 0b0100, + 0b0100, + 0b0100, + 0b0100, + 0b0100, 0b0000, ], "2": [ From 6dd8fa5c774021951bbf459327664c3f73aa6420 Mon Sep 17 00:00:00 2001 From: Simon Sawert Date: Wed, 2 Sep 2026 00:14:17 +0200 Subject: [PATCH 2/2] fix: don't rely on `(` for padding Compute and use explicit offset when rendering instead of relying on `(` padding. This is backwards compatible even with the old font but makes it easier to migrate away from `(` as a padding character. --- apps/departures/functions.py | 39 ++++++++++++++++-------------------- lib/load_screen.py | 6 +++--- 2 files changed, 20 insertions(+), 25 deletions(-) diff --git a/apps/departures/functions.py b/apps/departures/functions.py index 912ff4f..2fe7964 100644 --- a/apps/departures/functions.py +++ b/apps/departures/functions.py @@ -1078,7 +1078,7 @@ def list_mode(mini=False, half=False): while len(all[2]) > 0 and sum(_font.get(c, _font['_'])[0] for c in all[2]) > max(0, _max_px): all[2] = all[2][:-1] elif not half: - _line_col_w = 0 if (is_clock_row or is_msg_row) else strlen(varinit.settings["line_length"] * ("((((" if mini else "((((((")) + _line_col_w = 0 if (is_clock_row or is_msg_row) else varinit.settings["line_length"] * (4 if mini else 6) _max_px = varinit.if_long - strlen(all[3]) - _line_col_w - 2 _full_dest_w = strlen(all[2]) if not (_dest_scroll and _full_dest_w > max(0, _max_px)): @@ -1121,32 +1121,28 @@ def list_mode(mini=False, half=False): all[3] = all[3].replace(" " + if_not_clocktime,"") offs = col_w - COL_MARGIN - strlen(all[3]) - - - minsleft = offs*"(" + all[3] - inv = 0 - if half: minsleft = minsleft.replace(" " + if_not_clocktime, "") - if half: multiple_offset = (int(record) - 1) * col_w else: multiple_offset = 0 + + mins_start_x = multiple_offset + offs min_color = "white" if varinit.settings.get("listcolor_time", 0) or varinit.rotated else "yellow" lin_color = "yellow" if not varinit.settings["listcolor"] else "white" clock_color = varinit.settings.get("clock_row_color", "white") if varinit.rotated or varinit.display.width <= 64: - added_space = "" + added_space_w = 0 line = "" if not varinit.rotated and xs_line_id: line = all[1][:varinit.settings["line_length"]] - added_space = (_xs_max_lw + 2) * "(" + added_space_w = _xs_max_lw + 2 elif mini: - added_space = varinit.settings["line_length"] * "((((" - if half: added_space = COL_MARGIN * "(" + (line_col * "(" if multi_station_line_id else "") - else: added_space = varinit.settings["line_length"] * "((((((" + added_space_w = varinit.settings["line_length"] * 4 + if half: added_space_w = COL_MARGIN + (line_col if multi_station_line_id else 0) + else: added_space_w = varinit.settings["line_length"] * 6 if not varinit.settings["line_length"]: - added_space = "" + added_space_w = 0 line = "" if is_clock_row: @@ -1155,17 +1151,16 @@ def list_mode(mini=False, half=False): _clock_pad = max(0, _clock_avail - strlen(dest)) if _clock_align == "center": _clock_pad = _clock_pad // 2 elif _clock_align == "left": _clock_pad = 0 - added_space = _clock_pad * "(" + added_space_w = _clock_pad line = "" elif is_msg_row: - added_space = "" + added_space_w = 0 line = "" if large_list: _lpart = 100 + x - _dest_pad = line_col * "(" - renderstring(minsleft, _lpart, 0, 0, inv, sys_msg=min_color, start_x=multiple_offset) - renderstring(_dest_pad + dest, _lpart, 0, 0, inv, sys_msg=(clock_color if is_clock_row else False), start_x=multiple_offset) + renderstring(all[3], _lpart, 0, 0, inv, sys_msg=min_color, start_x=mins_start_x) + renderstring(dest, _lpart, 0, 0, inv, sys_msg=(clock_color if is_clock_row else False), start_x=multiple_offset + line_col) if not half and not varinit.rotated: renderstring(line, _lpart, 0, 0, inv, sys_msg=lin_color, start_x=multiple_offset) if x > 4: continue else: @@ -1186,16 +1181,16 @@ def list_mode(mini=False, half=False): "overflow": _overflow, "pos": 0, "pause_end": _now + x * 0.8 + 2.0, "start_x": _line_col_w } - renderstring(minsleft, 100+x, 0, 0, inv, mini=mini, - sys_msg=min_color, target_bmp=varinit.overlay_bmp, start_x=multiple_offset) + renderstring(all[3], 100+x, 0, 0, inv, mini=mini, + sys_msg=min_color, target_bmp=varinit.overlay_bmp, start_x=mins_start_x) if _show_line: renderstring(line, 100+x, 0, 0, inv, mini=mini, sys_msg=lin_color, target_bmp=varinit.overlay_bmp, start_x=multiple_offset) varinit.overlay_tg.y = extrarow varinit.overlay_tg.hidden = False else: - renderstring(minsleft, 100+x, 0, 0, inv, mini=mini, sys_msg=min_color, start_x=multiple_offset) - renderstring(added_space + dest, 100+x, 0, 0, inv, mini=mini, sys_msg=(clock_color if is_clock_row else False), start_x=multiple_offset) + renderstring(all[3], 100+x, 0, 0, inv, mini=mini, sys_msg=min_color, start_x=mins_start_x) + renderstring(dest, 100+x, 0, 0, inv, mini=mini, sys_msg=(clock_color if is_clock_row else False), start_x=multiple_offset + added_space_w) if _show_line: renderstring(line, 100+x, 0, 0, inv, mini=mini, sys_msg=lin_color, start_x=multiple_offset) if x > varinit.if_tall // 8 - 1: continue diff --git a/lib/load_screen.py b/lib/load_screen.py index cb9fdde..0d819c2 100644 --- a/lib/load_screen.py +++ b/lib/load_screen.py @@ -157,7 +157,7 @@ def _pprint(string, line=False, color="white", font=font_mini, _refresh=False, c except Exception as e: print(e) -def pprint(string, line=False, color="white", font=font_mini, _refresh=True, clear=True, top_offset=0, window=None, _clearscreen=True, hr="(", slow=False, block=False, shadow_color=0, overlay=False): +def pprint(string, line=False, color="white", font=font_mini, _refresh=True, clear=True, top_offset=0, window=None, _clearscreen=True, hr=None, slow=False, block=False, shadow_color=0, overlay=False): if window is None: window = _current_window() _is_mini = (font == font_mini) global line_window @@ -167,7 +167,7 @@ def pprint(string, line=False, color="white", font=font_mini, _refresh=True, cle offs = 1 + top_offset # Pad string with hr chars when hr is a visible fill character - if _clearscreen and hr != "(": + if _clearscreen and hr is not None: pad_char = hr.lower() if _is_mini else hr if pad_char in font: cw = font[pad_char][0] @@ -191,7 +191,7 @@ def pprint(string, line=False, color="white", font=font_mini, _refresh=True, cle line_window.append("") line_window[lin] = string _draw_line(window, string, lin, _c, font, _is_mini, fh, offs, clear, block, shadow_color) - if _clearscreen and hr == "(": + if _clearscreen and hr is None: _clear_row_remainder(window, strlen(string, font), lin, fh, offs) else: line_window.append(string)