Skip to content

Commit

Permalink
Use prebundled roboto font for iced (#182)
Browse files Browse the repository at this point in the history
  • Loading branch information
PolyMeilex authored Jun 21, 2024
1 parent 8f604c2 commit 456e7e4
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions neothesia/src/iced_utils/iced_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,23 @@ impl IcedManager {

let engine = iced_wgpu::Engine::new(adapter, device, queue, texture_format, None);

for bytes in [
include_bytes!("./bootstrap-icons.ttf").as_slice(),
include_bytes!("../../../neothesia-core/src/render/text/Roboto-Regular.ttf").as_slice(),
] {
iced_graphics::text::font_system()
.write()
.expect("Write to font system")
.load_font(std::borrow::Cow::Borrowed(bytes));
}

let renderer = iced_wgpu::Renderer::new(
device,
&engine,
iced_core::Font::default(),
iced_core::Font::with_name("Roboto"),
iced_core::Pixels(16.0),
);

iced_graphics::text::font_system()
.write()
.expect("Write to font system")
.load_font(std::borrow::Cow::Borrowed(include_bytes!(
"./bootstrap-icons.ttf"
)));

let viewport = iced_wgpu::graphics::Viewport::with_physical_size(
iced_core::Size::new(physical_size.0, physical_size.1),
scale_factor,
Expand Down

0 comments on commit 456e7e4

Please sign in to comment.