summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2021-08-27 14:04:44 +0200
committerLaurenz <laurmaedje@gmail.com>2021-08-27 14:08:32 +0200
commitdff2175558962de1ab93c89607a9e0cbdcd1504e (patch)
tree1fa7908ed5470d2b9243d52e5c7262e5321ee5f7
parentfab8bedd29e678cc043e40c292c82285845c9fdb (diff)
Subset post table
-rw-r--r--src/export/subset.rs17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/export/subset.rs b/src/export/subset.rs
index 87e0c680..fa3b5dde 100644
--- a/src/export/subset.rs
+++ b/src/export/subset.rs
@@ -152,6 +152,10 @@ impl<'a> Subsetter<'a> {
| b"kerx" | b"mort" | b"morx" | b"trak" | b"bsln" | b"just"
| b"feat" | b"prop" => {}
+ b"post" => {
+ self.subset_post();
+ }
+
// Loca is created when subsetting glyf.
b"loca" => {}
b"glyf" => {
@@ -167,7 +171,6 @@ impl<'a> Subsetter<'a> {
// TODO: Subset.
// b"sbix" => {}
// b"SVG " => {}
- // b"post" => {}
// All other tables are simply copied.
_ => self.tables.push((tag, Cow::Borrowed(data))),
@@ -311,6 +314,18 @@ impl ToData for TableRecord {
}
impl Subsetter<'_> {
+ /// Subset the post table by removing the name information.
+ fn subset_post(&mut self) -> Option<()> {
+ // Set version to 3.0.
+ let post = self.face.table_data(tg(b"post"))?;
+ let mut new = 0x00030000_u32.to_be_bytes().to_vec();
+ new.extend(post.get(4 .. 32)?);
+ self.tables.push((tg(b"post"), Cow::Owned(new)));
+ Some(())
+ }
+}
+
+impl Subsetter<'_> {
/// Subset the glyf and loca tables.
fn subset_glyf_loca<T: LocaOffset>(&mut self) -> Option<()> {
let loca = self.face.table_data(tg(b"loca"))?;