Update example to show emojis and clipping

This commit is contained in:
grovesNL 2023-01-26 00:44:29 -03:30 committed by Josh Groves
parent 8c8cfba093
commit 07b04f511a
6 changed files with 21 additions and 3786 deletions

View file

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

View file

@ -1 +0,0 @@
I want more terminals to be able to handle ZWJ sequence emoji characters. For example, the service dog emoji 🐕‍🦺 is actually 3 Unicode characters. Kitty handles this fairly well. All VTE-based terminals, however, show "🐶🦺".

File diff suppressed because it is too large Load diff

View file

@ -70,13 +70,14 @@ async fn run() {
let mut atlas = TextAtlas::new(&device, &queue, swapchain_format);
let mut buffer = Buffer::new(
unsafe { FONT_SYSTEM.as_ref().unwrap() },
Metrics::new(14, 20),
);
buffer.set_size((width as f64 * scale_factor) as i32, (height as f64) as i32);
buffer.set_text(
include_str!("./emoji-zjw.txt"),
Attrs::new().monospaced(true).family(Family::Monospace),
Metrics::new(30, 42),
);
let physical_width = (width as f64 * scale_factor) as i32;
let physical_height = (height as f64 * scale_factor) as i32;
buffer.set_size(physical_width, physical_height);
buffer.set_text("Hello world! 👋\nThis is rendered with 🦅 glyphon 🦁\nThe text below should be partially clipped.\na b c d e f g h i j k l m n o p q r s t u v w x y z", Attrs::new().family(Family::SansSerif));
buffer.shape_until_scroll();
event_loop.run(move |event, _, control_flow| {
@ -105,11 +106,13 @@ async fn run() {
},
&[TextArea {
buffer: &buffer,
left: 10,
top: 10,
bounds: TextBounds {
left: 10,
top: 10,
right: 500,
bottom: 50,
left: 0,
top: 0,
right: 600,
bottom: 160,
},
}],
Color::rgb(255, 255, 255),