diff options
author | Peter Breitenlohner <peb@mppmu.mpg.de> | 2014-07-08 06:44:39 +0000 |
---|---|---|
committer | Peter Breitenlohner <peb@mppmu.mpg.de> | 2014-07-08 06:44:39 +0000 |
commit | eadda9e7616e95abf27cb9c9c208db41371a6cf5 (patch) | |
tree | 909828105d8a9c05d6af749aefbe39f117bbfa7d /Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/include/efont/otfcmap.hh | |
parent | 0b34c5e54c8d047aa6a34af8ced91b29c5e7ad46 (diff) |
lcdf-typetools 2.104
git-svn-id: svn://tug.org/texlive/trunk@34550 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/include/efont/otfcmap.hh')
-rw-r--r-- | Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/include/efont/otfcmap.hh | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/include/efont/otfcmap.hh b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/include/efont/otfcmap.hh new file mode 100644 index 00000000000..3ac7f49f9cd --- /dev/null +++ b/Build/source/texk/lcdf-typetools/lcdf-typetools-2.104/include/efont/otfcmap.hh @@ -0,0 +1,61 @@ +// -*- related-file-name: "../../libefont/otfcmap.cc" -*- +#ifndef EFONT_OTFCMAP_HH +#define EFONT_OTFCMAP_HH +#include <efont/otf.hh> +#include <lcdf/error.hh> +namespace Efont { namespace OpenType { + +class Cmap { public: + + Cmap(const String &, ErrorHandler * = 0); + // default destructor + + bool ok() const { return _error >= 0; } + int error() const { return _error; } + + inline Glyph map_uni(uint32_t c) const; + int map_uni(const Vector<uint32_t> &in, Vector<Glyph> &out) const; + inline void unmap_all(Vector<uint32_t> &g2c) const; + + private: + + String _str; + int _error; + int _ntables; + mutable int _first_unicode_table; + mutable Vector<int> _table_error; + + enum { HEADER_SIZE = 4, ENCODING_SIZE = 8, + HIBYTE_SUBHEADERS = 524 }; + enum Format { F_BYTE = 0, F_HIBYTE = 2, F_SEGMENTED = 4, F_TRIMMED = 6, + F_HIBYTE32 = 8, F_TRIMMED32 = 10, F_SEGMENTED32 = 12 }; + enum { USE_FIRST_UNICODE_TABLE = -2 }; + + int parse_header(ErrorHandler *); + int first_unicode_table() const { return _first_unicode_table; } + int first_table(int platform, int encoding) const; + int check_table(int t, ErrorHandler * = 0) const; + Glyph map_table(int t, uint32_t, ErrorHandler * = 0) const; + void dump_table(int t, Vector<uint32_t> &g2c, ErrorHandler * = 0) const; + inline const uint8_t* table_data(int t) const; + +}; + + +inline Glyph Cmap::map_uni(uint32_t c) const +{ + return map_table(USE_FIRST_UNICODE_TABLE, c, ErrorHandler::default_handler()); +} + +inline void Cmap::unmap_all(Vector<uint32_t> &g2c) const +{ + dump_table(USE_FIRST_UNICODE_TABLE, g2c, ErrorHandler::default_handler()); +} + +inline const uint8_t* Cmap::table_data(int t) const { + const uint8_t* data = _str.udata(); + return data + Data::u32_aligned(data + HEADER_SIZE + t * ENCODING_SIZE + 4); +} + +}} +#endif |