Include fonts via feature flags in your Iced project!
use iced_fonts::{LUCIDE_FONT_BYTES, lucide::*};
fn view(&self) -> Element<Message> {
row![
git_branch(),
git_commit_horizontal(),
git_merge(),
git_pull_request(),
github(),
gitlab(),
]
}
Include iced_fonts
as a dependency in your Cargo.toml
:
[dependencies]
iced_fonts = { version = "0.2.0", features = [...] }
iced version |
iced_fonts version |
---|---|
0.13.x | 0.1.x, 0.2.x |
0.14.x | master branch |
Fonts can all be enabled with feature flags. All the fonts can be enabled with the full
feature flag. By default there are no fonts added.
NOTE: By enabling a feature flag you add the full size of the font file(s) to your binary.
The Following are a link to the source followed by their feature flag name.
- Bootstrap
bootstrap
- Codicon
codicon
- Devicon
devicon
- FontAwesome
fontawesome
- Lucide
lucide
- Nerd Fonts (Symbols Only)
nerd
- Octicons
octicons
- Pomicons
pomicons
One problem people bring up is that they only need a few icons. So the macro used by this library is exported for public use. See the custom
example.
Saddly some fonts are not supported because they are not given proper names in the post
table. This is a failure of the font author and there is nothing we can do about these. We cannot generate/lookup names that are not in the font. The currently list of these follows
- Material Icons (avaiable via nerd font)
- Weather Icons (avaiable via nerd font)
If you would like to request a new font, please open an issue with the font's name and where to download the ttf file from.
Somethings that need to be done are.
- Use basic shaping where possible, we shouldn't pay a fee we aren't required to.
- Add more useful fonts if possible, this depends on if they have properly setup tables.
- Look into svg support. Once a demo is done it's easy to make a proc macro for it.