1use std::io::Read;
2
3use cff_parser::{string_by_id, Table};
4
5fn main() {
6 let path = std::env::args().nth(1).expect("no file given");
8 let file = std::fs::File::open(&path).expect("could not open file");
9 let mut reader = std::io::BufReader::new(file);
10 let mut buffer = Vec::new();
11 reader
12 .read_to_end(&mut buffer)
13 .expect("could not read file");
14 let table = Table::parse(&buffer).unwrap();
15
16 let encoding = table.encoding.get_code_to_sid_table(&table.charset);
17 for (cid, sid) in encoding.iter() {
18 println!("{}: {:?}", cid, string_by_id(&table, *sid));
19 }
20}