Skip to content

Commit

Permalink
Make generated PDF files deterministic (#115)
Browse files Browse the repository at this point in the history
  • Loading branch information
jonmmease authored Sep 30, 2023
1 parent 0cc6c40 commit efcbb77
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions vl-convert-pdf/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ fn construct_page(ctx: &mut PdfContext, font_metrics: &HashMap<Font, FontMetrics

// Fonts
let mut resource_fonts = resources.fonts();
for mapped_font in font_metrics.values() {
for mapped_font in font_metrics.values().sorted_by_key(|f| f.font_ref) {
resource_fonts.pair(
Name(mapped_font.font_ref_name.as_slice()),
mapped_font.font_ref,
Expand Down Expand Up @@ -182,7 +182,7 @@ fn write_fonts(
ctx: &mut PdfContext,
font_metrics: &HashMap<Font, FontMetrics>,
) -> Result<(), AnyError> {
for font_specs in font_metrics.values() {
for font_specs in font_metrics.values().sorted_by_key(|f| f.font_ref) {
let cid_ref = ctx.alloc.bump();
let descriptor_ref = ctx.alloc.bump();
let cmap_ref = ctx.alloc.bump();
Expand Down

0 comments on commit efcbb77

Please sign in to comment.