summaryrefslogtreecommitdiff
path: root/src/export/pdf.rs
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2021-08-24 20:12:00 +0200
committerLaurenz <laurmaedje@gmail.com>2021-08-24 23:43:51 +0200
commit6f84cf3c225c80a131fc6b0ab46749331306bc9d (patch)
tree860805754daf2967424daf54192458d45f33b3bd /src/export/pdf.rs
parent7a2e3c80b5a6c0497ea062bce2714c0dfc300dd2 (diff)
Basic subsetting architecture
Constructs a brand new font file where only necessary tables are contained.
Diffstat (limited to 'src/export/pdf.rs')
-rw-r--r--src/export/pdf.rs8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/export/pdf.rs b/src/export/pdf.rs
index 0f1480f3..433dc844 100644
--- a/src/export/pdf.rs
+++ b/src/export/pdf.rs
@@ -13,6 +13,7 @@ use pdf_writer::{
};
use ttf_parser::{name_id, GlyphId, Tag};
+use super::subset;
use crate::color::Color;
use crate::font::{FaceId, FontStore};
use crate::geom::{self, Em, Length, Size};
@@ -387,8 +388,11 @@ impl<'a> PdfExporter<'a> {
cmap.finish()
});
- // Write the face's bytes.
- self.writer.stream(refs.data, face.buffer());
+ // Susbet and write the face's bytes.
+ let original = face.buffer();
+ let subsetted = subset(original, face.index());
+ let data = subsetted.as_deref().unwrap_or(original);
+ self.writer.stream(refs.data, data);
}
}