Skip to content
Permalink
Browse files

Support line_height better in layout 2020

  • Loading branch information
nox committed Nov 22, 2019
1 parent b3d30d2 commit 85b2a4dc6466cc2136f0caa5867803dcee253c8a
Showing with 6 additions and 4 deletions.
  1. +6 −4 components/layout_2020/flow/inline.rs
@@ -292,6 +292,7 @@ impl TextRun {
use gfx::font::{ShapingFlags, ShapingOptions};
use style::computed_values::text_rendering::T as TextRendering;
use style::computed_values::word_break::T as WordBreak;
use style::values::generics::text::LineHeight;

let font_style = self.parent_style.clone_font();
let inherited_text_style = self.parent_style.get_inherited_text();
@@ -375,10 +376,11 @@ impl TextRun {
break;
}
}
// https://www.w3.org/TR/CSS2/visudet.html#propdef-line-height
// 'normal':
// “set the used value to a "reasonable" value based on the font of the element.”
let line_height = font_size * 1.2;
let line_height = match self.parent_style.get_inherited_text().line_height {
LineHeight::Normal => font_line_gap.into(),
LineHeight::Number(n) => font_size * n.0,
LineHeight::Length(l) => l.0,
};
let content_rect = Rect {
start_corner: Vec2 {
block: Length::zero(),

0 comments on commit 85b2a4d

Please sign in to comment.
You can’t perform that action at this time.