mirror of
https://github.com/fossasia/badgemagic-rs
synced 2025-06-24 07:43:58 +00:00
feat: Move to proportional font
To use the available space on the bade more efficient, I changed the font to u8g2_font_lucasfont_alternate_tf from [u8g2-fonts](https://docs.rs/crate/u8g2-fonts/). Lucasfont Alternate was created by Patrick Lauke and is licensed under [CC BY 3.0](https://creativecommons.org/licenses/by/3.0/). No changes to the font were made.
This commit is contained in:
parent
ce7d12fc58
commit
fe3abd83d7
4 changed files with 18 additions and 5 deletions
11
Cargo.lock
generated
11
Cargo.lock
generated
|
@ -125,6 +125,7 @@ dependencies = [
|
|||
"time",
|
||||
"tokio",
|
||||
"toml",
|
||||
"u8g2-fonts",
|
||||
"uuid",
|
||||
"zerocopy",
|
||||
]
|
||||
|
@ -1038,6 +1039,16 @@ dependencies = [
|
|||
"winnow",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "u8g2-fonts"
|
||||
version = "0.5.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "132e15484caa39440cc9d6317c1f1980a13259234e630db2270ea2a2b1e5c4a2"
|
||||
dependencies = [
|
||||
"embedded-graphics",
|
||||
"embedded-graphics-core",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "unicode-ident"
|
||||
version = "1.0.12"
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
[package]
|
||||
name = "badgemagic"
|
||||
version = "0.1.0"
|
||||
authors = ["Martin Michaelis <code@mgjm.de>"]
|
||||
authors = ["Martin Michaelis <code@mgjm.de>", "Valentin Weber <weva+code@kabelsalat.ch>"]
|
||||
edition = "2021"
|
||||
description = "Badge Magic with LEDs - Library and CLI"
|
||||
homepage = "https://badgemagic.fossasia.org"
|
||||
|
@ -50,3 +50,4 @@ serde_json = { version = "1.0.134", optional = true }
|
|||
time = "0.3.37"
|
||||
toml = { version = "0.8.19", optional = true }
|
||||
zerocopy = { version = "0.8.14", features = ["derive"] }
|
||||
u8g2-fonts = { version = "0.5.2", features = ["embedded_graphics_textstyle"] }
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
Copyright 2024 Martin Michaelis
|
||||
Copyright 2024 Martin Michaelis, Valentin Weber
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the “Software”), to deal
|
||||
|
|
|
@ -13,12 +13,12 @@ use clap::{Parser, ValueEnum};
|
|||
use embedded_graphics::{
|
||||
geometry::Point,
|
||||
image::{Image, ImageRawLE},
|
||||
mono_font::{iso_8859_1::FONT_6X9, MonoTextStyle},
|
||||
pixelcolor::BinaryColor,
|
||||
text::Text,
|
||||
Drawable, Pixel,
|
||||
};
|
||||
use serde::Deserialize;
|
||||
use u8g2_fonts::{fonts::u8g2_font_lucasfont_alternate_tf, U8g2TextStyle};
|
||||
|
||||
#[derive(Parser)]
|
||||
/// Upload a configuration with up to 8 messages to an LED badge
|
||||
|
@ -161,9 +161,10 @@ fn gnerate_payload(args: &mut Args) -> Result<PayloadBuffer> {
|
|||
Content::Text { text } => {
|
||||
let text = Text::new(
|
||||
&text,
|
||||
Point::new(0, 7),
|
||||
MonoTextStyle::new(&FONT_6X9, BinaryColor::On),
|
||||
Point::new(0, 8),
|
||||
U8g2TextStyle::new(u8g2_font_lucasfont_alternate_tf, BinaryColor::On),
|
||||
);
|
||||
|
||||
payload.add_message_drawable(style, &text);
|
||||
}
|
||||
Content::Bitstring { bitstring } => {
|
||||
|
|
Loading…
Reference in a new issue