Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

boostrap icons: ExclamationCircle rendered incorrectly, PersonSlash missing #176

Closed
Cookie04DE opened this issue Sep 3, 2023 · 4 comments

Comments

@Cookie04DE
Copy link

Consider the following code:

use iced::{executor, font, widget, Application, Command, Renderer, Settings, Theme};
use iced_aw::{graphics::icons, Icon};

enum Test {
    Loading,
    Loaded,
}

impl Application for Test {
    type Message = ();
    type Theme = Theme;
    type Executor = executor::Default;
    type Flags = ();

    fn new(_flags: Self::Flags) -> (Self, Command<Self::Message>) {
        (
            Self::Loading,
            font::load(icons::ICON_FONT_BYTES).map(|_| ()),
        )
    }

    fn view(&self) -> iced::Element<'_, Self::Message> {
        match self {
            Self::Loading => widget::text("Loading... Please wait.").into(),
            Self::Loaded => {
                fn icon_text<'a>(icon: Icon) -> widget::Text<'a, Renderer<Theme>> {
                    widget::text(icons::icon_to_char(icon))
                        .font(icons::ICON_FONT)
                        .size(40)
                }
                widget::column!(
                    icon_text(Icon::Gift), // https://icons.getbootstrap.com/icons/gift/
                    icon_text(Icon::ExclamationCircle), // https://icons.getbootstrap.com/icons/exclamation-circle/
                    //icon_text(Icon::PersonSlash), // https://icons.getbootstrap.com/icons/person-slash/
                )
                .into()
            }
        }
    }

    fn title(&self) -> String {
        "Test".to_string()
    }

    fn update(&mut self, _message: Self::Message) -> iced::Command<Self::Message> {
        *self = Test::Loaded;
        Command::none()
    }
}

fn main() -> iced::Result {
    Test::run(Settings::default())
}

This is the resulting window:

Bildschirmfoto 2023-09-03 um 10 40 48

As you can see the gift icon renders correctly, the ExclamationCircle does not and the PersonSlash variant is missing although listed on the bootstrap website.

@genusistimelord
Copy link
Collaborator

Enable icons feature. should give more icons. Also note that the boostrap icons we are using are a few years old. I dont know how to update it yet so i have not done so.

For the ExclamationCircle if that is not working it is either messed up in the font if it exists of Cosmic-text is not rendering it correctly from the font.

@Cookie04DE
Copy link
Author

Even with the icons feature enabled, the PersonSlash variant is missing (also note it's absence in the source code).

Regarding the age of the included icons: I noticed the file containing them claims to be machine generated but I have yet to discover the mechanism by which they are generated. The PersonSlash Icon is a fairly new addition to the bootstrap icons. Regenerating the source code files would presumably solve this specific issue.

@gmLucario
Copy link
Contributor

i created this pull reuquest updating those files:

#180

@Cookie04DE
Copy link
Author

Thanks! That solved it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants