From 7420dbe67a2b8387a703e9ac60a3f0b5eefc90f2 Mon Sep 17 00:00:00 2001 From: Cryptex <64497526+Cryptex-github@users.noreply.github.com> Date: Sat, 14 Oct 2023 16:02:31 -0700 Subject: [PATCH 1/7] Update workflow to latest --- .github/workflows/benchmark.yml | 17 +++++++---------- .github/workflows/docs.yml | 10 ++++------ .github/workflows/rust-checks.yml | 10 ++++------ .github/workflows/wasm.yml | 9 +++------ 4 files changed, 18 insertions(+), 28 deletions(-) diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml index 0f4cb3b5a..eb216e038 100644 --- a/.github/workflows/benchmark.yml +++ b/.github/workflows/benchmark.yml @@ -18,16 +18,13 @@ jobs: url: "https://jay3332.github.io/ril/benchmark/index.html" steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Install latest stable Rust toolchain - uses: actions-rs/toolchain@v1 - with: - toolchain: stable - override: true + uses: dtolnay/rust-toolchain@stable - name: Setup cache - uses: Swatinem/rust-cache@v1 + uses: Swatinem/rust-cache@v2 - name: Install gnuplot and neofetch run: sudo apt update && sudo apt install gnuplot neofetch @@ -36,12 +33,12 @@ jobs: run: neofetch --stdout - name: Install cargo-criterion - uses: zbraniecki/cached-cargo-install@v0 + uses: Cryptex-github/cached-cargo-install@main with: crate-name: cargo-criterion - name: Install criterion-table - uses: zbraniecki/cached-cargo-install@v0 + uses: Cryptex-github/cached-cargo-install@main with: crate-name: criterion-table @@ -61,7 +58,7 @@ jobs: run: cat BENCHMARKS.md >> $GITHUB_STEP_SUMMARY - name: Append benchmark webpage to job summary - run: echo "For more details, visit [https://jay3332.github.io/ril/benchmark/index.html](https://jay3332.github.io/ril/benchmark/index.html)" > $GITHUB_STEP_SUMMARY + run: echo "For more details, visit [https://jay3332.github.io/ril/benchmark/index.html](https://jay3332.github.io/ril/benchmark/index.html)" >> $GITHUB_STEP_SUMMARY - name: Deploy uses: peaceiris/actions-gh-pages@v3 @@ -82,4 +79,4 @@ jobs: publish_branch: benchmarks - name: Set output URL - run: echo "::set-output name=env_url::https://jay3332.github.io/ril/benchmark/index.html" + run: echo "env_url=https://jay3332.github.io/ril/benchmark/index.html" >> $GITHUB_OUTPUT diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 643be698e..098814c0d 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -14,24 +14,22 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Install latest stable Rust toolchain with clippy - uses: actions-rs/toolchain@v1 + uses: dtolnay/rust-toolchain@stable with: - toolchain: stable - override: true components: clippy - name: Setup cache - uses: Swatinem/rust-cache@v1 + uses: Swatinem/rust-cache@v2 - name: Build rustdocs run: cargo doc --no-deps --all-features env: RUSTDOCFLAGS: --cfg docsrs - - run: echo "" > target/doc/index.html + - run: echo "" >> target/doc/index.html - run: cp -r target/doc ./docs - name: Deploy diff --git a/.github/workflows/rust-checks.yml b/.github/workflows/rust-checks.yml index e0292a9a1..9955cc734 100644 --- a/.github/workflows/rust-checks.yml +++ b/.github/workflows/rust-checks.yml @@ -14,17 +14,15 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Install latest stable Rust toolchain with clippy - uses: actions-rs/toolchain@v1 + uses: dtolnay/rust-toolchain@stable with: - toolchain: stable - override: true - components: clippy + component: clippy - name: Setup cache - uses: Swatinem/rust-cache@v1 + uses: Swatinem/rust-cache@v2 - name: Build run: cargo build --features=all --verbose diff --git a/.github/workflows/wasm.yml b/.github/workflows/wasm.yml index aa94e079c..018b8c80d 100644 --- a/.github/workflows/wasm.yml +++ b/.github/workflows/wasm.yml @@ -14,19 +14,16 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Install latest stable Rust toolchain - uses: actions-rs/toolchain@v1 - with: - toolchain: stable - override: true + uses: dtolnay/rust-toolchain@stable - name: Add wasm targets run: rustup target add wasm32-unknown-unknown wasm32-wasi - name: Setup cache - uses: Swatinem/rust-cache@v1 + uses: Swatinem/rust-cache@v2 - name: Build wasm32-unknown-unknown run: cargo build --features=all-pure --target wasm32-unknown-unknown From d2575fbac7d524239813f3df8d56cfb1ad6e4647 Mon Sep 17 00:00:00 2001 From: Cryptex <64497526+Cryptex-github@users.noreply.github.com> Date: Sat, 14 Oct 2023 16:06:43 -0700 Subject: [PATCH 2/7] Update field name --- .github/workflows/rust-checks.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/rust-checks.yml b/.github/workflows/rust-checks.yml index 9955cc734..390160f17 100644 --- a/.github/workflows/rust-checks.yml +++ b/.github/workflows/rust-checks.yml @@ -19,7 +19,7 @@ jobs: - name: Install latest stable Rust toolchain with clippy uses: dtolnay/rust-toolchain@stable with: - component: clippy + components: clippy - name: Setup cache uses: Swatinem/rust-cache@v2 From 26d0f2424ae6fe204698a33efce3201b674a79bf Mon Sep 17 00:00:00 2001 From: backwardspy Date: Mon, 18 Mar 2024 20:28:46 +0000 Subject: [PATCH 3/7] fix: use correct font for pushed segment in TextLayout --- src/text.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/text.rs b/src/text.rs index 4229e18b4..3ab108253 100644 --- a/src/text.rs +++ b/src/text.rs @@ -503,7 +503,7 @@ impl<'a, P: Pixel> TextLayout<'a, P> { &TextStyle::with_user_data( &segment.text, segment.size, - 0, + self.fonts.len() - 1, (segment.fill, segment.overlay), ), ); From d0da14e46bff0614879782006ac0ea37c2033b43 Mon Sep 17 00:00:00 2001 From: backwardspy Date: Mon, 18 Mar 2024 21:17:59 +0000 Subject: [PATCH 4/7] fix: duplication when text is centered with default anchors --- src/text.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/text.rs b/src/text.rs index 4229e18b4..5594975d2 100644 --- a/src/text.rs +++ b/src/text.rs @@ -698,8 +698,12 @@ impl<'a, P: Pixel> Draw

