Skip to content

Commit

Permalink
PDF: remove unnecessary tables from subsetted fonts, compressing PDF …
Browse files Browse the repository at this point in the history
…further
  • Loading branch information
tdewolff committed Apr 20, 2024
1 parent 0fe13f0 commit 79842ec
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions renderers/pdf/writer.go
Original file line number Diff line number Diff line change
Expand Up @@ -257,9 +257,12 @@ func (w *pdfWriter) writeFont(ref pdfRef, font *canvas.Font, vertical bool) {
sfnt := font.SFNT
glyphIDs := w.fontSubset[font].List() // also when not subsetting, to minimize cmap table
if w.subset {
sfntSubset, err := sfnt.Subset(glyphIDs, canvasFont.SubsetOptions{Tables: canvasFont.KeepMinTables})
if sfnt.IsCFF && sfnt.CFF != nil {
sfnt.CFF.SetGlyphNames(nil)
}
sfntSubset, err := sfnt.Subset(glyphIDs, canvasFont.SubsetOptions{Tables: canvasFont.KeepPDFTables})
if err == nil {
// // TODO: report error?
// TODO: report error?
sfnt = sfntSubset
}
}
Expand Down

0 comments on commit 79842ec

Please sign in to comment.