iced-rs / iced

A cross-platform GUI library for Rust, inspired by Elm
https://iced.rs
MIT License
24.92k stars 1.18k forks source link

Crash with Arabic text in PickList #1981

Open mtkennerly opened 1 year ago

mtkennerly commented 1 year ago

Is there an existing issue for this?

Is this issue related to iced?

What happened?

I've run into a couple of issues with Arabic text. In a column, it just doesn't show up, and inside of a PickList, it causes a crash.

I did see https://github.com/iced-rs/iced/issues/250 and https://github.com/iced-rs/iced/issues/1877, but the latter shows an example of Arabic text at least partially working, so I'm not sure what changed since then. The crash is attributed to Glyphon, so maybe it's related to a change in that crate?

Here's a diff based on 50ce65b3b7ad10a8537b751b3890d9dcfaecf846 to demonstrate the issue (invisible text in counter example and crash in pick_list example):

diff --git a/examples/counter/src/main.rs b/examples/counter/src/main.rs
index 13dcbf86..0cc7d9f7 100644
--- a/examples/counter/src/main.rs
+++ b/examples/counter/src/main.rs
@@ -41,7 +41,8 @@ impl Sandbox for Counter {
         column![
             button("Increment").on_press(Message::IncrementPressed),
             text(self.value).size(50),
-            button("Decrement").on_press(Message::DecrementPressed)
+            button("Decrement").on_press(Message::DecrementPressed),
+            text("العربية").shaping(text::Shaping::Advanced),
         ]
         .padding(20)
         .align_items(Alignment::Center)
diff --git a/examples/pick_list/src/main.rs b/examples/pick_list/src/main.rs
index 21200621..3fb064cc 100644
--- a/examples/pick_list/src/main.rs
+++ b/examples/pick_list/src/main.rs
@@ -1,4 +1,4 @@
-use iced::widget::{column, container, pick_list, scrollable, vertical_space};
+use iced::widget::{column, container, pick_list, scrollable, text, vertical_space};
 use iced::{Alignment, Element, Length, Sandbox, Settings};

 pub fn main() -> iced::Result {
@@ -40,6 +40,7 @@ impl Sandbox for Example {
             self.selected_language,
             Message::LanguageSelected,
         )
+        .text_shaping(text::Shaping::Advanced)
         .placeholder("Choose a language...");

         let content = column![
@@ -97,7 +98,7 @@ impl std::fmt::Display for Language {
                 Language::Haskell => "Haskell",
                 Language::C => "C",
                 Language::Javascript => "Javascript",
-                Language::Other => "Some other language",
+                Language::Other => "العربية",
             }
         )
     }

What is the expected behavior?

Visible text and no crash.

Version

crates.io release

Operating System

Windows

Do you have any log output?

thread 'main' panicked at 'attempt to add with overflow', C:\Users\mtken\.cargo\registry\src\index.crates.io-6f17d22bba15001f\glyphon-0.3.0\src\text_render.rs:206:33
stack backtrace:
   0:     0x7ff6977e828c - std::sys_common::backtrace::_print::impl$0::fmt
                               at /rustc/8ede3aae28fe6e4d52b38157d7bfe0d3bceef225/library\std\src\sys_common\backtrace.rs:44
   1:     0x7ff697801cdb - core::fmt::rt::Argument::fmt
                               at /rustc/8ede3aae28fe6e4d52b38157d7bfe0d3bceef225/library\core\src\fmt\rt.rs:138
   2:     0x7ff697801cdb - core::fmt::write
                               at /rustc/8ede3aae28fe6e4d52b38157d7bfe0d3bceef225/library\core\src\fmt\mod.rs:1094
   3:     0x7ff6977e4699 - std::io::Write::write_fmt<std::sys::windows::stdio::Stderr>
                               at /rustc/8ede3aae28fe6e4d52b38157d7bfe0d3bceef225/library\std\src\io\mod.rs:1713
   4:     0x7ff6977e803b - std::sys_common::backtrace::_print
                               at /rustc/8ede3aae28fe6e4d52b38157d7bfe0d3bceef225/library\std\src\sys_common\backtrace.rs:47
   5:     0x7ff6977e803b - std::sys_common::backtrace::print
                               at /rustc/8ede3aae28fe6e4d52b38157d7bfe0d3bceef225/library\std\src\sys_common\backtrace.rs:34
   6:     0x7ff6977ea849 - std::panicking::default_hook::closure$1
                               at /rustc/8ede3aae28fe6e4d52b38157d7bfe0d3bceef225/library\std\src\panicking.rs:269
   7:     0x7ff6977ea4ff - std::panicking::default_hook
                               at /rustc/8ede3aae28fe6e4d52b38157d7bfe0d3bceef225/library\std\src\panicking.rs:288
   8:     0x7ff6977ead4e - std::panicking::rust_panic_with_hook
                               at /rustc/8ede3aae28fe6e4d52b38157d7bfe0d3bceef225/library\std\src\panicking.rs:705
   9:     0x7ff6977eabfa - std::panicking::begin_panic_handler::closure$0
                               at /rustc/8ede3aae28fe6e4d52b38157d7bfe0d3bceef225/library\std\src\panicking.rs:595
  10:     0x7ff6977e8c09 - std::sys_common::backtrace::__rust_end_short_backtrace<std::panicking::begin_panic_handler::closure_env$0,never$>
                               at /rustc/8ede3aae28fe6e4d52b38157d7bfe0d3bceef225/library\std\src\sys_common\backtrace.rs:151
  11:     0x7ff6977ea940 - std::panicking::begin_panic_handler
                               at /rustc/8ede3aae28fe6e4d52b38157d7bfe0d3bceef225/library\std\src\panicking.rs:593
  12:     0x7ff69780bdf5 - core::panicking::panic_fmt
                               at /rustc/8ede3aae28fe6e4d52b38157d7bfe0d3bceef225/library\core\src\panicking.rs:67
  13:     0x7ff69780bea2 - core::panicking::panic
                               at /rustc/8ede3aae28fe6e4d52b38157d7bfe0d3bceef225/library\core\src\panicking.rs:117
  14:     0x7ff69686b8f9 - glyphon::text_render::TextRenderer::prepare_with_depth<core::iter::adapters::filter_map::FilterMap<core::iter::adapters::zip::Zip<core::slice::iter::Iter<iced_wgpu::layer::text::Text>,core::slice::iter::Iter<u64> >,iced_wgpu::text::impl$0::prepare::closur
                               at C:\Users\mtken\.cargo\registry\src\index.crates.io-6f17d22bba15001f\glyphon-0.3.0\src\text_render.rs:206
  15:     0x7ff69686c8e7 - glyphon::text_render::TextRenderer::prepare<core::iter::adapters::filter_map::FilterMap<core::iter::adapters::zip::Zip<core::slice::iter::Iter<iced_wgpu::layer::text::Text>,core::slice::iter::Iter<u64> >,iced_wgpu::text::impl$0::prepare::closure_env$1> >
                               at C:\Users\mtken\.cargo\registry\src\index.crates.io-6f17d22bba15001f\glyphon-0.3.0\src\text_render.rs:366
  16:     0x7ff6968579dd - iced_wgpu::text::Pipeline::prepare
                               at C:\git\_forks\iced\wgpu\src\text.rs:175
  17:     0x7ff6968550f8 - iced_wgpu::backend::Backend::prepare
                               at C:\git\_forks\iced\wgpu\src\backend.rs:177
  18:     0x7ff6967e5c2f - iced_wgpu::backend::Backend::present<alloc::string::String>
                               at C:\git\_forks\iced\wgpu\src\backend.rs:92
  19:     0x7ff6967d9c98 - iced_wgpu::window::compositor::present<enum2$<iced_style::theme::Theme>,alloc::string::String>
                               at C:\git\_forks\iced\wgpu\src\window\compositor.rs:176
  20:     0x7ff696766fe9 - iced_renderer::compositor::impl$0::present::closure$1<enum2$<iced_style::theme::Theme>,alloc::string::String>
                               at C:\git\_forks\iced\renderer\src\compositor.rs:124
  21:     0x7ff6967e0836 - iced_graphics::renderer::Renderer<iced_wgpu::backend::Backend,enum2$<iced_style::theme::Theme> >::with_primitives<iced_wgpu::backend::Backend,enum2$<iced_style::theme::Theme>,enum2$<core::result::Result<tuple$<>,iced_graphics::compositor::SurfaceError> >,
                               at C:\git\_forks\iced\graphics\src\renderer.rs:51
  22:     0x7ff696766eb2 - iced_renderer::compositor::impl$0::present<enum2$<iced_style::theme::Theme>,alloc::string::String>
                               at C:\git\_forks\iced\renderer\src\compositor.rs:123
  23:     0x7ff6967aca49 - iced_winit::application::run_instance::async_fn$0<iced::application::Instance<pick_list::Example>,iced_futures::backend::null::Executor,enum2$<iced_renderer::compositor::Compositor<enum2$<iced_style::theme::Theme> > > >
                               at C:\git\_forks\iced\winit\src\application.rs:534
  24:     0x7ff6967afb86 - iced_winit::application::run::closure$1<iced::application::Instance<pick_list::Example>,iced_futures::backend::null::Executor,enum2$<iced_renderer::compositor::Compositor<enum2$<iced_style::theme::Theme> > > >
                               at C:\git\_forks\iced\winit\src\application.rs:251
  25:     0x7ff6967b2577 - winit::platform_impl::platform::event_loop::impl$3::run_return::closure$0<enum2$<pick_list::Message>,iced_winit::application::run::closure_env$1<iced::application::Instance<pick_list::Example>,iced_futures::backend::null::Executor,enum2$<iced_renderer::co
                               at C:\Users\mtken\.cargo\git\checkouts\winit-57d3141eaf559308\c52db20\src\platform_impl\windows\event_loop.rs:260
  26:     0x7ff69677304f - alloc::boxed::impl$48::call_mut<tuple$<enum2$<winit::event::Event<enum2$<pick_list::Message> > >,ref_mut$<enum2$<winit::event_loop::ControlFlow> > >,dyn$<core::ops::function::FnMut<tuple$<enum2$<winit::event::Event<enum2$<pick_list::Message> > >,ref_mut$<
                               at /rustc/8ede3aae28fe6e4d52b38157d7bfe0d3bceef225\library\alloc\src\boxed.rs:1992
  27:     0x7ff69677c752 - winit::platform_impl::platform::event_loop::runner::impl$3::call_event_handler::closure$0<enum2$<pick_list::Message> >
                               at C:\Users\mtken\.cargo\git\checkouts\winit-57d3141eaf559308\c52db20\src\platform_impl\windows\event_loop\runner.rs:250
  28:     0x7ff696771fa4 - core::panic::unwind_safe::impl$23::call_once<tuple$<>,winit::platform_impl::platform::event_loop::runner::impl$3::call_event_handler::closure_env$0<enum2$<pick_list::Message> > >
                               at /rustc/8ede3aae28fe6e4d52b38157d7bfe0d3bceef225\library\core\src\panic\unwind_safe.rs:271
  29:     0x7ff6967b0e09 - std::panicking::try::do_call<core::panic::unwind_safe::AssertUnwindSafe<winit::platform_impl::platform::event_loop::runner::impl$3::call_event_handler::closure_env$0<enum2$<pick_list::Message> > >,tuple$<> >
                               at /rustc/8ede3aae28fe6e4d52b38157d7bfe0d3bceef225\library\std\src\panicking.rs:500
  30:     0x7ff6967b1283 - std::panicking::try::do_catch<core::panic::unwind_safe::AssertUnwindSafe<winit::platform_impl::platform::event_loop::public_window_callback_inner::closure_env$0<enum2$<pick_list::Message> > >,isize>
  31:     0x7ff6967b0c8a - std::panicking::try<tuple$<>,core::panic::unwind_safe::AssertUnwindSafe<winit::platform_impl::platform::event_loop::runner::impl$3::call_event_handler::closure_env$0<enum2$<pick_list::Message> > > >
                               at /rustc/8ede3aae28fe6e4d52b38157d7bfe0d3bceef225\library\std\src\panicking.rs:464
  32:     0x7ff6967a8829 - std::panic::catch_unwind<core::panic::unwind_safe::AssertUnwindSafe<winit::platform_impl::platform::event_loop::runner::impl$3::call_event_handler::closure_env$0<enum2$<pick_list::Message> > >,tuple$<> >
                               at /rustc/8ede3aae28fe6e4d52b38157d7bfe0d3bceef225\library\std\src\panic.rs:142
  33:     0x7ff69677b224 - winit::platform_impl::platform::event_loop::runner::EventLoopRunner<enum2$<pick_list::Message> >::catch_unwind<enum2$<pick_list::Message>,tuple$<>,winit::platform_impl::platform::event_loop::runner::impl$3::call_event_handler::closure_env$0<enum2$<pick_li
                               at C:\Users\mtken\.cargo\git\checkouts\winit-57d3141eaf559308\c52db20\src\platform_impl\windows\event_loop\runner.rs:157
  34:     0x7ff69677c518 - winit::platform_impl::platform::event_loop::runner::EventLoopRunner<enum2$<pick_list::Message> >::call_event_handler<enum2$<pick_list::Message> >
                               at C:\Users\mtken\.cargo\git\checkouts\winit-57d3141eaf559308\c52db20\src\platform_impl\windows\event_loop\runner.rs:242
  35:     0x7ff69677a4bd - winit::platform_impl::platform::event_loop::runner::EventLoopRunner<enum2$<pick_list::Message> >::send_event<enum2$<pick_list::Message> >
                               at C:\Users\mtken\.cargo\git\checkouts\winit-57d3141eaf559308\c52db20\src\platform_impl\windows\event_loop\runner.rs:215
  36:     0x7ff6967b2ab7 - winit::platform_impl::platform::event_loop::WindowData<enum2$<pick_list::Message> >::send_event<enum2$<pick_list::Message> >
                               at C:\Users\mtken\.cargo\git\checkouts\winit-57d3141eaf559308\c52db20\src\platform_impl\windows\event_loop.rs:142
  37:     0x7ff6967bb2e9 - winit::platform_impl::platform::event_loop::public_window_callback_inner::closure$0<enum2$<pick_list::Message> >
                               at C:\Users\mtken\.cargo\git\checkouts\winit-57d3141eaf559308\c52db20\src\platform_impl\windows\event_loop.rs:1125
  38:     0x7ff69677f177 - core::ops::function::FnOnce::call_once<winit::platform_impl::platform::event_loop::public_window_callback_inner::closure_env$0<enum2$<pick_list::Message> >,tuple$<> >
                               at /rustc/8ede3aae28fe6e4d52b38157d7bfe0d3bceef225\library\core\src\ops\function.rs:250
  39:     0x7ff696771f71 - core::panic::unwind_safe::impl$23::call_once<isize,winit::platform_impl::platform::event_loop::public_window_callback_inner::closure_env$0<enum2$<pick_list::Message> > >
                               at /rustc/8ede3aae28fe6e4d52b38157d7bfe0d3bceef225\library\core\src\panic\unwind_safe.rs:271
  40:     0x7ff6967b0d92 - std::panicking::try::do_call<core::panic::unwind_safe::AssertUnwindSafe<winit::platform_impl::platform::event_loop::public_window_callback_inner::closure_env$0<enum2$<pick_list::Message> > >,isize>
                               at /rustc/8ede3aae28fe6e4d52b38157d7bfe0d3bceef225\library\std\src\panicking.rs:500
  41:     0x7ff6967b1283 - std::panicking::try::do_catch<core::panic::unwind_safe::AssertUnwindSafe<winit::platform_impl::platform::event_loop::public_window_callback_inner::closure_env$0<enum2$<pick_list::Message> > >,isize>
  42:     0x7ff6967b0bcb - std::panicking::try<isize,core::panic::unwind_safe::AssertUnwindSafe<winit::platform_impl::platform::event_loop::public_window_callback_inner::closure_env$0<enum2$<pick_list::Message> > > >
                               at /rustc/8ede3aae28fe6e4d52b38157d7bfe0d3bceef225\library\std\src\panicking.rs:464
  43:     0x7ff6967a8841 - std::panic::catch_unwind<core::panic::unwind_safe::AssertUnwindSafe<winit::platform_impl::platform::event_loop::public_window_callback_inner::closure_env$0<enum2$<pick_list::Message> > >,isize>
                               at /rustc/8ede3aae28fe6e4d52b38157d7bfe0d3bceef225\library\std\src\panic.rs:142
  44:     0x7ff69677a6f5 - winit::platform_impl::platform::event_loop::runner::EventLoopRunner<enum2$<pick_list::Message> >::catch_unwind<enum2$<pick_list::Message>,isize,winit::platform_impl::platform::event_loop::public_window_callback_inner::closure_env$0<enum2$<pick_list::Messa
                               at C:\Users\mtken\.cargo\git\checkouts\winit-57d3141eaf559308\c52db20\src\platform_impl\windows\event_loop\runner.rs:157
  45:     0x7ff6967b48ab - winit::platform_impl::platform::event_loop::public_window_callback_inner<enum2$<pick_list::Message> >
                               at C:\Users\mtken\.cargo\git\checkouts\winit-57d3141eaf559308\c52db20\src\platform_impl\windows\event_loop.rs:2320
  46:     0x7ff6967b3009 - winit::platform_impl::platform::event_loop::public_window_callback<enum2$<pick_list::Message> >
                               at C:\Users\mtken\.cargo\git\checkouts\winit-57d3141eaf559308\c52db20\src\platform_impl\windows\event_loop.rs:994
  47:     0x7ff973a78211 - DispatchMessageW
  48:     0x7ff973a77a5b - CallWindowProcW
  49:     0x7ff926b41d74 - wglSwapBuffers
  50:     0x7ff973a78211 - DispatchMessageW
  51:     0x7ff973a77ecc - DispatchMessageW
  52:     0x7ff973a82ffd - GetClassLongW
  53:     0x7ff974272d94 - KiUserCallbackDispatcher
  54:     0x7ff971bb1ad4 - NtUserDispatchMessage
  55:     0x7ff973a77db4 - DispatchMessageW
  56:     0x7ff6967b2d1f - winit::platform_impl::platform::event_loop::flush_paint_messages::closure$0<enum2$<pick_list::Message> >
                               at C:\Users\mtken\.cargo\git\checkouts\winit-57d3141eaf559308\c52db20\src\platform_impl\windows\event_loop.rs:824
  57:     0x7ff69677bcad - winit::platform_impl::platform::event_loop::runner::EventLoopRunner<enum2$<pick_list::Message> >::owned_windows<enum2$<pick_list::Message>,winit::platform_impl::platform::event_loop::flush_paint_messages::closure_env$0<enum2$<pick_list::Message> > >
                               at C:\Users\mtken\.cargo\git\checkouts\winit-57d3141eaf559308\c52db20\src\platform_impl\windows\event_loop\runner.rs:195
  58:     0x7ff6967b2c58 - winit::platform_impl::platform::event_loop::flush_paint_messages<enum2$<pick_list::Message> >
                               at C:\Users\mtken\.cargo\git\checkouts\winit-57d3141eaf559308\c52db20\src\platform_impl\windows\event_loop.rs:807
  59:     0x7ff6967bd848 - winit::platform_impl::platform::event_loop::thread_event_target_callback::closure$0<enum2$<pick_list::Message> >
                               at C:\Users\mtken\.cargo\git\checkouts\winit-57d3141eaf559308\c52db20\src\platform_impl\windows\event_loop.rs:2370
  60:     0x7ff69677f327 - core::ops::function::FnOnce::call_once<winit::platform_impl::platform::event_loop::thread_event_target_callback::closure_env$0<enum2$<pick_list::Message> >,tuple$<> >
                               at /rustc/8ede3aae28fe6e4d52b38157d7bfe0d3bceef225\library\core\src\ops\function.rs:250
  61:     0x7ff696771f41 - core::panic::unwind_safe::impl$23::call_once<isize,winit::platform_impl::platform::event_loop::thread_event_target_callback::closure_env$0<enum2$<pick_list::Message> > >
                               at /rustc/8ede3aae28fe6e4d52b38157d7bfe0d3bceef225\library\core\src\panic\unwind_safe.rs:271
  62:     0x7ff6967b0d28 - std::panicking::try::do_call<core::panic::unwind_safe::AssertUnwindSafe<winit::platform_impl::platform::event_loop::thread_event_target_callback::closure_env$0<enum2$<pick_list::Message> > >,isize>
                               at /rustc/8ede3aae28fe6e4d52b38157d7bfe0d3bceef225\library\std\src\panicking.rs:500
  63:     0x7ff6967b1283 - std::panicking::try::do_catch<core::panic::unwind_safe::AssertUnwindSafe<winit::platform_impl::platform::event_loop::public_window_callback_inner::closure_env$0<enum2$<pick_list::Message> > >,isize>
  64:     0x7ff6967b095b - std::panicking::try<isize,core::panic::unwind_safe::AssertUnwindSafe<winit::platform_impl::platform::event_loop::thread_event_target_callback::closure_env$0<enum2$<pick_list::Message> > > >
                               at /rustc/8ede3aae28fe6e4d52b38157d7bfe0d3bceef225\library\std\src\panicking.rs:464
  65:     0x7ff6967a8811 - std::panic::catch_unwind<core::panic::unwind_safe::AssertUnwindSafe<winit::platform_impl::platform::event_loop::thread_event_target_callback::closure_env$0<enum2$<pick_list::Message> > >,isize>
                               at /rustc/8ede3aae28fe6e4d52b38157d7bfe0d3bceef225\library\std\src\panic.rs:142
  66:     0x7ff69677ae65 - winit::platform_impl::platform::event_loop::runner::EventLoopRunner<enum2$<pick_list::Message> >::catch_unwind<enum2$<pick_list::Message>,isize,winit::platform_impl::platform::event_loop::thread_event_target_callback::closure_env$0<enum2$<pick_list::Messa
                               at C:\Users\mtken\.cargo\git\checkouts\winit-57d3141eaf559308\c52db20\src\platform_impl\windows\event_loop\runner.rs:157
  67:     0x7ff6967bc79c - winit::platform_impl::platform::event_loop::thread_event_target_callback<enum2$<pick_list::Message> >
                               at C:\Users\mtken\.cargo\git\checkouts\winit-57d3141eaf559308\c52db20\src\platform_impl\windows\event_loop.rs:2547
  68:     0x7ff973a78211 - DispatchMessageW
  69:     0x7ff973a77ecc - DispatchMessageW
  70:     0x7ff973a82ffd - GetClassLongW
  71:     0x7ff974272d94 - KiUserCallbackDispatcher
  72:     0x7ff971bb1ad4 - NtUserDispatchMessage
  73:     0x7ff973a77db4 - DispatchMessageW
  74:     0x7ff6967b2306 - winit::platform_impl::platform::event_loop::EventLoop<enum2$<pick_list::Message> >::run_return<enum2$<pick_list::Message>,iced_winit::application::run::closure_env$1<iced::application::Instance<pick_list::Example>,iced_futures::backend::null::Executor,enu
                               at C:\Users\mtken\.cargo\git\checkouts\winit-57d3141eaf559308\c52db20\src\platform_impl\windows\event_loop.rs:282
  75:     0x7ff6967a1bee - winit::platform::run_return::impl$0::run_return<enum2$<pick_list::Message>,iced_winit::application::run::closure_env$1<iced::application::Instance<pick_list::Example>,iced_futures::backend::null::Executor,enum2$<iced_renderer::compositor::Compositor<enum2
                               at C:\Users\mtken\.cargo\git\checkouts\winit-57d3141eaf559308\c52db20\src\platform\run_return.rs:51
  76:     0x7ff696774fc5 - iced_winit::application::platform::run<enum2$<pick_list::Message>,iced_winit::application::run::closure_env$1<iced::application::Instance<pick_list::Example>,iced_futures::backend::null::Executor,enum2$<iced_renderer::compositor::Compositor<enum2$<iced_st
                               at C:\git\_forks\iced\winit\src\application.rs:920
  77:     0x7ff6967af236 - iced_winit::application::run<iced::application::Instance<pick_list::Example>,iced_futures::backend::null::Executor,enum2$<iced_renderer::compositor::Compositor<enum2$<iced_style::theme::Theme> > > >
                               at C:\git\_forks\iced\winit\src\application.rs:226
  78:     0x7ff6967c1050 - iced::application::Application::run<pick_list::Example>
                               at C:\git\_forks\iced\src\application.rs:208
  79:     0x7ff6967c12b1 - iced::sandbox::Sandbox::run<pick_list::Example>
                               at C:\git\_forks\iced\src\sandbox.rs:153
  80:     0x7ff69676e85a - pick_list::main
                               at C:\git\_forks\iced\examples\pick_list\src\main.rs:5
  81:     0x7ff69677ef83 - core::ops::function::FnOnce::call_once<enum2$<core::result::Result<tuple$<>,enum2$<iced::error::Error> > > (*)(),tuple$<> >
                               at /rustc/8ede3aae28fe6e4d52b38157d7bfe0d3bceef225\library\core\src\ops\function.rs:250
  82:     0x7ff69676f17d - std::sys_common::backtrace::__rust_begin_short_backtrace<enum2$<core::result::Result<tuple$<>,enum2$<iced::error::Error> > > (*)(),enum2$<core::result::Result<tuple$<>,enum2$<iced::error::Error> > > >
                               at /rustc/8ede3aae28fe6e4d52b38157d7bfe0d3bceef225\library\std\src\sys_common\backtrace.rs:135
  83:     0x7ff6967d6bb6 - std::rt::lang_start::closure$0<enum2$<core::result::Result<tuple$<>,enum2$<iced::error::Error> > > >
                               at /rustc/8ede3aae28fe6e4d52b38157d7bfe0d3bceef225\library\std\src\rt.rs:166
  84:     0x7ff6977e0ae8 - std::rt::lang_start_internal::closure$2
                               at /rustc/8ede3aae28fe6e4d52b38157d7bfe0d3bceef225/library\std\src\rt.rs:148
  85:     0x7ff6977e0ae8 - std::panicking::try::do_call
                               at /rustc/8ede3aae28fe6e4d52b38157d7bfe0d3bceef225/library\std\src\panicking.rs:500
  86:     0x7ff6977e0ae8 - std::panicking::try
                               at /rustc/8ede3aae28fe6e4d52b38157d7bfe0d3bceef225/library\std\src\panicking.rs:464
  87:     0x7ff6977e0ae8 - std::panic::catch_unwind
                               at /rustc/8ede3aae28fe6e4d52b38157d7bfe0d3bceef225/library\std\src\panic.rs:142
  88:     0x7ff6977e0ae8 - std::rt::lang_start_internal
                               at /rustc/8ede3aae28fe6e4d52b38157d7bfe0d3bceef225/library\std\src\rt.rs:148
  89:     0x7ff6967d6b8a - std::rt::lang_start<enum2$<core::result::Result<tuple$<>,enum2$<iced::error::Error> > > >
                               at /rustc/8ede3aae28fe6e4d52b38157d7bfe0d3bceef225\library\std\src\rt.rs:165
  90:     0x7ff69676f139 - main
  91:     0x7ff697809ffc - invoke_main
                               at D:\a\_work\1\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:78
  92:     0x7ff697809ffc - __scrt_common_main_seh
                               at D:\a\_work\1\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:288
  93:     0x7ff9733b26ad - BaseThreadInitThunk
  94:     0x7ff97422aa68 - RtlUserThreadStart
error: process didn't exit successfully: `target\debug\pick_list.exe` (exit code: 101)
mtkennerly commented 1 year ago

It does work (visible text and no crash) if the text starts with a Latin letter like "A", but not a symbol like "+":

diff --git a/examples/counter/src/main.rs b/examples/counter/src/main.rs
index 0cc7d9f7..9a3a0518 100644
--- a/examples/counter/src/main.rs
+++ b/examples/counter/src/main.rs
@@ -42,7 +42,7 @@ impl Sandbox for Counter {
             button("Increment").on_press(Message::IncrementPressed),
             text(self.value).size(50),
             button("Decrement").on_press(Message::DecrementPressed),
-            text("العربية").shaping(text::Shaping::Advanced),
+            text("a العربية").shaping(text::Shaping::Advanced),
         ]
         .padding(20)
         .align_items(Alignment::Center)
diff --git a/examples/pick_list/src/main.rs b/examples/pick_list/src/main.rs
index 3fb064cc..68db2592 100644
--- a/examples/pick_list/src/main.rs
+++ b/examples/pick_list/src/main.rs
@@ -98,7 +98,7 @@ impl std::fmt::Display for Language {
                 Language::Haskell => "Haskell",
                 Language::C => "C",
                 Language::Javascript => "Javascript",
-                Language::Other => "العربية",
+                Language::Other => "a العربية",
             }
         )
     }
hecrj commented 1 year ago

RTL/BiDi is still not officially supported.

We probably need to handle positioning differently when the text starts with RTL.