Skip to content

Commit

Permalink
wip line height
Browse files Browse the repository at this point in the history
  • Loading branch information
raphamorim committed Dec 22, 2024
1 parent 67e64ae commit c91087b
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions sugarloaf/src/components/rich_text/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -447,14 +447,16 @@ fn draw_layout(
}

let first_run = &line.render_data.runs[0];
let ascent = first_run.ascent.round();
let descent = first_run.descent.round();
let leading = (first_run.leading).round() * 2.;
// let ascent = first_run.ascent.round();
// let descent = first_run.descent.round();
// let leading = (first_run.leading).round() * 2.;
let mut px = x + 0.0;
let baseline = line_y + ascent;
line_y = baseline + descent;
// let baseline = line_y + ascent;
// line_y = baseline + descent;
line_y = line_y + rect.height;
let py = line_y;
let line_height = ascent + descent + leading;
// let line_height = ascent + descent + leading;
let line_height = rect.height;
for run in &line.render_data.runs {
glyphs.clear();
let font = run.span.font_id;
Expand All @@ -478,7 +480,7 @@ fn draw_layout(
cursor: run.span.cursor,
background_color: run.span.background_color,
baseline: py,
topline: py - ascent,
topline: py - rect.height,
line_height,
advance: px - run_x,
decoration: run.span.decoration,
Expand Down

0 comments on commit c91087b

Please sign in to comment.