Skip to content

Commit

Permalink
Merge pull request #99 from matiaskorhonen/font-subsetting
Browse files Browse the repository at this point in the history
Font subsetting
  • Loading branch information
matiaskorhonen authored Oct 21, 2023
2 parents df33352 + 34e53dc commit 5841f58
Show file tree
Hide file tree
Showing 4 changed files with 168 additions and 14 deletions.
156 changes: 154 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ age = { version = "0.9.0", features = ["armor", "cli-common"] }
clap = { version = "4.4", features = ["derive"] }
clap-verbosity-flag = "2.0"
exitcode = "1.1.2"
printpdf = { version = "0.6.0", features = ["svg"] }
printpdf = { version = "0.6.0", features = ["svg", "font_subsetting"] }
qrcode = "0.12.0"
log = "0.4"
env_logger = "0.10"
Expand Down
22 changes: 12 additions & 10 deletions bin/generate-variety
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,24 @@
# This script can be used to generate a variety of PDFs for testing while
# developing PaperAge.

set -euo pipefail

function generate_variety {
export PAPERAGE_PASSPHRASE="snakeoil"

echo "Small amount of data"
openssl rand -hex 6 | cargo run -- -vvv -f --page-size a4 -o a4-small.pdf
openssl rand -hex 6 | cargo run -- -vvv -f --page-size letter -o letter-small.pdf
# echo "Small amount of data"
openssl rand -hex 6 | cargo run "$@" -- -vvv -f --page-size a4 -o a4-small.pdf
openssl rand -hex 6 | cargo run "$@" -- -vvv -f --page-size letter -o letter-small.pdf

echo "Small amount of data"
openssl rand -hex 256 | cargo run -- -vvv -f --page-size a4 -o a4-medium.pdf
openssl rand -hex 256 | cargo run -- -vvv -f --page-size letter -o letter-medium.pdf
# echo "Small amount of data"
openssl rand -hex 256 | cargo run "$@" -- -vvv -f --page-size a4 -o a4-medium.pdf
openssl rand -hex 256 | cargo run "$@" -- -vvv -f --page-size letter -o letter-medium.pdf

echo "Large amount of data"
openssl rand -hex 900 | cargo run -- -vvv -f --page-size a4 -o a4-large.pdf
openssl rand -hex 900 | cargo run -- -vvv -f --page-size letter -o letter-large.pdf
# echo "Large amount of data"
openssl rand -hex 900 | cargo run "$@" -- -vvv -f --page-size a4 -o a4-large.pdf
openssl rand -hex 900 | cargo run "$@" -- -vvv -f --page-size letter -o letter-large.pdf

unset PAPERAGE_PASSPHRASE
}

generate_variety
generate_variety "$@"
2 changes: 1 addition & 1 deletion tests/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ fn test_stdout() -> Result<(), Box<dyn std::error::Error>> {

let mut cmd = Command::cargo_bin("paper-age")?;

let output_size = 200 * 1024; // 200 KiB
let output_size = 50 * 1024; // 50 KiB
let len_predicate_fn = predicate::function(|x: &[u8]| x.len() > output_size);

cmd.arg("--output")
Expand Down

0 comments on commit 5841f58

Please sign in to comment.