1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
use Result;
use primitive::Fixed;
use tape::{Tape, Value};
#[derive(Clone, Debug, Eq, PartialEq)]
pub enum PostScript {
Version10(PostScript10),
Version30(PostScript30),
}
table! {
#[doc = "PostScript information of version 1.0."]
#[derive(Copy)]
pub PostScript10 {
version (Fixed),
italicAngle (Fixed),
underlinePosition (i16 ),
underlineThickness (i16 ),
isFixedPitch (u32 ),
minMemType42 (u32 ),
maxMemType42 (u32 ),
minMemType1 (u32 ),
maxMemType1 (u32 ),
}
}
pub type PostScript30 = PostScript10;
impl Value for PostScript {
fn read<T: Tape>(tape: &mut T) -> Result<Self> {
Ok(match try!(tape.peek::<Fixed>()) {
Fixed(0x00010000) => PostScript::Version10(try!(Value::read(tape))),
Fixed(0x00030000) => PostScript::Version30(try!(Value::read(tape))),
_ => raise!("the format of the PostScript information is not supported"),
})
}
}