Skip to content

Commit

Permalink
Update embedded-graphics to 0.8 (#20)
Browse files Browse the repository at this point in the history
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
  • Loading branch information
msrd0 and dependabot[bot] committed May 15, 2023
1 parent 2237b34 commit 35eaf8a
Show file tree
Hide file tree
Showing 8 changed files with 33 additions and 31 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
matrix:
rust:
- name: "MSRV"
toolchain: "1.63.0"
toolchain: "1.61"
nightly: false
- name: "Stable"
toolchain: "stable"
Expand Down Expand Up @@ -72,7 +72,7 @@ jobs:
- uses: dtolnay/rust-toolchain@master
with:
components: clippy
toolchain: "1.67"
toolchain: "1.69"
id: rust-toolchain
- uses: actions/cache@v3
with:
Expand Down
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ name = "bitmap-font"
version = "0.2.2"
authors = ["Dominic Meiser <git@msrd0.de>"]
edition = "2021"
rust-version = "1.57"
rust-version = "1.61"
description = "Bitmap fonts for the embedded-graphics crate that don't require generics"
keywords = ["embedded", "graphics", "bitmap", "font", "no_std"]
categories = ["embedded", "graphics", "no-std"]
Expand All @@ -18,4 +18,4 @@ repository = "https://github.com/msrd0/bitmap-font"
include = ["src/**/*", "LICENSE", "crates-io.md"]

[dependencies]
embedded-graphics = "0.7"
embedded-graphics = "0.8"
4 changes: 2 additions & 2 deletions README.j2
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
<a href="https://msrd0.github.io/bitmap-font/doc/bitmap_font/index.html">
<img alt="bitmap-font main branch documentation" src="https://img.shields.io/badge/docs-main-blue.svg"/>
</a>
<a href="https://blog.rust-lang.org/2021/12/02/Rust-1.57.0.html">
<img alt="Rust 1.57+" src="https://img.shields.io/badge/rustc-1.57+-orange.svg"/>
<a href="https://blog.rust-lang.org/2022/05/19/Rust-1.61.0.html">
<img alt="Rust 1.61+" src="https://img.shields.io/badge/rustc-1.61+-orange.svg"/>
</a>
<a href="https://deps.rs/repo/github/msrd0/bitmap-font">
<img alt="dependency report" src="https://deps.rs/repo/github/msrd0/bitmap-font/status.svg"/>
Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
<a href="https://msrd0.github.io/bitmap-font/doc/bitmap_font/index.html">
<img alt="bitmap-font main branch documentation" src="https://img.shields.io/badge/docs-main-blue.svg"/>
</a>
<a href="https://blog.rust-lang.org/2021/12/02/Rust-1.57.0.html">
<img alt="Rust 1.57+" src="https://img.shields.io/badge/rustc-1.57+-orange.svg"/>
<a href="https://blog.rust-lang.org/2022/05/19/Rust-1.61.0.html">
<img alt="Rust 1.61+" src="https://img.shields.io/badge/rustc-1.61+-orange.svg"/>
</a>
<a href="https://deps.rs/repo/github/msrd0/bitmap-font">
<img alt="dependency report" src="https://deps.rs/repo/github/msrd0/bitmap-font/status.svg"/>
Expand Down Expand Up @@ -104,8 +104,8 @@ of this font.
```

[contributors]: https://github.com/msrd0/bitmap-font/graphs/contributors
[__cargo_doc2readme_dependencies_info]: ggGkYW0BYXSEG_N0QJHQOm9HG74Beb5vRrYBG2NMKQS7lQADG84YALdtFut5YXKEG7QsMysq64PIGyOKYfl4MwNjG-1TTKAJaS94G62BH4qvezKCYWSCg2tiaXRtYXAtZm9udGUwLjIuMmtiaXRtYXBfZm9udIJxZW1iZWRkZWRfZ3JhcGhpY3NlMC43LjE
[__link0]: https://crates.io/crates/embedded_graphics/0.7.1
[__link1]: https://docs.rs/embedded_graphics/0.7.1/embedded_graphics/?search=mono_font
[__cargo_doc2readme_dependencies_info]: ggGkYW0BYXSEGz9hV0L4yLNCGzqX6YFbQohpG92x-KBiv9-dG_aEBp2jAnbRYXKEG7QsMysq64PIGyOKYfl4MwNjG-1TTKAJaS94G62BH4qvezKCYWSCg2tiaXRtYXAtZm9udGUwLjIuMmtiaXRtYXBfZm9udIJxZW1iZWRkZWRfZ3JhcGhpY3NlMC44LjA
[__link0]: https://crates.io/crates/embedded_graphics/0.8.0
[__link1]: https://docs.rs/embedded_graphics/0.8.0/embedded_graphics/?search=mono_font
[__link2]: https://github.com/sunaku/tamzen-font
[__link3]: https://docs.rs/bitmap-font/0.2.2/bitmap_font/tamzen/index.html
3 changes: 2 additions & 1 deletion codegen/templates/src.rs.j2
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ use embedded_graphics::{
struct Mapping;

impl GlyphMapping for Mapping {
#[allow(unused_parens)]
fn index(&self, c: char) -> usize {
match c {
{% for range in char_ranges -%}
Expand Down Expand Up @@ -75,7 +76,7 @@ const ONE: NonZeroU8 = match NonZeroU8::new(1) {
/// Font License: <https://github.com/sunaku/tamzen-font/blob/master/LICENSE>
#[allow(non_upper_case_globals)]
pub const FONT_{{ font.width }}x{{ font.height }}{% if font.bold %}_BOLD{% endif %}: BitmapFont<'static> = BitmapFont {
bitmap: ImageRaw::new_binary(
bitmap: ImageRaw::new(
// {{ font.img_width }} x {{ font.img_height }} ({{ font.bitmap_len }})
&[
{%- for chunk in font.bitmap|chunks(16) %}
Expand Down
2 changes: 1 addition & 1 deletion crates-io.j2
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# bitmap-font [![Rust 1.57+](https://img.shields.io/badge/rustc-1.57+-orange.svg)](https://blog.rust-lang.org/2021/12/02/Rust-1.57.0.html) [![License Apache-2.0](https://img.shields.io/badge/license-Apache--2.0-blue.svg)](https://www.apache.org/licenses/LICENSE-2.0) [![GitHub](https://img.shields.io/badge/Code-On%20Github-blue?logo=GitHub)](https://github.com/msrd0/bitmap-font)
# bitmap-font [![Rust 1.61+](https://img.shields.io/badge/rustc-1.61+-orange.svg)](https://blog.rust-lang.org/2022/05/19/Rust-1.61.0.html) [![License Apache-2.0](https://img.shields.io/badge/license-Apache--2.0-blue.svg)](https://www.apache.org/licenses/LICENSE-2.0) [![GitHub](https://img.shields.io/badge/Code-On%20Github-blue?logo=GitHub)](https://github.com/msrd0/bitmap-font)

{{readme}}

Expand Down
8 changes: 4 additions & 4 deletions crates-io.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# bitmap-font [![Rust 1.57+](https://img.shields.io/badge/rustc-1.57+-orange.svg)](https://blog.rust-lang.org/2021/12/02/Rust-1.57.0.html) [![License Apache-2.0](https://img.shields.io/badge/license-Apache--2.0-blue.svg)](https://www.apache.org/licenses/LICENSE-2.0) [![GitHub](https://img.shields.io/badge/Code-On%20Github-blue?logo=GitHub)](https://github.com/msrd0/bitmap-font)
# bitmap-font [![Rust 1.61+](https://img.shields.io/badge/rustc-1.61+-orange.svg)](https://blog.rust-lang.org/2022/05/19/Rust-1.61.0.html) [![License Apache-2.0](https://img.shields.io/badge/license-Apache--2.0-blue.svg)](https://www.apache.org/licenses/LICENSE-2.0) [![GitHub](https://img.shields.io/badge/Code-On%20Github-blue?logo=GitHub)](https://github.com/msrd0/bitmap-font)

This crate provides bitmap fonts for the [`embedded-graphics`][__link0] crate. Those don’t only look better than the [built-in fonts][__link1] by using the good-looking [Tamzen font][__link2] over a font that renders `.` like a `+`, but also allow scaling fonts by pixel-doubling them, giving you two font sizes for the flash size requirements of the smaller one.

Expand Down Expand Up @@ -66,8 +66,8 @@ of this font.
```

[contributors]: https://github.com/msrd0/bitmap-font/graphs/contributors
[__cargo_doc2readme_dependencies_info]: ggGkYW0BYXSEG8OLOcBnX8tEG0XUTjj8V5LfGxwiScerO4peG3cFs12J67qKYXKEG7QsMysq64PIGyOKYfl4MwNjG-1TTKAJaS94G62BH4qvezKCYWSCg2tiaXRtYXAtZm9udGUwLjIuMmtiaXRtYXBfZm9udIJxZW1iZWRkZWRfZ3JhcGhpY3NlMC43LjE
[__link0]: https://crates.io/crates/embedded_graphics/0.7.1
[__link1]: https://docs.rs/embedded_graphics/0.7.1/embedded_graphics/?search=mono_font
[__cargo_doc2readme_dependencies_info]: ggGkYW0BYXSEGxtTp1ugHjhdG0FTi-0AJfYpG7nTNfccmo0QG5flQtRqvsuKYXKEG7QsMysq64PIGyOKYfl4MwNjG-1TTKAJaS94G62BH4qvezKCYWSCg2tiaXRtYXAtZm9udGUwLjIuMmtiaXRtYXBfZm9udIJxZW1iZWRkZWRfZ3JhcGhpY3NlMC44LjA
[__link0]: https://crates.io/crates/embedded_graphics/0.8.0
[__link1]: https://docs.rs/embedded_graphics/0.8.0/embedded_graphics/?search=mono_font
[__link2]: https://github.com/sunaku/tamzen-font
[__link3]: https://docs.rs/bitmap-font/0.2.2/bitmap_font/tamzen/index.html
29 changes: 15 additions & 14 deletions src/tamzen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,7 @@ use embedded_graphics::{
struct Mapping;

impl GlyphMapping for Mapping {
#[allow(unused_parens)]
fn index(&self, c: char) -> usize {
match c {
' ' ..= '~' => (c as usize - ' ' as usize),
Expand Down Expand Up @@ -239,7 +240,7 @@ const ONE: NonZeroU8 = match NonZeroU8::new(1) {
/// Font License: <https://github.com/sunaku/tamzen-font/blob/master/LICENSE>
#[allow(non_upper_case_globals)]
pub const FONT_5x9: BitmapFont<'static> = BitmapFont {
bitmap: ImageRaw::new_binary(
bitmap: ImageRaw::new(
// 96 x 81 (972)
&[
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x14, 0xa2, 0x61,
Expand Down Expand Up @@ -324,7 +325,7 @@ pub const FONT_5x9: BitmapFont<'static> = BitmapFont {
/// Font License: <https://github.com/sunaku/tamzen-font/blob/master/LICENSE>
#[allow(non_upper_case_globals)]
pub const FONT_5x9_BOLD: BitmapFont<'static> = BitmapFont {
bitmap: ImageRaw::new_binary(
bitmap: ImageRaw::new(
// 96 x 81 (972)
&[
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x3c, 0xa2, 0x41,
Expand Down Expand Up @@ -409,7 +410,7 @@ pub const FONT_5x9_BOLD: BitmapFont<'static> = BitmapFont {
/// Font License: <https://github.com/sunaku/tamzen-font/blob/master/LICENSE>
#[allow(non_upper_case_globals)]
pub const FONT_6x12: BitmapFont<'static> = BitmapFont {
bitmap: ImageRaw::new_binary(
bitmap: ImageRaw::new(
// 96 x 132 (1584)
&[
0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x85, 0x14, 0x11,
Expand Down Expand Up @@ -532,7 +533,7 @@ pub const FONT_6x12: BitmapFont<'static> = BitmapFont {
/// Font License: <https://github.com/sunaku/tamzen-font/blob/master/LICENSE>
#[allow(non_upper_case_globals)]
pub const FONT_6x12_BOLD: BitmapFont<'static> = BitmapFont {
bitmap: ImageRaw::new_binary(
bitmap: ImageRaw::new(
// 96 x 132 (1584)
&[
0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x8d, 0x94, 0x31,
Expand Down Expand Up @@ -655,7 +656,7 @@ pub const FONT_6x12_BOLD: BitmapFont<'static> = BitmapFont {
/// Font License: <https://github.com/sunaku/tamzen-font/blob/master/LICENSE>
#[allow(non_upper_case_globals)]
pub const FONT_7x13: BitmapFont<'static> = BitmapFont {
bitmap: ImageRaw::new_binary(
bitmap: ImageRaw::new(
// 64 x 247 (1976)
&[
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00,
Expand Down Expand Up @@ -803,7 +804,7 @@ pub const FONT_7x13: BitmapFont<'static> = BitmapFont {
/// Font License: <https://github.com/sunaku/tamzen-font/blob/master/LICENSE>
#[allow(non_upper_case_globals)]
pub const FONT_7x13_BOLD: BitmapFont<'static> = BitmapFont {
bitmap: ImageRaw::new_binary(
bitmap: ImageRaw::new(
// 64 x 247 (1976)
&[
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x41, 0x80, 0x00, 0x00, 0x00,
Expand Down Expand Up @@ -951,7 +952,7 @@ pub const FONT_7x13_BOLD: BitmapFont<'static> = BitmapFont {
/// Font License: <https://github.com/sunaku/tamzen-font/blob/master/LICENSE>
#[allow(non_upper_case_globals)]
pub const FONT_7x14: BitmapFont<'static> = BitmapFont {
bitmap: ImageRaw::new_binary(
bitmap: ImageRaw::new(
// 64 x 266 (2128)
&[
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
Expand Down Expand Up @@ -1108,7 +1109,7 @@ pub const FONT_7x14: BitmapFont<'static> = BitmapFont {
/// Font License: <https://github.com/sunaku/tamzen-font/blob/master/LICENSE>
#[allow(non_upper_case_globals)]
pub const FONT_7x14_BOLD: BitmapFont<'static> = BitmapFont {
bitmap: ImageRaw::new_binary(
bitmap: ImageRaw::new(
// 64 x 266 (2128)
&[
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
Expand Down Expand Up @@ -1265,7 +1266,7 @@ pub const FONT_7x14_BOLD: BitmapFont<'static> = BitmapFont {
/// Font License: <https://github.com/sunaku/tamzen-font/blob/master/LICENSE>
#[allow(non_upper_case_globals)]
pub const FONT_8x15: BitmapFont<'static> = BitmapFont {
bitmap: ImageRaw::new_binary(
bitmap: ImageRaw::new(
// 128 x 165 (2640)
&[
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
Expand Down Expand Up @@ -1454,7 +1455,7 @@ pub const FONT_8x15: BitmapFont<'static> = BitmapFont {
/// Font License: <https://github.com/sunaku/tamzen-font/blob/master/LICENSE>
#[allow(non_upper_case_globals)]
pub const FONT_8x15_BOLD: BitmapFont<'static> = BitmapFont {
bitmap: ImageRaw::new_binary(
bitmap: ImageRaw::new(
// 128 x 165 (2640)
&[
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
Expand Down Expand Up @@ -1643,7 +1644,7 @@ pub const FONT_8x15_BOLD: BitmapFont<'static> = BitmapFont {
/// Font License: <https://github.com/sunaku/tamzen-font/blob/master/LICENSE>
#[allow(non_upper_case_globals)]
pub const FONT_8x16: BitmapFont<'static> = BitmapFont {
bitmap: ImageRaw::new_binary(
bitmap: ImageRaw::new(
// 128 x 176 (2816)
&[
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
Expand Down Expand Up @@ -1843,7 +1844,7 @@ pub const FONT_8x16: BitmapFont<'static> = BitmapFont {
/// Font License: <https://github.com/sunaku/tamzen-font/blob/master/LICENSE>
#[allow(non_upper_case_globals)]
pub const FONT_8x16_BOLD: BitmapFont<'static> = BitmapFont {
bitmap: ImageRaw::new_binary(
bitmap: ImageRaw::new(
// 128 x 176 (2816)
&[
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
Expand Down Expand Up @@ -2043,7 +2044,7 @@ pub const FONT_8x16_BOLD: BitmapFont<'static> = BitmapFont {
/// Font License: <https://github.com/sunaku/tamzen-font/blob/master/LICENSE>
#[allow(non_upper_case_globals)]
pub const FONT_10x20: BitmapFont<'static> = BitmapFont {
bitmap: ImageRaw::new_binary(
bitmap: ImageRaw::new(
// 192 x 180 (4320)
&[
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
Expand Down Expand Up @@ -2337,7 +2338,7 @@ pub const FONT_10x20: BitmapFont<'static> = BitmapFont {
/// Font License: <https://github.com/sunaku/tamzen-font/blob/master/LICENSE>
#[allow(non_upper_case_globals)]
pub const FONT_10x20_BOLD: BitmapFont<'static> = BitmapFont {
bitmap: ImageRaw::new_binary(
bitmap: ImageRaw::new(
// 192 x 180 (4320)
&[
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
Expand Down

0 comments on commit 35eaf8a

Please sign in to comment.