Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.lock

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

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ hayro-write = "0.3.0"
image = { version = "0.25.1", default-features = false }
imagesize = "0.14.0"
image-webp = "0.2.1"
indexmap = "2.10.0"
krilla = { path = "crates/krilla", version = "0.5.0" }
krilla-svg = { path = "crates/krilla-svg", version = "0.2.0" }
krilla-macros = { path = "crates/krilla-macros" }
Expand Down
1 change: 1 addition & 0 deletions crates/krilla/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ gif = { workspace = true, optional = true }
hayro-write = { workspace = true, optional = true }
image-webp = { workspace = true, optional = true }
imagesize = { workspace = true, optional = true }
indexmap = { workspace = true }
once_cell = { workspace = true }
pdf-writer = { workspace = true }
rayon = { workspace = true, optional = true }
Expand Down
7 changes: 3 additions & 4 deletions crates/krilla/src/serialize.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ use std::ops::{Deref, DerefMut};
use std::rc::Rc;
use std::sync::Arc;

use indexmap::IndexMap;
use pdf_writer::types::{StructRole, StructRole2};
use pdf_writer::writers::{OutputIntent, StructTreeRoot};
use pdf_writer::{Chunk, Finish, Limits, Name, Pdf, Ref, Str, TextStr};
Expand Down Expand Up @@ -655,9 +656,7 @@ impl SerializeContext {

fn serialize_fonts(&mut self) -> KrillaResult<()> {
let fonts = self.global_objects.font_map.take();
let mut sorted = fonts.values().collect::<Vec<_>>();
sorted.sort_by_key(|e| e.borrow().font().sip_hash());
for font_container in sorted {
for font_container in fonts.values() {
let borrowed = font_container.borrow();

if !borrowed.type3_mapper().is_empty() {
Expand Down Expand Up @@ -938,7 +937,7 @@ pub(crate) struct GlobalObjects {
// Needs to be pub(crate) because writing of named destinations happens in `ChunkContainer`.
pub(crate) named_destinations: MaybeTaken<HashMap<NamedDestination, Ref>>,
/// A map from fonts to font container.
font_map: MaybeTaken<HashMap<Font, Rc<RefCell<FontContainer>>>>,
font_map: MaybeTaken<IndexMap<Font, Rc<RefCell<FontContainer>>>>,
/// All XYZ destinations used in the document. The reason we need to store them
/// separately is that we can only serialize them in the very end, once all pages
/// have been written, so that we know the Ref of the page they belong to.
Expand Down
4 changes: 0 additions & 4 deletions crates/krilla/src/text/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -137,10 +137,6 @@ impl FontContainer {
res
}
}

pub(crate) fn font(&self) -> &Font {
&self.font
}
}

pub(crate) trait PdfFont {
Expand Down