You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
cosmic-text version: 0.11.2
System info: Ubuntu 22.04, GNOME on Wayland
Hello! I'm an engineer working on Warp terminal, which uses cosmic-text for text layout on Linux. While working on custom prompt support, I noticed the layout_to_buffer function produces lines that overflow the buffer width when given bidirectional text.
I added a test with mixed English and Arabic text to tests/wrap_stability.rs that reproduces the issue on this branch. Here's the snippet:
#[test]fnwrap_bidirectional(){letmut font_system = FontSystem::new();let font_size = 14.0;let line_height = 20.0;let buffer_width = 80.0;let metrics = Metrics::new(font_size, line_height);letmut plain_buffer = Buffer::new(&mut font_system, metrics);letmut buffer = plain_buffer.borrow_with(&mut font_system);// Add some text
buffer.set_wrap(Wrap::WordOrGlyph);
buffer.set_text("breakfast, إفطار, lunch (غداء) and dinner - عشاء",Attrs::new().family(cosmic_text::Family::Name("Inter")),Shaping::Advanced);// Set a size for the text buffer, in pixels
buffer.set_size(buffer_width,1000.0);let layout_line = buffer.line_layout(0).unwrap().first().unwrap();assert!(layout_line.w <= buffer_width, "layout line width ({}) was greater than buffer width ({})", layout_line.w, buffer_width);}
When run, the above test fails with:
thread 'wrap_bidirectional' panicked at tests/wrap_stability.rs:135:5:
layout line width (97.90201) was greater than buffer width (80)
In Warp, this issue becomes visible when editing mixed-direction text in the input editor. Here's a screenshot with the same text from the test above, where the first Arabic word is cut off:
I haven't seen this issue with left-to-right text, only mixed text directions, but it could be related to #219. Is this a known bug? Thank you in advance for your help!
The text was updated successfully, but these errors were encountered:
cosmic-text
version: 0.11.2System info: Ubuntu 22.04, GNOME on Wayland
Hello! I'm an engineer working on Warp terminal, which uses
cosmic-text
for text layout on Linux. While working on custom prompt support, I noticed thelayout_to_buffer
function produces lines that overflow the buffer width when given bidirectional text.I added a test with mixed English and Arabic text to
tests/wrap_stability.rs
that reproduces the issue on this branch. Here's the snippet:When run, the above test fails with:
In Warp, this issue becomes visible when editing mixed-direction text in the input editor. Here's a screenshot with the same text from the test above, where the first Arabic word is cut off:
I haven't seen this issue with left-to-right text, only mixed text directions, but it could be related to #219. Is this a known bug? Thank you in advance for your help!
The text was updated successfully, but these errors were encountered: