atsamd icon indicating copy to clipboard operation
atsamd copied to clipboard

Recent version bump broke essentially all text rendering

Open cbiffle opened this issue 2 years ago • 5 comments

PR #591 bumped versions of dependencies. While the PR description described the bump as "minor," many of the crates that were bumped are in the leading-0 phase of semver, meaning that minor version bumps are breaking.

One good example of breakage is the embedded_graphics crate, which appears to have switched the default baseline behavior for text rendering in (I'm guessing) 0.7. As a result, after #591, many of the examples render their text off the screen, and programs that attempt to clear the screen before writing text (the clock examples, say) instead clear a rectangle just beneath the text.

Fixing this generally requires diffs like the following:

diff --git a/boards/wio_terminal/examples/clock.rs b/boards/wio_terminal/examples/clock.rs
index 9e4567f29..2f0c02f72 100644
--- a/boards/wio_terminal/examples/clock.rs
+++ b/boards/wio_terminal/examples/clock.rs
@@ -15,7 +15,7 @@ use eg::mono_font::{ascii::FONT_10X20, MonoTextStyle};
 use eg::pixelcolor::Rgb565;
 use eg::prelude::*;
 use eg::primitives::{PrimitiveStyleBuilder, Rectangle};
-use eg::text::Text;
+use eg::text::{Baseline, Text};
 
 use cortex_m::interrupt::free as disable_interrupts;
 use cortex_m::peripheral::NVIC;
@@ -137,7 +137,7 @@ fn main() -> ! {
             .ok()
             .unwrap();
 
-        Text::new(data.as_str(), Point::new(55, 80), style)
+        Text::with_baseline(data.as_str(), Point::new(55, 80), style, Baseline::Top)
             .draw(&mut display)
             .ok()
             .unwrap();

Anyway, noticed this when I was using your code to get a shiny new Wio Terminal working before I write my own drivers. :-)

cbiffle avatar Apr 13 '22 17:04 cbiffle

If you have the change to fix, please open a PR! Thanks for the report

TDHolmes avatar Apr 13 '22 18:04 TDHolmes

I have the fix for the one example I used to test flashing (above); I'm not equipped to test all the examples. I also can't promise this is the only breaking change in embedded-graphics 0.7.

cbiffle avatar Apr 13 '22 18:04 cbiffle

As you can tell by us breaking the examples, we don't necessarily have all of the hardware on hand at all times either 🙂 even a partial fix PR is appreciated

TDHolmes avatar Apr 13 '22 19:04 TDHolmes

Alrighty, partial fix in #604 then.

cbiffle avatar Apr 14 '22 16:04 cbiffle

As you can tell by us breaking the examples, we don't necessarily have all of the hardware on hand at all times either slightly_smiling_face even a partial fix PR is appreciated

Evidence of, and apology for, our poor behavior

bradleyharden avatar Apr 24 '22 13:04 bradleyharden

@bradleyharden Between the merge of #604 and my pending patches I believe all text rendering in examples should be resolved.

pabigot avatar Dec 04 '22 20:12 pabigot

@pabigot, have all the relevant patches been merged? I think so. If so, we can close. @cbiffle, can you confirm your issues are resolved?

bradleyharden avatar Dec 26 '22 22:12 bradleyharden

@bradleyharden All my patches are in and the examples work for me on the current master branch.

pabigot avatar Dec 27 '22 04:12 pabigot

Ok, I'm going to close then. @cbiffle, feel free to reopen if you're still having an issue.

bradleyharden avatar Dec 27 '22 04:12 bradleyharden