Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main'
Browse files Browse the repository at this point in the history
  • Loading branch information
jay3332 committed Jun 9, 2024
2 parents c96408d + 1eb85bf commit 5d02aa3
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 30 deletions.
17 changes: 7 additions & 10 deletions .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

Expand All @@ -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
Expand All @@ -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
10 changes: 4 additions & 6 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 "<meta http-equiv=\"refresh\" content=\"0; url=ril\">" > target/doc/index.html
- run: echo "<meta http-equiv=\"refresh\" content=\"0; url=ril\">" >> target/doc/index.html
- run: cp -r target/doc ./docs

- name: Deploy
Expand Down
8 changes: 3 additions & 5 deletions .github/workflows/rust-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

- name: Setup cache
uses: Swatinem/rust-cache@v1
uses: Swatinem/rust-cache@v2

- name: Build
run: cargo build --features=all --verbose
Expand Down
9 changes: 3 additions & 6 deletions .github/workflows/wasm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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](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)

- Fix encoding image sequences not respecting delay and disposal method
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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()));
Expand Down
8 changes: 6 additions & 2 deletions src/text.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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),
),
);
Expand Down Expand Up @@ -698,8 +698,12 @@ impl<'a, P: Pixel> Draw<P> 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();
Expand Down

0 comments on commit 5d02aa3

Please sign in to comment.