Skip to content

Commit

Permalink
Use default metrics for empty lines, fixes #258
Browse files Browse the repository at this point in the history
  • Loading branch information
jackpot51 committed Jun 7, 2024
1 parent 21e88eb commit 6eb67bb
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/shape.rs
Original file line number Diff line number Diff line change
Expand Up @@ -741,6 +741,7 @@ impl ShapeSpan {
pub struct ShapeLine {
pub rtl: bool,
pub spans: Vec<ShapeSpan>,
pub metrics_opt: Option<Metrics>,
}

// Visual Line Ranges: (span_index, (first_word_index, first_glyph_index), (last_word_index, last_glyph_index))
Expand Down Expand Up @@ -843,7 +844,11 @@ impl ShapeLine {
));
}

Self { rtl, spans }
Self {
rtl,
spans,
metrics_opt: attrs_list.defaults().metrics_opt.map(|x| x.into()),
}
}

// A modified version of first part of unicode_bidi::bidi_info::visual_run
Expand Down Expand Up @@ -1484,7 +1489,7 @@ impl ShapeLine {
w: 0.0,
max_ascent: 0.0,
max_descent: 0.0,
line_height_opt: None,
line_height_opt: self.metrics_opt.map(|x| x.line_height),
glyphs: Default::default(),
});
}
Expand Down

0 comments on commit 6eb67bb

Please sign in to comment.