diff options
Diffstat (limited to 'src/layout')
| -rw-r--r-- | src/layout/shaping.rs | 6 | ||||
| -rw-r--r-- | src/layout/tree.rs | 22 |
2 files changed, 14 insertions, 14 deletions
diff --git a/src/layout/shaping.rs b/src/layout/shaping.rs index 115a23e2..0f42d4bb 100644 --- a/src/layout/shaping.rs +++ b/src/layout/shaping.rs @@ -14,7 +14,7 @@ use crate::font::FontLoader; use crate::geom::Size; use crate::style::TextStyle; -/// Layouts text into a box. +/// Shape text into a box. pub async fn shape(text: &str, ctx: ShapeOptions<'_>) -> BoxLayout { Shaper::new(text, ctx).layout().await } @@ -115,11 +115,11 @@ impl<'a> Shaper<'a> { async fn select_font(&mut self, c: char) -> Option<(FaceId, GlyphId, f64)> { let mut variant = self.opts.style.variant; - if self.opts.style.bolder { + if self.opts.style.strong { variant.weight = variant.weight.thicken(300); } - if self.opts.style.italic { + if self.opts.style.emph { variant.style = match variant.style { FontStyle::Normal => FontStyle::Italic, FontStyle::Italic => FontStyle::Normal, diff --git a/src/layout/tree.rs b/src/layout/tree.rs index 14359b86..b43ef089 100644 --- a/src/layout/tree.rs +++ b/src/layout/tree.rs @@ -60,24 +60,24 @@ impl<'a> TreeLayouter<'a> { match &node.v { SynNode::Space => self.layout_space(), SynNode::Text(text) => { - if self.style.text.italic { - decorate(self, Decoration::Italic); + if self.style.text.emph { + decorate(self, Decoration::Emph); } - if self.style.text.bolder { - decorate(self, Decoration::Bold); + if self.style.text.strong { + decorate(self, Decoration::Strong); } self.layout_text(text).await; } SynNode::Linebreak => self.layouter.finish_line(), SynNode::Parbreak => self.layout_parbreak(), - SynNode::ToggleItalic => { - self.style.text.italic = !self.style.text.italic; - decorate(self, Decoration::Italic); + SynNode::Emph => { + self.style.text.emph = !self.style.text.emph; + decorate(self, Decoration::Emph); } - SynNode::ToggleBolder => { - self.style.text.bolder = !self.style.text.bolder; - decorate(self, Decoration::Bold); + SynNode::Strong => { + self.style.text.strong = !self.style.text.strong; + decorate(self, Decoration::Strong); } SynNode::Heading(heading) => self.layout_heading(heading).await, @@ -116,7 +116,7 @@ impl<'a> TreeLayouter<'a> { async fn layout_heading(&mut self, heading: &NodeHeading) { let style = self.style.text.clone(); self.style.text.font_scale *= 1.5 - 0.1 * heading.level.v as f64; - self.style.text.bolder = true; + self.style.text.strong = true; self.layout_parbreak(); self.layout_tree(&heading.contents).await; |
