Skip to content

Commit

Permalink
icons
Browse files Browse the repository at this point in the history
  • Loading branch information
pizzart committed Oct 24, 2023
1 parent d80764a commit ad3a23b
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 2 deletions.
Binary file not shown.
20 changes: 20 additions & 0 deletions bff-gui/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,25 @@ fn main() -> Result<(), eframe::Error> {
eframe::run_native("BFF GUI", options, Box::new(|cc| Box::new(Gui::new(cc))))
}

fn setup_custom_font(ctx: &egui::Context) {
let mut fonts = egui::FontDefinitions::default();

fonts.font_data.insert(
"icons".to_owned(),
egui::FontData::from_static(include_bytes!(
"../resources/Font Awesome 6 Free-Solid-900.otf"
)),
);

fonts
.families
.entry(egui::FontFamily::Name("icons".into()))
.or_default()
.push("icons".to_owned());

ctx.set_fonts(fonts);
}

#[derive(Default)]
struct Gui {
bigfile: Option<BigFile>,
Expand All @@ -59,6 +78,7 @@ impl Gui {
fn new(cc: &eframe::CreationContext<'_>) -> Self {
cc.egui_ctx.set_pixels_per_point(1.25);
egui_extras::install_image_loaders(&cc.egui_ctx);
setup_custom_font(&cc.egui_ctx);
Self {
bigfile: None,
bigfile_path: None,
Expand Down
6 changes: 4 additions & 2 deletions bff-gui/src/panels/left.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,10 @@ pub fn resource_list(
ui.style_mut().spacing.item_spacing.x = 5.0;
if ui
.button(match new_state.sort.reverse {
false => "AZ",
true => "ZA",
false => egui::RichText::new("")
.family(egui::FontFamily::Name("icons".into())),
true => egui::RichText::new("")
.family(egui::FontFamily::Name("icons".into())),
})
.clicked()
{
Expand Down

0 comments on commit ad3a23b

Please sign in to comment.