Add LineWrapper::wrap_shaped_line

This allows us to perform wrapping based on
glyph positions in an already-shaped line. We
plan to use this in the new Text element,
because there we'll already need to do text
shaping as part of layout. This text isn't editable
so it won't need to be rewrapped with the same
frequency as the text editor's content.

Co-Authored-By: Nathan Sobo <nathan@zed.dev>
This commit is contained in:
Max Brunsfeld
2021-08-24 18:09:36 -07:00
co-authored by Nathan Sobo
parent 0187ac8fde
commit 91c2b5825e
2 changed files with 150 additions and 3 deletions
+10
View File
@@ -170,6 +170,10 @@ impl Line {
Self { layout, color_runs }
}
pub fn runs(&self) -> &[Run] {
&self.layout.runs
}
pub fn width(&self) -> f32 {
self.layout.width
}
@@ -245,3 +249,9 @@ impl Line {
}
}
}
impl Run {
pub fn glyphs(&self) -> &[Glyph] {
&self.glyphs
}
}