for TextLayout<'a, P> { let image = &mut *image; // Skips the calculation of offsets - if self.x_anchor == HorizontalAnchor::Left && self.y_anchor == VerticalAnchor::Top { + if self.x_anchor == HorizontalAnchor::Left + && self.y_anchor == VerticalAnchor::Top + && self.align == TextAlign::Left + { render_layout(image, &self.fonts, &self.inner); + return; } let (widths, max_width, fx, ox, oy) = self.calculate_offsets(); From eb88f6906e0d635ddc5b90162e60f85b7da21eef Mon Sep 17 00:00:00 2001 From: Jay3332 <40323796+jay3332@users.noreply.github.com> Date: Mon, 18 Mar 2024 19:54:15 -0400 Subject: [PATCH 5/7] add text fixes to changelog --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 211d53d53..a8eec6909 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,10 @@ Versions prior to v0.7 are not tagged/released on GitHub. ## v0.11 (dev) - Add `PngEncoderOptions::new` +### Bug fixes +- Fix text alignment rendering duplicately ([#28]) +- Fix `TextLayout`s with varying fonts not registering properly ([#29]) + ## v0.10.1 (2023-10-14) - Fix encoding image sequences not respecting delay and disposal method From c004ec0827d42ada18731ed1b02b3951f17b3a1a Mon Sep 17 00:00:00 2001 From: Jay3332 <40323796+jay3332@users.noreply.github.com> Date: Mon, 18 Mar 2024 19:56:30 -0400 Subject: [PATCH 6/7] fix links in changelog --- CHANGELOG.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a8eec6909..8f5c3485a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,8 +9,8 @@ Versions prior to v0.7 are not tagged/released on GitHub. - Add `PngEncoderOptions::new` ### Bug fixes -- Fix text alignment rendering duplicately ([#28]) -- Fix `TextLayout`s with varying fonts not registering properly ([#29]) +- Fix text alignment rendering duplicately ([#28](https://github.com/jay3332/ril/issues/28)) +- Fix `TextLayout`s with varying fonts not registering properly ([#29](https://github.com/jay3332/ril/issues/29)) ## v0.10.1 (2023-10-14) From b9a750303c1068797ed3a8f22ff49c24af737dca Mon Sep 17 00:00:00 2001 From: Mehedi Hasan Date: Sat, 23 Mar 2024 14:02:59 +0600 Subject: [PATCH 7/7] fix: remove invalid semicolon from README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 652e84170..371991b4c 100644 --- a/README.md +++ b/README.md @@ -313,7 +313,7 @@ let layout = TextLayout::new() .centered() // Shorthand for centering horizontally and vertically .with_wrap(WrapStyle::Word) // RIL supports word wrapping .with_width(image.width()) // This is the width to wrap text at. Only required if you want to wrap text. - .with_position(x, y); // Position the anchor (which is the center) at the center of the image + .with_position(x, y) // Position the anchor (which is the center) at the center of the image .with_segment(&TextSegment::new(&font, "Here is some ", Rgb::white())) .with_segment(&TextSegment::new(&bold, "bold ", Rgb::white())) .with_segment(&TextSegment::new(&font, "text.", Rgb::white()));