| 1 |
// -*- related-file-name: "../../libefont/ttfhead.cc" -*- |
| 2 |
#ifndef EFONT_TTFHEAD_HH |
| 3 |
#define EFONT_TTFHEAD_HH |
| 4 |
#include <efont/otf.hh> |
| 5 |
#include <efont/otfdata.hh> // for ntohl() |
| 6 |
#include <lcdf/error.hh> |
| 7 |
namespace Efont { namespace OpenType { |
| 8 |
|
| 9 |
class Head { public: |
| 10 |
|
| 11 |
Head(const String &, ErrorHandler * = 0); |
| 12 |
// default destructor |
| 13 |
|
| 14 |
bool ok() const { return _error >= 0; } |
| 15 |
int error() const { return _error; } |
| 16 |
|
| 17 |
unsigned units_per_em() const; |
| 18 |
unsigned index_to_loc_format() const; |
| 19 |
|
| 20 |
private: |
| 21 |
|
| 22 |
Data _d; |
| 23 |
int _error; |
| 24 |
|
| 25 |
int parse_header(ErrorHandler *); |
| 26 |
|
| 27 |
}; |
| 28 |
|
| 29 |
|
| 30 |
inline unsigned Head::units_per_em() const |
| 31 |
{ |
| 32 |
return (_error >= 0 ? _d.u16(18) : 0); |
| 33 |
} |
| 34 |
|
| 35 |
inline unsigned Head::index_to_loc_format() const |
| 36 |
{ |
| 37 |
return (_error >= 0 ? _d.u16(50) : 0); |
| 38 |
} |
| 39 |
|
| 40 |
}} |
| 41 |
#endif |