Newer
Older
use eframe::egui::{FontFamily, FontId, Frame, Sense, Shape, Stroke, TextFormat};
use eframe::epaint::TextShape;
#[derive(Default)]
pub struct Conclusion {}
impl Slide for Conclusion {
ui.style_mut().debug.debug_on_hover = true;
ui.style_mut().debug.show_expand_height = true;
ui.style_mut().debug.show_resize = true;
ui.style_mut().debug.show_expand_width = true;
Frame::none().margin(Margin::same(20.0)).show(ui, |ui| {
ui.heading("Conclusion");
ui.add_space(8.0);
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
let font_size = 30.0;
let color = ui.style().visuals.widgets.noninteractive.fg_stroke.color;
let mut job = LayoutJob::default();
job.append(
"In the spirit of generative art, ",
0.0,
TextFormat {
font_id: FontId::new(font_size, FontFamily::Proportional),
color,
..Default::default()
},
);
job.append(
"this entire cartoon was rendered by code",
0.0,
TextFormat {
font_id: FontId::new(font_size, FontFamily::Monospace),
color,
underline: Stroke::new(1.5, color),
..Default::default()
},
);
job.append(
"!",
0.0,
TextFormat {
font_id: FontId::new(font_size, FontFamily::Proportional),
color,
..Default::default()
},
);
let galley = ui.fonts().layout_job(job);
let (rect, _) = ui.allocate_exact_size(galley.size(), Sense::hover());
ui.painter()
.add(Shape::Text(TextShape::new(rect.left_top(), galley)));