diff options
| author | Laurenz <laurmaedje@gmail.com> | 2021-04-21 21:17:25 +0200 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2021-04-21 21:17:25 +0200 |
| commit | 72478946c261f04754c11f8a6abf6eb0f43dea31 (patch) | |
| tree | b2a621804d39ace4e57ec4a51b34d40bb4a98987 /src/layout/shaping.rs | |
| parent | df58a4d89b67783b1ffc5c3b7282302d59db8c70 (diff) | |
Make frames serializable 📚
This also makes serialization support non-optional since it's too much feature-management for too little benefit.
Diffstat (limited to 'src/layout/shaping.rs')
| -rw-r--r-- | src/layout/shaping.rs | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/layout/shaping.rs b/src/layout/shaping.rs index faa178d3..47d19a62 100644 --- a/src/layout/shaping.rs +++ b/src/layout/shaping.rs @@ -18,6 +18,7 @@ use crate::util::SliceExt; /// This type contains owned or borrowed shaped text runs, which can be /// measured, used to reshape substrings more quickly and converted into a /// frame. +#[derive(Clone)] pub struct ShapedText<'a> { /// The text that was shaped. pub text: &'a str, @@ -53,6 +54,7 @@ pub struct ShapedGlyph { } /// A visual side. +#[derive(Debug, Copy, Clone, Eq, PartialEq)] enum Side { Left, Right, @@ -77,7 +79,11 @@ impl<'a> ShapedText<'a> { for glyph in group { let x_advance = face.convert(glyph.x_advance).scale(self.props.size); let x_offset = face.convert(glyph.x_offset).scale(self.props.size); - text.glyphs.push(Glyph { id: glyph.glyph_id, x_advance, x_offset }); + text.glyphs.push(Glyph { + id: glyph.glyph_id.0, + x_advance, + x_offset, + }); offset += x_advance; } |
