Skip to content

Commit

Permalink
Merge pull request #134 from dnlmlr/remove-unused-fonts
Browse files Browse the repository at this point in the history
Don't include unused fonts in the PDF document
  • Loading branch information
fschutt committed Mar 13, 2023
2 parents 09958f9 + 248974c commit e412845
Show file tree
Hide file tree
Showing 13 changed files with 489 additions and 37 deletions.
162 changes: 161 additions & 1 deletion Cargo.lock

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

4 changes: 3 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ keywords = ["pdf", "gui", "graphics", "wkhtmltopdf"]
categories = ["gui"]
exclude = ["./assets/*", "./doc/*", "./examples/*"]
autoexamples = false
edition = "2018"
edition = "2021"

[dependencies]
# minimum dependencies
Expand All @@ -35,6 +35,7 @@ image = { version = "0.24.3", optional = true, default-features = false, feature
svg2pdf = { version = "0.1.0", optional = true }
pdf-writer = { version = "0.4.1", optional = true }
usvg = { version = "0.19.0", optional = true }
allsorts = { version = "0.14", optional = true, default-features = false, features = ["flate2_rust"] }

[features]
default = []
Expand All @@ -54,6 +55,7 @@ dds = ["image/dds", "embedded_images"]
webp = ["image/webp", "embedded_images"]
# enables svg
svg = ["svg2pdf", "usvg", "pdf-writer"]
font_subsetting = ["dep:allsorts"]

[package.metadata.docs.rs]
all-features = true
Expand Down
3 changes: 1 addition & 2 deletions src/document_info.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
//! Info dictionary of a PDF document

use crate::OffsetDateTime;
use lopdf;
use crate::PdfMetadata;
use lopdf;
/// "Info" dictionary of a PDF document.
/// Actual data is contained in `DocumentMetadata`, to keep it in sync with the `XmpMetadata`
/// (if the timestamps / settings are not in sync, Preflight will complain)
Expand Down Expand Up @@ -64,7 +64,6 @@ impl DocumentInfo {
use lopdf::Dictionary as LoDictionary;
use lopdf::Object::*;
use lopdf::StringFormat::Literal;
use std::iter::FromIterator;

let trapping = if m.trapping { "True" } else { "False" };
let gts_pdfx_version = m.conformance.get_identifier_string();
Expand Down
2 changes: 0 additions & 2 deletions src/extgstate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -565,7 +565,6 @@ impl From<ExtendedGraphicsState> for lopdf::Object {
/// comparison to the previous one are returned.

fn from(val: ExtendedGraphicsState) -> Self {
use std::iter::FromIterator;
let mut gs_operations = Vec::<(String, lopdf::Object)>::new();

// for each field, look if it was contained in the "changed fields"
Expand Down Expand Up @@ -841,7 +840,6 @@ impl HalftoneType {
}

pub fn into_obj(self) -> Vec<lopdf::Object> {
use std::iter::FromIterator;
vec![Dictionary(lopdf::Dictionary::from_iter(vec![
("Type", "Halftone".into()),
("HalftoneType", self.get_type().into()),
Expand Down
Loading

0 comments on commit e412845

Please sign in to comment.