Skip to content
Merged
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
34 changes: 22 additions & 12 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ env:

jobs:

formatting:
linting:
runs-on: ubuntu-latest

steps:
Expand All @@ -23,17 +23,17 @@ jobs:
toolchain: stable
target: thumbv7em-none-eabihf
override: true
components: rustfmt
components: rustfmt, clippy

- name: Check formatting
run: cargo fmt --all -- --check

- name: Run clippy
run: cargo clippy -- -D warnings

build-nostd:
runs-on: ubuntu-latest

needs:
- formatting

steps:
- uses: actions/checkout@v2

Expand All @@ -47,11 +47,24 @@ jobs:
- name: Build no_std
run: cargo build --verbose --target thumbv7em-none-eabihf -Z avoid-dev-deps

build:
build-msrv:
runs-on: ubuntu-latest

needs:
- formatting
steps:
- uses: actions/checkout@v2

- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: 1.61
target: thumbv7em-none-eabihf
override: true

- name: Build with MSRV
run: cargo build

build:
runs-on: ubuntu-latest

strategy:
matrix:
Expand All @@ -65,9 +78,6 @@ jobs:
- name: nightly
rust: nightly

- name: msrv
rust: 1.61.0

steps:
- uses: actions/checkout@v2

Expand Down Expand Up @@ -132,7 +142,7 @@ jobs:
toolchain: stable
target: thumbv7em-none-eabihf
override: true

- name: Check doc links
run: |
cargo doc --color=never &> ./out
Expand Down
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
Unreleased
==========

- [#174] Implement `Default` for `TextBoxStyleBuilder`

[#174]: https://github.com/embedded-graphics/embedded-text/pull/174

0.7.3 (2025-10-10)
==================

Expand Down
7 changes: 7 additions & 0 deletions src/style/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,13 @@ pub struct TextBoxStyleBuilder {
trailing_spaces: Option<bool>,
}

impl Default for TextBoxStyleBuilder {
#[inline]
fn default() -> Self {
Self::new()
}
}

impl TextBoxStyleBuilder {
/// Create a new builder object.
#[inline]
Expand Down
2 changes: 1 addition & 1 deletion src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ pub fn str_width_and_left_offset(renderer: &impl TextRenderer, s: &str) -> (u32,
let tm = renderer.measure_string(s, Point::zero(), Baseline::Top);
(
tm.next_position.x as u32,
tm.bounding_box.top_left.x.min(0).abs() as u32,
tm.bounding_box.top_left.x.min(0).unsigned_abs(),
)
}

Expand Down
Loading