This commit is contained in:
Hanno Braun 2024-11-27 18:59:32 +01:00
parent cb0cc6b383
commit 9b5ed60434

View File

@ -68,8 +68,6 @@ impl TextRenderer {
surface_config: &wgpu::SurfaceConfiguration,
render_pass: &mut wgpu::RenderPass,
) -> anyhow::Result<()> {
let mut buffers = Vec::new();
let mut buffer = glyphon::Buffer::new(
&mut self.font_system,
glyphon::Metrics {
@ -88,29 +86,24 @@ impl TextRenderer {
}
buffer.shape_until_scroll(&mut self.font_system, false);
buffers.push(buffer);
let mut text_areas = Vec::new();
let mut top = 0.;
let top = 0.;
for buffer in &buffers {
text_areas.push(glyphon::TextArea {
buffer,
left: 0.,
top,
scale: self.scale_factor,
bounds: glyphon::TextBounds {
left: 0,
top: 0,
right: surface_config.width as i32,
bottom: surface_config.height as i32,
},
default_color: glyphon::Color::rgb(0, 0, 0),
custom_glyphs: &[],
});
top += 20.0 * self.scale_factor;
}
text_areas.push(glyphon::TextArea {
buffer: &buffer,
left: 0.,
top,
scale: self.scale_factor,
bounds: glyphon::TextBounds {
left: 0,
top: 0,
right: surface_config.width as i32,
bottom: surface_config.height as i32,
},
default_color: glyphon::Color::rgb(0, 0, 0),
custom_glyphs: &[],
});
self.text_renderer
.prepare(