gpui: Expose ShapedLine::width() for pen advancement

This commit is contained in:
Nathan Sobo
2025-12-25 07:47:23 -07:00
parent 47df9d22a0
commit c8b363f4b0

View File

@@ -44,6 +44,14 @@ impl ShapedLine {
self.layout.len
}
/// The width of the shaped line in pixels.
///
/// This is the glyph advance width computed by the text shaping system and is useful for
/// incrementally advancing a "pen" when painting multiple fragments on the same row.
pub fn width(&self) -> Pixels {
self.layout.width
}
/// Override the len, useful if you're rendering text a
/// as text b (e.g. rendering invisibles).
pub fn with_len(mut self, len: usize) -> Self {