Debian Codegraph @

texk/lcdf-typetools/lcdf-typetools-src/include/efont/otfpost.hh

raw
1 // -*- related-file-name: "../../libefont/otfpost.cc" -*-
2 #ifndef EFONT_OTFPOST_HH
3 #define EFONT_OTFPOST_HH
4 #include <efont/otfdata.hh>
5 #include <lcdf/error.hh>
6 namespace Efont { namespace OpenType {
7
8 class Post { public:
9
10 Post(const String &, ErrorHandler * = 0);
11 // default destructor
12
13 bool ok() const { return _error >= 0; }
14 int error() const { return _error; }
15
16 double italic_angle() const;
17 bool is_fixed_pitch() const;
18 inline int underline_position() const;
19 inline int underline_thickness() const;
20 inline uint32_t mem_type42(bool ismax) const;
21 int nglyphs() const { return _nglyphs; }
22 bool glyph_names(Vector<PermString> &gnames) const;
23
24 private:
25
26 Data _str;
27 int _error;
28 uint32_t _version;
29 int _nglyphs;
30 Vector<int> _extend_glyph_names;
31
32 enum { HEADER_SIZE = 32, N_MAC_GLYPHS = 258 };
33 int parse_header(ErrorHandler *);
34
35 };
36
37 inline int
38 Post::underline_position() const
39 {
40 // NB: "This is the suggested distance of the top of the underline from
41 // the baseline (negative values indicate below baseline). The PostScript
42 // definition of this FontInfo dictionary key (the y coordinate of the
43 // center of the stroke) is not used for historical reasons. The value of
44 // the PostScript key may be calculated by subtracting half the
45 // underlineThickness from the value of this field." -- OpenType spec
46 return ok() ? _str.s16(8) : 0;
47 }
48
49 inline int
50 Post::underline_thickness() const
51 {
52 return ok() ? _str.s16(10) : 0;
53 }
54
55 inline uint32_t
56 Post::mem_type42(bool ismax) const
57 {
58 return ok() ? _str.u32(ismax ? 20 : 16) : 0;
59 }
60
61 }}
62 #endif