Skip to content

Commit

Permalink
Upgrade stylo to 2024-11-01
Browse files Browse the repository at this point in the history
Signed-off-by: Nico Burns <[email protected]>
  • Loading branch information
nicoburns committed Nov 28, 2024
1 parent 90bdb41 commit 55ab0e3
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
10 changes: 5 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ license = "MIT OR Apache-2.0"

[workspace.dependencies]
# Servo dependencies
style = { version = "0.1", package = "stylo" }
style_config = { version = "0.1", package = "stylo_config" }
style_traits = { version = "0.1", package = "stylo_traits" }
style_dom = { version = "0.1", package = "stylo_dom" }
selectors = { version = "0.26", package = "stylo_selectors" }
style = { git = "https://github.com/servo/stylo", rev = "4eb9da3b639baab6b16a43b8512b5c11c087fc2c", package = "style" }
style_config = { git = "https://github.com/servo/stylo", rev = "4eb9da3b639baab6b16a43b8512b5c11c087fc2c", package = "style_config" }
style_traits = { git = "https://github.com/servo/stylo", rev = "4eb9da3b639baab6b16a43b8512b5c11c087fc2c", package = "style_traits" }
style_dom = { git = "https://github.com/servo/stylo", rev = "4eb9da3b639baab6b16a43b8512b5c11c087fc2c", package = "dom" }
selectors = { git = "https://github.com/servo/stylo", rev = "4eb9da3b639baab6b16a43b8512b5c11c087fc2c", package = "selectors" }
markup5ever = "0.14" # needs to match stylo markup5ever version
html5ever = "0.29" # needs to match stylo markup5ever version
xml5ever = "0.20" # needs to match stylo markup5ever version
Expand Down
10 changes: 9 additions & 1 deletion packages/blitz-dom/src/stylo_to_parley.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
//! Conversion functions from Stylo types to Parley types
use std::borrow::Cow;

use style::values::computed::Length;

use crate::node::TextBrush;
use crate::util::ToPenikoColor;

Expand Down Expand Up @@ -44,6 +46,12 @@ pub(crate) fn style(style: &stylo::ComputedValues) -> parley::TextStyle<'static,
// Parley expects line height as a multiple of font size!
let line_height = line_height / font_size;

let letter_spacing = itext_styles
.letter_spacing
.0
.resolve(Length::new(font_size))
.px();

// Convert Bold/Italic
let font_weight = parley::FontWeight::new(font_styles.font_weight.value());
let font_style = match font_styles.font_style {
Expand Down Expand Up @@ -122,6 +130,6 @@ pub(crate) fn style(style: &stylo::ComputedValues) -> parley::TextStyle<'static,
strikethrough_brush: decoration_brush,
line_height,
word_spacing: Default::default(),
letter_spacing: itext_styles.letter_spacing.0.px(),
letter_spacing,
}
}

0 comments on commit 55ab0e3

Please sign in to comment.