1#[repr(u32)]
8#[derive(Copy, Clone, Debug)]
9#[allow(non_camel_case_types)]
10pub enum Error {
11 WARN_NOT_ENOUGH_GLYPHS = 1002,
12 WARN_BAD_VERSION = 1001,
13 WARN_NOT_ENOUGH_SPACE_RESERVED = 1000,
14 BITIO_END_OF_FILE = 22,
15 LZCOMP_ERROR = 21,
16 CORRUPT_FILE_PADDING_NOT_ZERO = 20,
17 MALFORMED_HEAD_TABLE = 19,
18 MTX_ERROR = 18,
19 UNKNOWN_BUFFER_WRITE_ERROR = 17,
20 CORRUPT_HOPCODE_DATA = 16,
21 NO_HDMX_TABLE = 15,
22 NO_HMTX_TABLE = 14,
23 NO_HEAD_TABLE = 13,
24 NO_MAXP_TABLE = 12,
25 LOGIC_ERROR = 11,
26 THIRD_STREAM_INCOMPLETE = 6,
27 SECOND_STREAM_INCOMPLETE = 5,
28 CORRUPT_FILE = 4,
29 BOGUS_STRING_SIZE = 3,
30 HEADER_TOO_BIG = 2,
31 INSUFFICIENT_BYTES = 1,
32}
33
34impl std::fmt::Display for Error {
35 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
36 write!(f, "{}", match self {
37 Error::WARN_NOT_ENOUGH_GLYPHS => "Not enough glyphs",
38 Error::WARN_BAD_VERSION => "Incorrect version in EOT header",
39 Error::WARN_NOT_ENOUGH_SPACE_RESERVED => "Not enough space reserved",
40 Error::BITIO_END_OF_FILE => "Unexpected end of file",
41 Error::LZCOMP_ERROR => "LZCOMP error",
42 Error::CORRUPT_FILE_PADDING_NOT_ZERO => "Corrupt file: padding is not zeroed",
43 Error::MALFORMED_HEAD_TABLE => "Malformed HEAD table",
44 Error::MTX_ERROR => "Couldn't decode MTX data",
45 Error::UNKNOWN_BUFFER_WRITE_ERROR => "Unknown buffer write error. This may be a bug in libeot.",
46 Error::CORRUPT_HOPCODE_DATA => "Corrupt hopcode data",
47 Error::NO_HDMX_TABLE => "No HDMX table",
48 Error::NO_HMTX_TABLE => "No HMTX table",
49 Error::NO_HEAD_TABLE => "No HEAD table",
50 Error::NO_MAXP_TABLE => "No MAXP table",
51 Error::LOGIC_ERROR => "Logic error. This may be a bug in libeot.",
52 Error::THIRD_STREAM_INCOMPLETE => "Third data stream incomplete",
53 Error::SECOND_STREAM_INCOMPLETE => "Second data stream incomplete",
54 Error::CORRUPT_FILE => "Corrupt data",
55 Error::BOGUS_STRING_SIZE => "Corrupt data: bogus string size",
56 Error::HEADER_TOO_BIG => "Corrupt data: header too big",
57 Error::INSUFFICIENT_BYTES => "Font file is truncated",
58 })
59 }
60}
61
62impl From<crate::stream::Error> for Error {
63 fn from(_: crate::stream::Error) -> Error {
64 Error::LOGIC_ERROR
65 }
66}
67
68#[derive(Clone)]
69#[repr(C)]
70pub struct EOTRootStringInfo {
71 pub root_string_size: u16,
72 pub root_string: *mut u16,
73}
74
75#[derive(Clone)]
76#[repr(C)]
77pub struct EUDCInfo {
78 pub exists: bool,
79 pub code_page: u32,
80 pub flags: u32,
81 pub font_data: Vec<u8>,
82}
83
84pub type EOTVersion = ::core::ffi::c_uint;
85pub const VERSION_3: EOTVersion = 3;
86pub const VERSION_2: EOTVersion = 2;
87pub const VERSION_1: EOTVersion = 1;
88
89pub type EOTCharset = ::core::ffi::c_uint;
90pub const OEM_CHARSET: EOTCharset = 255;
91pub const EASTEUROPE_CHARSET: EOTCharset = 238;
92pub const THAI_CHARSET: EOTCharset = 222;
93pub const RUSSIAN_CHARSET: EOTCharset = 204;
94pub const BALTIC_CHARSET: EOTCharset = 186;
95pub const ARABIC_CHARSET: EOTCharset = 178;
96pub const HEBREW_CHARSET: EOTCharset = 177;
97pub const VIETNAMESE_CHARSET: EOTCharset = 163;
98pub const TURKISH_CHARSET: EOTCharset = 162;
99pub const GREEK_CHARSET: EOTCharset = 161;
100pub const CHINESEBIG5_CHARSET: EOTCharset = 136;
101pub const GB2312_CHARSET: EOTCharset = 134;
102pub const HANGUL_CHARSET: EOTCharset = 131;
103pub const JOHAB_CHARSET: EOTCharset = 130;
104pub const SHIFTJIS_CHARSET: EOTCharset = 128;
105pub const MAC_CHARSET: EOTCharset = 77;
106pub const SYMBOL_CHARSET: EOTCharset = 2;
107pub const DEFAULT_CHARSET: EOTCharset = 1;
108pub const ANSI_CHARSET: EOTCharset = 0;