Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
target
Cargo.lock
/.vs
6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "egui_nerdfonts"
description = "Nerdfonts icons for egui"
version = "0.1.3"
version = "0.1.4"
edition = "2021"
license = "MIT OR Apache-2.0"
homepage = "https://github.com/bernsteining/egui_nerdfonts"
Expand All @@ -10,10 +10,10 @@ keywords = ["egui", "nerdfonts", "icons", "symbols", "font"]
categories = ["gui"]

[dependencies]
egui = { version = "0.27.2", default-features = false }
egui = { version = "0.28.1", default-features = false }

[dev-dependencies]
eframe = "0.27.2"
eframe = "0.28.1"

[[example]]
name = "rust_logo"
10 changes: 6 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Bundles [Nerd Fonts icons](https://www.nerdfonts.com/cheat-sheet) for [egui](htt

Add the crate as a dependency in Cargo.toml:
```toml
egui_nerdfonts = "0.1.3"
egui_nerdfonts = "0.1.4"
```

or type `cargo add egui_nerdfonts`, in your project.
Expand All @@ -32,7 +32,7 @@ Choose nerdfonts icons you want to use among [these](https://www.nerdfonts.com/c
Then use nerdfonts icons as follow:

```rust
ui.label(format!("{}", egui_nerdfonts::regular::NF_DEV_RUST));
ui.label(format!("{}", egui_nerdfonts::regular::LANGUAGE_RUST));
```

## Example
Expand All @@ -47,7 +47,7 @@ cargo run --example rust_logo

Got inspired by [egui_phosphor](https://github.com/amPerl/egui-phosphor), code uses the same structure.

The .ttf used is [this one](https://github.com/ryanoasis/nerd-fonts/releases/download/v3.0.2/NerdFontsSymbolsOnly.zip), and the `src/variants/regular.rs` was generated with the following python script, with the `nerdfonts_regular.ttf` as first argument:
The .ttf used is [this one](https://github.com/ryanoasis/nerd-fonts/releases/download/v3.2.1/NerdFontsSymbolsOnly.zip) (v3.2.1), and the `src/variants/regular.rs` was generated with the following python script, with the `nerdfonts_regular.ttf` as first argument:

```python
from itertools import chain
Expand All @@ -65,4 +65,6 @@ with TTFont(
symbol_name = char[1].upper().replace('-', '_').replace(' ', '_').replace('#', '_').replace('!', '')
code = r"\u" + "{" + f"{char[0]:X}" + "}"
print(f"pub const {symbol_name}: &str = \"{code}\";")
```
```

See the full script [here](fonts/script.py).
2 changes: 1 addition & 1 deletion examples/rust_logo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ fn main() {
eframe::run_native(
"egui_nerdfonts demo",
eframe::NativeOptions::default(),
Box::new(|cc| Box::new(Demo::new(cc))),
Box::new(|cc| Ok(Box::new(Demo::new(cc)))),
)
.unwrap();
}
Expand Down
Binary file modified fonts/nerdfonts_regular.ttf
Binary file not shown.
622 changes: 622 additions & 0 deletions fonts/script.py

Large diffs are not rendered by default.

Loading