1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
//! # `JetbrainsMono Nerd Font`
//!
//! [](https://crates.io/crates/nerd_font/)
//! [](https://github.com/rscarson/font-map/actions?query=branch%3Amaster)
//! [](https://docs.rs/nerd_font/latest/)
//! [](https://raw.githubusercontent.com/rscarson/nerd_font/master/LICENSE)
//!
//! This crate provides an enum of all the glyphs in the `JetbrainsMono Nerd Font`.
//! Additionally, it provides a way to load the font, and QOL features for using the font in iced.
//!
//! In addition - you can hover over the icons in your IDE to see a preview of the icon!
//!
//! See <https://www.nerdfonts.com/> for more information
//!
//! **I am not affiliated with Nerd Fonts, nor do I have any rights to the `JetbrainsMono Nerd Font`.**
//! This crate is published with a copy of the font, and its license, as allowed by the license.
//!
//! See [`NerdFont`] or [`categories`] for the list of available icons, including their names, codepoints and a preview image.
//!
//! -----
//!
//! The individual glyphs are in seperate enums inside of the [`categories`] module:
//! ```rust
//! use nerd_font::categories;
//!
//! let _ = categories::Dev::Android;
//! let _ = categories::Fa::ArrowLeft;
//! ```
//!
//! There is also an enum encapsulating all the glyphs, [`NerdFont`], which can be converted to and from the individual enums:
//! ```rust
//! use nerd_font::{NerdFont, categories::Dev};
//! let _: NerdFont = Dev::Android.into();
//! ```
//!
//! -----
//!
//! Each glyph contains the following information:
//! - Unicode codepoint: e.g. `Dev::Android as u32`
//! - Postfix name: e.g. `Dev::Android.name()`
//! - Glyph preview image, visible in the documentation, and by hovering over the glyphs in your IDE!
//!
//! You can also get the actual char from the enum, with `char::from(Dev::Android)`, or `Dev::Android.to_string()`
//!
//! -----
//!
//! If you use `iced` there are some QOL features built-in:
//! **NOTE: ** you will need to activate the `iced` crate-level feature to use these!
//!
//! - [`NerdFont::FONT_BYTES`] is the raw bytes of the font, for loading into iced
//! - [`IcedExt`] provides the helper functions for using the font in iced
//! - `NerdFont` also implements `Into<iced::Element>`, which will use the default font size
//!
//! ```ignore
//! use nerd_font::{IcedExt, categories::Dev};
//!
//! // A text widget configured to use the icon font, with the selected glyph, and a font size of 24
//! let text_widget = Dev::Android.into_text(24);
//! ```
//!
//! You will additionally need to load the font, by calling `.font(NerdFont::FONT_BYTES)` on your `iced::Application`.
//!
//! ## Crate Features
//!
//! #### `iced`
//! Default: Off
//! Provides some QOL features for using the font in iced, including a font definition, and conversion to an iced Text widget.
//!
/// Re-export of the `font_map` crate, which provides a simple API for analyzing font files
pub use font_map;
include_font!;
/// Extension trait for using these icons from within iced
///
/// - [`NerdFont::FONT_BYTES`] is the raw bytes of the font, for loading into iced
/// - `NerdFont` also implements `Into<iced::Element>`, which will use the default font size
///
/// ```rust
/// use nerd_font::{IcedExt, categories::Dev};
///
/// // A text widget configured to use the icon font, with the selected glyph, and a font size of 24
/// let text_widget = Dev::Android.into_text(24);
/// ```
///
/// You will additionally need to load the font, by calling `.font(NerdFont::FONT_BYTES)` on your `iced::Application`.