Skip to content

Commit

Permalink
update iced_aw, add iced_fonts, and create font helper
Browse files Browse the repository at this point in the history
  • Loading branch information
LegitCamper committed Sep 23, 2024
1 parent 2b337a9 commit 421a8a0
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 16 deletions.
10 changes: 10 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 2 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,8 @@ ultralight = ["ul-next"]
[dependencies]
env_home = "0.1.0"
iced = { version = "0.13", features = ["advanced", "image", "tokio", "lazy"] }
iced_aw = { version = "0.10", features = [
"tab_bar",
"icons",
"selection_list",
] }
iced_aw = { version = "0.10", features = ["tab_bar", "selection_list"] }
iced_fonts = { version = "0.1.1", features = ["bootstrap"] }
iced_on_focus_widget = "0.1.1"
rand = "0.8.5"
reqwest = "0.12.5"
Expand Down
7 changes: 2 additions & 5 deletions examples/basic_browser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,13 @@

use iced::Theme;
use iced::{Element, Settings, Subscription, Task};
use iced_aw::BOOTSTRAP_FONT_BYTES;
use std::time::Duration;

use icy_browser::{widgets, BrowserWidget, Ultralight};
use icy_browser::{get_fonts, widgets, BrowserWidget, Ultralight};

fn main() -> iced::Result {
// This imports `icons` for widgets
let bootstrap_font = BOOTSTRAP_FONT_BYTES.into();
let settings = Settings {
fonts: vec![bootstrap_font],
fonts: get_fonts(),
..Default::default()
};

Expand Down
9 changes: 3 additions & 6 deletions examples/keyboard_driven.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,16 @@
use iced::event::{self, Event};
use iced::Theme;
use iced::{Element, Settings, Subscription, Task};
use iced_aw::BOOTSTRAP_FONT_BYTES;
use std::time::Duration;

use icy_browser::{
widgets, BrowserWidget, KeyType, Message as WidgetMessage, ShortcutBuilder, ShortcutModifier,
Ultralight,
get_fonts, widgets, BrowserWidget, KeyType, Message as WidgetMessage, ShortcutBuilder,
ShortcutModifier, Ultralight,
};

fn main() -> iced::Result {
// This imports `icons` for widgets
let bootstrap_font = BOOTSTRAP_FONT_BYTES.into();
let settings = Settings {
fonts: vec![bootstrap_font],
fonts: get_fonts(),
..Default::default()
};

Expand Down
7 changes: 7 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
use iced::widget::image::{Handle, Image};
pub use iced_fonts::BOOTSTRAP_FONT_BYTES;
use std::borrow::Cow;
use url::{ParseError, Url};

mod engines;
Expand All @@ -13,6 +15,11 @@ pub use widgets::{nav_bar, tab_bar, BrowserWidget, Message};
mod shortcut;
pub use shortcut::{KeyType, Shortcut, ShortcutBuilder, ShortcutModifier, Shortcuts};

// Helper function to ensure required icons are imported
pub fn get_fonts() -> Vec<Cow<'static, [u8]>> {
vec![BOOTSTRAP_FONT_BYTES.into()]
}

// Image details for passing the view around
#[derive(Debug, Clone)]
pub struct ImageInfo {
Expand Down

0 comments on commit 421a8a0

Please sign in to comment.