@@ -33,7 +33,7 @@ program fortty |
| 33 | 33 | integer :: response_len |
| 34 | 34 | real :: x, y, r, g, b, bg_r, bg_g, bg_b |
| 35 | 35 | type(cell_t), allocatable :: sb_line(:) |
| 36 | | - integer :: cell_width, cell_height ! From font metrics |
| 36 | + integer :: cell_width, cell_height, ascender ! From font metrics |
| 37 | 37 | real(8) :: current_time, last_time, blink_timer |
| 38 | 38 | logical :: cursor_blink_visible |
| 39 | 39 | type(selection_t) :: sel |
@@ -173,9 +173,11 @@ program fortty |
| 173 | 173 | ! Get cell dimensions from font metrics |
| 174 | 174 | cell_width = ren%font%cell_width |
| 175 | 175 | cell_height = ren%font%cell_height |
| 176 | + ascender = ren%font%ascender |
| 176 | 177 | if (cell_width < 1) cell_width = 10 ! Fallback |
| 177 | 178 | if (cell_height < 1) cell_height = 18 ! Fallback |
| 178 | | - print *, "Font cell size:", cell_width, "x", cell_height |
| 179 | + if (ascender < 1) ascender = cell_height - 4 ! Fallback estimate |
| 180 | + print *, "Font cell size:", cell_width, "x", cell_height, " ascender:", ascender |
| 179 | 181 | |
| 180 | 182 | ! Share cell dimensions with window module for mouse selection |
| 181 | 183 | call window_set_cell_size(cell_width, cell_height) |
@@ -317,8 +319,8 @@ program fortty |
| 317 | 319 | r = real(cell%fg%r) / 255.0 |
| 318 | 320 | g = real(cell%fg%g) / 255.0 |
| 319 | 321 | b = real(cell%fg%b) / 255.0 |
| 320 | | - ! Text baseline is at cell bottom; add cell_height to position correctly |
| 321 | | - call renderer_draw_char(ren, x, y + real(cell_height), cell%codepoint, r, g, b, 1.0) |
| 322 | + ! Baseline is at y + ascender (not cell bottom - descenders need room below) |
| 323 | + call renderer_draw_char(ren, x, y + real(ascender), cell%codepoint, r, g, b, 1.0) |
| 322 | 324 | end if |
| 323 | 325 | end do |
| 324 | 326 | else |
@@ -344,8 +346,8 @@ program fortty |
| 344 | 346 | r = real(cell%fg%r) / 255.0 |
| 345 | 347 | g = real(cell%fg%g) / 255.0 |
| 346 | 348 | b = real(cell%fg%b) / 255.0 |
| 347 | | - ! Text baseline is at cell bottom; add cell_height to position correctly |
| 348 | | - call renderer_draw_char(ren, x, y + real(cell_height), cell%codepoint, r, g, b, 1.0) |
| 349 | + ! Baseline is at y + ascender (consistent with scrollback rendering) |
| 350 | + call renderer_draw_char(ren, x, y + real(ascender), cell%codepoint, r, g, b, 1.0) |
| 349 | 351 | end if |
| 350 | 352 | end do |
| 351 | 353 | end if |
@@ -361,15 +363,15 @@ program fortty |
| 361 | 363 | |
| 362 | 364 | select case (term%cursor%style) |
| 363 | 365 | case (CURSOR_BLOCK) |
| 364 | | - ! Filled block cursor |
| 366 | + ! Filled block cursor - cover the full cell |
| 365 | 367 | call renderer_draw_rect(ren, x, y, real(cell_width), real(cell_height), & |
| 366 | 368 | 0.7, 0.7, 0.7, 0.8) |
| 367 | 369 | case (CURSOR_UNDERLINE) |
| 368 | | - ! Underline at bottom of cell |
| 369 | | - call renderer_draw_rect(ren, x, y + real(cell_height) - 2.0, & |
| 370 | + ! Underline at the baseline position (y + ascender) |
| 371 | + call renderer_draw_rect(ren, x, y + real(ascender), & |
| 370 | 372 | real(cell_width), 2.0, 0.7, 0.7, 0.7, 1.0) |
| 371 | 373 | case (CURSOR_BAR) |
| 372 | | - ! Vertical bar at left of cell |
| 374 | + ! Vertical bar at left of cell - full cell height |
| 373 | 375 | call renderer_draw_rect(ren, x, y, 2.0, real(cell_height), 0.7, 0.7, 0.7, 1.0) |
| 374 | 376 | case default |
| 375 | 377 | ! Fallback to block |