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:
co-authored by
Nathan Sobo
parent
0187ac8fde
commit
91c2b5825e
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user