Skip to content

Commit 58cd87a

Browse files
committed
Minor cleanups
1 parent 99a91e0 commit 58cd87a

7 files changed

Lines changed: 8 additions & 10 deletions

File tree

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1717
- TODO: The CLI options have been (temporarily) removed. They will be readded before the next release.
1818
- TODO: Add tests for CLI and svg options
1919
- TODO: Add CLI option to convert text to paths.
20+
- TODO: Add CI test to test builds with different feature
21+
- TODO: Add text feature?
2022

2123
### Changed
2224
- Bumped resvg to v0.40.

Cargo.lock

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cli/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ miniz_oxide = { workspace = true }
2727
pdf-writer = { workspace = true }
2828
svg2pdf = { workspace = true }
2929
termcolor = { workspace = true }
30-
ttf-parser = "0.20.0"
3130
usvg = { workspace = true }
3231

3332
[features]

cli/src/convert.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ pub fn convert_(input: &PathBuf, output: Option<PathBuf>) -> Result<(), String>
3333
let tree =
3434
usvg::Tree::from_str(&svg, &options, &fontdb).map_err(|err| err.to_string())?;
3535

36-
let pdf = svg2pdf::to_pdf(&tree, Options::default(), fontdb);
36+
let pdf = svg2pdf::to_pdf(&tree, Options::default(), &fontdb);
3737

3838
std::fs::write(output, pdf).map_err(|_| "Failed to write PDF file")?;
3939

src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ impl Default for Options {
128128
/// # Ok(()) }
129129
/// ```
130130
pub fn to_pdf(tree: &Tree, options: Options, fontdb: &fontdb::Database) -> Vec<u8> {
131-
let mut ctx = Context::new(tree, options, &fontdb);
131+
let mut ctx = Context::new(tree, options, fontdb);
132132
let mut pdf = Pdf::new();
133133

134134
let catalog_ref = ctx.alloc_ref();
@@ -279,7 +279,7 @@ pub fn to_chunk(
279279
) -> (Chunk, Ref) {
280280
let mut chunk = Chunk::new();
281281

282-
let mut ctx = Context::new(tree, options, &fontdb);
282+
let mut ctx = Context::new(tree, options, fontdb);
283283
let x_ref = tree_to_xobject(tree, &mut chunk, &mut ctx);
284284
ctx.write_global_objects(&mut chunk);
285285
(chunk, x_ref)

src/render/mod.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,7 @@ pub fn tree_to_stream(
4040
content.restore_state();
4141
}
4242

43-
/// Convert a tree into a XObject of size 1x1, similar to an image. The Ref of that
44-
/// XObject is guaranteed to be the current highest, so you can use `ref.next()` to
45-
/// get the next free ID.
43+
/// Convert a tree into a XObject of size 1x1, similar to an image.
4644
pub fn tree_to_xobject(tree: &Tree, chunk: &mut Chunk, ctx: &mut Context) -> Ref {
4745
let bbox = tree.size().to_non_zero_rect(0.0, 0.0);
4846
let x_ref = ctx.alloc_ref();

src/util/context.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ impl Context {
9090
sgray_ref: None,
9191
};
9292

93-
fill_fonts(tree.root(), &mut ctx, &fontdb);
93+
fill_fonts(tree.root(), &mut ctx, fontdb);
9494

9595
ctx
9696
}
@@ -120,7 +120,7 @@ impl Context {
120120

121121
pub fn write_global_objects(&mut self, pdf: &mut Chunk) {
122122
let allocator = &mut self.ref_allocator;
123-
for (_, font) in &mut self.fonts {
123+
for font in self.fonts.values_mut() {
124124
if let Some(font) = font.as_mut() {
125125
write_font(pdf, allocator, font);
126126
}

0 commit comments

Comments
 (0)