Update fonts.rs

This commit is contained in:
Piotr Siuszko 2025-09-28 13:27:22 +02:00
parent e20442ad14
commit 792b3c66be
1 changed files with 2 additions and 2 deletions

View File

@ -1,5 +1,3 @@
use std::path::Path;
pub fn setup_custom_fonts(ctx: &egui::Context) { pub fn setup_custom_fonts(ctx: &egui::Context) {
// Start with the default fonts (we will be adding to them rather than replacing them). // Start with the default fonts (we will be adding to them rather than replacing them).
let mut fonts = egui::FontDefinitions::default(); let mut fonts = egui::FontDefinitions::default();
@ -79,6 +77,8 @@ fn try_get_font_from_list(font_names: &[&str]) -> Option<Vec<u8>> {
#[cfg(not(target_arch = "wasm32"))] #[cfg(not(target_arch = "wasm32"))]
fn try_get_font(font_name: &str) -> Option<Vec<u8>> { fn try_get_font(font_name: &str) -> Option<Vec<u8>> {
use std::path::Path;
for dir in font_dirs() { for dir in font_dirs() {
if let Ok(font) = std::fs::read(Path::new(&dir).join(format!("{}.ttf", font_name))) { if let Ok(font) = std::fs::read(Path::new(&dir).join(format!("{}.ttf", font_name))) {
return Some(font); return Some(font);