diff --git a/src/text_render.rs b/src/text_render.rs index d1b4150..6f0cb47 100644 --- a/src/text_render.rs +++ b/src/text_render.rs @@ -73,10 +73,10 @@ impl TextRenderer { let bounds_max_y = text_area.bounds.bottom.min(resolution.height as i32); let is_run_visible = |run: &cosmic_text::LayoutRun| { - let start_y = (text_area.top + run.line_top) as i32; - let end_y = (text_area.top + run.line_top + run.line_height) as i32; - - start_y <= text_area.bounds.bottom && text_area.bounds.top <= end_y + let start_y_physical = (text_area.top + (run.line_top * text_area.scale)) as i32; + let end_y_physical = start_y_physical + (run.line_height * text_area.scale) as i32; + + start_y_physical <= text_area.bounds.bottom && text_area.bounds.top <= end_y_physical }; let layout_runs = text_area