Expand description
Rust SVG badge generator with font path rendering.
+-------+--------+
| LABEL | STATUS |
+-------+--------+
§Basic usage
let badge = badgen::badge(
&badgen::Style::classic(),
"status",
Some("label"),
).unwrap();
println!("{}", badge);
§Performance usage
Note, given this example, you would clear out
on every render.
let font = badgen::notosans_font();
let mut font = badgen::font(&font);
let mut scratch = String::with_capacity(4098);
let mut out = String::with_capacity(4098);
badgen::write_badge_with_font(
&mut out,
&badgen::Style::classic(),
"world",
Some("hello"),
&mut font,
&mut scratch,
)
.unwrap();
println!("{}", out);
Structs§
- Cached
Font - A wrapper around a font that caches a finite number of glyph paths.
- Font
Glyph - A rendered glyph.
- Gradient
- A two color gradient value.
- Opacity
- Wrapper around a string opacity value.
- Point
- An
x
andy
coordinate. - Style
- A badge style.
- True
Type Font - A True Type Font with a font height and path precision.
Enums§
- Color
- Possible colors for use in a badge.
Traits§
- Font
- A Font trait specific to badge generation.
Functions§
- badge
- Generate an SVG badge given a style, status and optional label.
- font
- Prepares a cached True Type Font for use in generating badges with integer SVG paths.
- font_
licenses - Licenses for fonts included in binary.
- font_
with_ precision - Prepares a cached True Type Font for use in generating badges with a given precision.
- notosans_
font - Parsed NotoSans font.
- write_
badge - Writes an SVG badge to a
fmt::Write
given a style, status and optional label. - write_
badge_ with_ font - Writes an SVG badge to a
fmt::Write
given a style, status, optional label, font and scratch space.