diff options
| author | Laurenz <laurmaedje@gmail.com> | 2024-05-07 15:20:30 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-05-07 13:20:30 +0000 |
| commit | 01b791da83ba63a84eab6c1a1e93bfe13fc5bdbb (patch) | |
| tree | 3dfda0bdeb899f5f1b7cb06283dfcaa03bfc681d /crates | |
| parent | 96b04a7e1a0f87056980a4f5683abb3682e09586 (diff) | |
Add region to `TextItem` (#4091)
Diffstat (limited to 'crates')
| -rw-r--r-- | crates/typst/src/layout/inline/shaping.rs | 4 | ||||
| -rw-r--r-- | crates/typst/src/math/fragment.rs | 5 | ||||
| -rw-r--r-- | crates/typst/src/text/font/color.rs | 1 | ||||
| -rw-r--r-- | crates/typst/src/text/item.rs | 4 |
4 files changed, 10 insertions, 4 deletions
diff --git a/crates/typst/src/layout/inline/shaping.rs b/crates/typst/src/layout/inline/shaping.rs index 82a33f9b..aa30688b 100644 --- a/crates/typst/src/layout/inline/shaping.rs +++ b/crates/typst/src/layout/inline/shaping.rs @@ -225,7 +225,6 @@ impl<'a> ShapedText<'a> { frame.set_baseline(top); let shift = TextElem::baseline_in(self.styles); - let lang = TextElem::lang_in(self.styles); let decos = TextElem::deco_in(self.styles); let fill = TextElem::fill_in(self.styles); let stroke = TextElem::stroke_in(self.styles); @@ -306,7 +305,8 @@ impl<'a> ShapedText<'a> { let item = TextItem { font, size: self.size, - lang, + lang: self.lang, + region: self.region, fill: fill.clone(), stroke: stroke.clone().map(|s| s.unwrap_or_default()), text: self.text[range.start - self.base..range.end - self.base].into(), diff --git a/crates/typst/src/math/fragment.rs b/crates/typst/src/math/fragment.rs index c5396654..084a1241 100644 --- a/crates/typst/src/math/fragment.rs +++ b/crates/typst/src/math/fragment.rs @@ -12,7 +12,7 @@ use crate::math::{ scaled_font_size, EquationElem, Limits, MathContext, MathSize, Scaled, }; use crate::syntax::Span; -use crate::text::{Font, Glyph, Lang, TextElem, TextItem}; +use crate::text::{Font, Glyph, Lang, Region, TextElem, TextItem}; use crate::visualize::Paint; #[derive(Debug, Clone)] @@ -206,6 +206,7 @@ pub struct GlyphFragment { pub c: char, pub font: Font, pub lang: Lang, + pub region: Option<Region>, pub fill: Paint, pub shift: Abs, pub width: Abs, @@ -259,6 +260,7 @@ impl GlyphFragment { c, font: ctx.font.clone(), lang: TextElem::lang_in(styles), + region: TextElem::region_in(styles), fill: TextElem::fill_in(styles).as_decoration(), shift: TextElem::baseline_in(styles), font_size: scaled_font_size(ctx, styles), @@ -340,6 +342,7 @@ impl GlyphFragment { size: self.font_size, fill: self.fill, lang: self.lang, + region: self.region, text: self.c.into(), stroke: None, glyphs: vec