diff --git a/src/export/subset.rs b/src/export/subset.rs index 87e0c6802..fa3b5dde0 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))), @@ -310,6 +313,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(&mut self) -> Option<()> {