Implement get_table_for_tag on FreeType

Also fixes use-after-free of FontTable buffers.
This commit is contained in:
Matt Brubeck 2015-08-28 14:31:07 -07:00
parent 3f9b6f8586
commit afafb0b71c
10 changed files with 41 additions and 33 deletions

View file

@ -192,10 +192,10 @@ impl FontHandleMethods for FontHandle {
return metrics;
}
fn get_table_for_tag(&self, tag: FontTableTag) -> Option<FontTable> {
fn get_table_for_tag(&self, tag: FontTableTag) -> Option<Box<FontTable>> {
let result: Option<CFData> = self.ctfont.get_font_table(tag);
result.and_then(|data| {
Some(FontTable::wrap(data))
Some(box FontTable::wrap(data))
})
}
}