-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a8dd5c1
commit fb2bdc3
Showing
5 changed files
with
109 additions
and
48 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
use iced::alignment; | ||
use iced::font::Font; | ||
use iced::widget::{text, Text}; | ||
|
||
/// See https://fonts.google.com/icons. Just find some online icon font editor | ||
/// to modify the ttf file. | ||
pub enum Icon { | ||
AccountTree, | ||
FullStackedBarChart, | ||
SideNavigation, | ||
DragIndicator, | ||
Settings, | ||
DeleteForever, | ||
} | ||
|
||
impl Icon { | ||
pub fn bytes() -> &'static [u8] { | ||
include_bytes!("../fonts/icons.ttf").as_slice() | ||
} | ||
} | ||
|
||
impl Into<Text<'static>> for Icon { | ||
fn into(self) -> Text<'static> { | ||
let ch = match self { | ||
Icon::AccountTree => "A", | ||
Icon::FullStackedBarChart => "B", | ||
Icon::SideNavigation => "C", | ||
Icon::DragIndicator => "D", | ||
Icon::Settings => "E", | ||
Icon::DeleteForever => "F", | ||
}; | ||
text(ch) | ||
.font(Font::with_name("icons")) | ||
.width(20) | ||
.horizontal_alignment(alignment::Horizontal::Center) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters