Skip to content

Commit ea68b3f

Browse files
committed
chore: address clippy comment, add fontconfig install to ubuntu runners
1 parent 75539a0 commit ea68b3f

7 files changed

Lines changed: 62 additions & 39 deletions

File tree

.github/workflows/plotters-backend.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ jobs:
1212
- uses: actions/checkout@v4
1313
with:
1414
submodules: recursive
15+
- name: Install fontconfig
16+
if: runner.os == 'Linux'
17+
run: sudo apt-get update && sudo apt-get install -y fontconfig
1518
- uses: actions-rs/toolchain@v1
1619
with:
1720
toolchain: stable

.github/workflows/plotters-bitmap.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ jobs:
1212
- uses: actions/checkout@v4
1313
with:
1414
submodules: recursive
15+
- name: Install fontconfig
16+
if: runner.os == 'Linux'
17+
run: sudo apt-get update && sudo apt-get install -y fontconfig
1518
- uses: actions-rs/toolchain@v1
1619
with:
1720
toolchain: stable

.github/workflows/plotters-core.yml

Lines changed: 46 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ jobs:
88
runs-on: ubuntu-latest
99
steps:
1010
- uses: actions/checkout@v4
11+
- name: Install fontconfig
12+
run: sudo apt-get update && sudo apt-get install -y fontconfig
1113
- uses: actions-rs/toolchain@v1
1214
with:
1315
profile: minimal
@@ -20,68 +22,77 @@ jobs:
2022
msrv:
2123
runs-on: ubuntu-latest
2224
steps:
23-
- uses: actions/checkout@v4
24-
with:
25+
- uses: actions/checkout@v4
26+
with:
2527
submodules: recursive
26-
- uses: actions-rs/toolchain@v1
27-
with:
28-
toolchain: 1.56.0
28+
- name: Install fontconfig
29+
run: sudo apt-get update && sudo apt-get install -y fontconfig
30+
- uses: actions-rs/toolchain@v1
31+
with:
32+
toolchain: 1.88.0
2933
override: true
3034
args: --all-features
3135
build_and_test:
3236
runs-on: ${{ matrix.os }}
3337
strategy:
34-
matrix:
35-
os: [ubuntu-latest, windows-latest, macos-latest]
38+
matrix:
39+
os: [ubuntu-latest, windows-latest, macos-latest]
3640
steps:
37-
- uses: actions/checkout@v4
38-
with:
41+
- uses: actions/checkout@v4
42+
with:
3943
submodules: recursive
40-
- uses: actions-rs/toolchain@v1
41-
with:
44+
- name: Install fontconfig
45+
if: runner.os == 'Linux'
46+
run: sudo apt-get update && sudo apt-get install -y fontconfig
47+
- uses: actions-rs/toolchain@v1
48+
with:
4249
toolchain: stable
4350
override: true
44-
- uses: actions-rs/cargo@v1
45-
with:
51+
- uses: actions-rs/cargo@v1
52+
with:
4653
command: test
4754
args: --verbose
48-
- uses: actions-rs/cargo@v1
49-
with:
55+
- uses: actions-rs/cargo@v1
56+
with:
5057
command: test
5158
args: --verbose --no-default-features --features=svg_backend --lib
5259
test_all_features:
5360
runs-on: ubuntu-latest
5461
steps:
55-
- uses: actions/checkout@v4
56-
with:
62+
- uses: actions/checkout@v4
63+
with:
5764
submodules: recursive
58-
- uses: actions-rs/toolchain@v1
59-
with:
65+
- name: Install fontconfig
66+
run: sudo apt-get update && sudo apt-get install -y fontconfig
67+
- uses: actions-rs/toolchain@v1
68+
with:
6069
toolchain: stable
6170
override: true
62-
- uses: actions-rs/cargo@v1
63-
with:
71+
- uses: actions-rs/cargo@v1
72+
with:
6473
command: test
6574
args: --verbose --all-features
6675
run_all_examples:
6776
runs-on: ubuntu-latest
6877
steps:
69-
- uses: actions/checkout@v4
70-
with:
78+
- uses: actions/checkout@v4
79+
with:
7180
submodules: recursive
72-
- uses: actions-rs/cargo@v1
73-
with:
81+
- name: Install fontconfig
82+
run: sudo apt-get update && sudo apt-get install -y fontconfig
83+
- uses: actions-rs/cargo@v1
84+
with:
7485
command: build
7586
args: --verbose --release --examples
76-
- name: Run all the examples
77-
run: |
78-
cd plotters
79-
for example in examples/*.rs
80-
do
81-
../target/release/examples/$(basename ${example} .rs)
82-
done
83-
tar -czvf example-outputs.tar.gz plotters-doc-data
84-
- uses: actions/upload-artifact@v4
85-
with:
87+
- name: Run all the examples
88+
run: |
89+
cd plotters
90+
for example in examples/*.rs
91+
do
92+
../target/release/examples/$(basename ${example} .rs)
93+
done
94+
tar -czvf example-outputs.tar.gz plotters-doc-data
95+
- uses: actions/upload-artifact@v4
96+
with:
8697
name: example-outputs
8798
path: plotters/example-outputs.tar.gz

.github/workflows/plotters-svg.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ jobs:
1212
- uses: actions/checkout@v4
1313
with:
1414
submodules: recursive
15+
- name: Install fontconfig
16+
if: runner.os == 'Linux'
17+
run: sudo apt-get update && sudo apt-get install -y fontconfig
1518
- uses: actions-rs/toolchain@v1
1619
with:
1720
toolchain: stable

.github/workflows/rust-clippy.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ jobs:
2929
- name: Checkout code
3030
uses: actions/checkout@v4
3131

32+
- name: Install fontconfig
33+
run: sudo apt-get update && sudo apt-get install -y fontconfig
34+
3235
- name: Install Rust toolchain
3336
uses: actions-rs/toolchain@16499b5e05bf2e26879000db0c1d13f7e13fa3af #@v1
3437
with:

.github/workflows/wasm.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ jobs:
1111
- uses: actions/checkout@v4
1212
with:
1313
submodules: recursive
14+
- name: Install fontconfig
15+
run: sudo apt-get update && sudo apt-get install -y fontconfig
1416
- name: Install WASM tool chain
1517
run: rustup target add wasm32-unknown-unknown
1618
- name: Check WASM Target Compiles

plotters/src/style/font/ttf.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -230,13 +230,11 @@ impl FontData for FontDataInternal {
230230
for dy in 0..height {
231231
for dx in 0..width {
232232
let alpha = image.data[dy * width + dx] as f32 / 255.0;
233-
if let Err(e) = draw(
233+
draw(
234234
base_x + image.placement.left + dx as i32,
235235
base_y - image.placement.top + dy as i32,
236236
alpha,
237-
) {
238-
return Err(e);
239-
}
237+
)?
240238
}
241239
}
242240
}

0 commit comments

Comments
 (0)