Use arabic.txt example and get_image_uncached

This commit is contained in:
grovesNL 2022-10-25 23:27:46 -02:30 committed by Josh Groves
parent 7fe35bdce3
commit dcdb250e19
4 changed files with 11 additions and 3 deletions

3
examples/arabic.txt Normal file
View file

@ -0,0 +1,3 @@
I like to render اللغة العربية in Rust!
عندما يريد العالم أن ‪يتكلّم ، فهو يتحدّث بلغة يونيكود. تسجّل الآن لحضور المؤتمر الدولي العاشر ليونيكود (Unicode Conference)، الذي سيعقد في 10-12 آذار 1997 بمدينة مَايِنْتْس، ألمانيا. و سيجمع المؤتمر بين خبراء من كافة قطاعات الصناعة على الشبكة العالمية انترنيت ويونيكود، حيث ستتم، على الصعيدين الدولي والمحلي على حد سواء مناقشة سبل استخدام يونكود في النظم القائمة وفيما يخص التطبيقات الحاسوبية، الخطوط، تصميم النصوص والحوسبة متعددة اللغات.

View file

@ -76,7 +76,7 @@ async fn run() {
TextMetrics::new(32, 44), TextMetrics::new(32, 44),
); );
buffer.set_size(800, 600); buffer.set_size(800, 600);
buffer.set_text("Hello from cosmic inside of glyphon/wgpu!"); buffer.set_text(include_str!("./arabic.txt"));
buffer.shape_until_cursor(); buffer.shape_until_cursor();
event_loop.run(move |event, _, control_flow| { event_loop.run(move |event, _, control_flow| {

6
examples/ligature.txt Normal file
View file

@ -0,0 +1,6 @@
fi ffi 🐕‍🦺 fi ffi
fi تما 🐕‍🦺 ffi تما
ffi fi 🐕‍🦺 ffi fi
تما تما 🐕‍🦺 تما
تما ffi 🐕‍🦺 تما fi تما
تما تما 🐕‍🦺 تما

View file

@ -108,8 +108,7 @@ impl TextRenderer {
let image = self let image = self
.swash_cache .swash_cache
.get_image(&buffer.font_matches, glyph.cache_key) .get_image_uncached(&buffer.font_matches, glyph.cache_key)
.as_ref()
.unwrap(); .unwrap();
let bitmap = image.data.as_slice(); let bitmap = image.data.as_slice();
let width = image.placement.width as usize; let width = image.placement.width as usize;