Skip to content
Open
Show file tree
Hide file tree
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
7 changes: 6 additions & 1 deletion TeXmacs/progs/generic/document-edit.scm
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,12 @@
(with old (get-init-tree s)
(if (and (tree-func? old 'macro 1) (not (tm-is? val 'macro)))
(init-env-tree s `(macro ,val))
(init-env-tree s val))))
(init-env-tree s (if (and (string? s) (string? val) (== s "font-base-size"))
(with num (string->number val)
(if (number? num)
(number->string (/ (round (* num 2)) 2))
val))
val)))))

(tm-define (init-interactive-env var)
(:interactive #t)
Expand Down
31 changes: 31 additions & 0 deletions devel/222_46.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# 222_46: Fix font size display in status bar and font size input


### How to Test
Enter a decimal font size in the font size input field and check if the font size is displayed correctly in the status bar.
(multiple of 0.5)


### Issue #2808 :
Decimal font sizes were not displayed correctly in the status bar and font size input.

### What
To fix, modified the font size input and status bar to display correct decimal font sizes.

**Changes made:**

1. **TeXmacs/progs/generic/document-edit.scm**: Modified `set-init-env` function to automatically round font-base-size inputs to the nearest 0.5 (e.g., 10.3 → 10.5, 10.7 → 10.5). Added type safety checks to ensure only valid string inputs are processed.

2. **src/Edit/Interface/edit_footer.cpp**:
- Changed `get_env_int(FONT_BASE_SIZE)` to `get_env_double(FONT_BASE_SIZE)` to preserve decimal values
- Removed integer casting `(int)((base_sz + 0.5) * sz)` and replaced with direct decimal display `base_sz * sz`

### Why

This fixes both issues at their source:
- Input validation ensures all font sizes are properly rounded when set
- Display changes preserve and show the decimal values correctly
- Both top and bottom bars now show identical, correctly rounded font sizes

* Author: Lakshy
* Date: 27-02-2026
8 changes: 4 additions & 4 deletions src/Edit/Interface/edit_footer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ edit_interface_rep::append_left_footer (tree& l, string env_var) {
void
edit_interface_rep::set_left_footer () {
tree s = concat ();
double base_sz= get_env_int (FONT_BASE_SIZE);
double base_sz= get_env_double (FONT_BASE_SIZE);
double sz = get_env_double (FONT_SIZE);
/*
tree the_style= get_style ();
Expand All @@ -55,14 +55,14 @@ edit_interface_rep::set_left_footer () {
if ((mode == "text") || (mode == "src")) {
s << tree (" ") << verbatim (main_family (get_env_string (FONT)));
append_left_footer (s, FONT_FAMILY);
s << tree (" ") << as_string ((int) ((base_sz + 0.5) * sz));
s << tree (" ") << as_string (base_sz * sz);
append_left_footer (s, FONT_SERIES);
append_left_footer (s, FONT_SHAPE);
}
else if (mode == "math") {
s << tree (" ") << verbatim (get_env_string (MATH_FONT));
append_left_footer (s, MATH_FONT_FAMILY);
s << " " << as_string ((int) ((base_sz + 0.5) * sz));
s << " " << as_string (base_sz * sz);
append_left_footer (s, MATH_FONT_SERIES);
append_left_footer (s, MATH_FONT_SHAPE);
}
Expand All @@ -71,7 +71,7 @@ edit_interface_rep::set_left_footer () {
if (session_name != "default") s << "-" << session_name;
s << tree (" ") << verbatim (get_env_string (PROG_FONT));
append_left_footer (s, PROG_FONT_FAMILY);
s << " " << as_string ((int) ((base_sz + 0.5) * sz));
s << " " << as_string (base_sz * sz);
append_left_footer (s, PROG_FONT_SERIES);
append_left_footer (s, PROG_FONT_SHAPE);
}
Expand Down