sl@0: /*************************************************************************** sl@0: * sl@0: * Copyright (C) 1998-2003, International Business Machines sl@0: * Corporation and others. All Rights Reserved. sl@0: * sl@0: ************************************************************************/ sl@0: sl@0: sl@0: #ifndef __CMAPS_H sl@0: #define __CMAPS_H sl@0: sl@0: #include "LETypes.h" sl@0: #include "sfnt.h" sl@0: sl@0: class CMAPMapper sl@0: { sl@0: public: sl@0: virtual LEGlyphID unicodeToGlyph(LEUnicode32 unicode32) const = 0; sl@0: sl@0: virtual ~CMAPMapper(); sl@0: sl@0: static CMAPMapper *createUnicodeMapper(const CMAPTable *cmap); sl@0: sl@0: protected: sl@0: CMAPMapper(const CMAPTable *cmap); sl@0: sl@0: CMAPMapper() {}; sl@0: sl@0: private: sl@0: const CMAPTable *fcmap; sl@0: }; sl@0: sl@0: class CMAPFormat4Mapper : public CMAPMapper sl@0: { sl@0: public: sl@0: CMAPFormat4Mapper(const CMAPTable *cmap, const CMAPFormat4Encoding *header); sl@0: sl@0: virtual ~CMAPFormat4Mapper(); sl@0: sl@0: virtual LEGlyphID unicodeToGlyph(LEUnicode32 unicode32) const; sl@0: sl@0: protected: sl@0: CMAPFormat4Mapper() {}; sl@0: sl@0: private: sl@0: le_uint16 fEntrySelector; sl@0: le_uint16 fRangeShift; sl@0: const le_uint16 *fEndCodes; sl@0: const le_uint16 *fStartCodes; sl@0: const le_uint16 *fIdDelta; sl@0: const le_uint16 *fIdRangeOffset; sl@0: }; sl@0: sl@0: class CMAPGroupMapper : public CMAPMapper sl@0: { sl@0: public: sl@0: CMAPGroupMapper(const CMAPTable *cmap, const CMAPGroup *groups, le_uint32 nGroups); sl@0: sl@0: virtual ~CMAPGroupMapper(); sl@0: sl@0: virtual LEGlyphID unicodeToGlyph(LEUnicode32 unicode32) const; sl@0: sl@0: protected: sl@0: CMAPGroupMapper() {}; sl@0: sl@0: private: sl@0: le_int32 fPower; sl@0: le_int32 fRangeOffset; sl@0: const CMAPGroup *fGroups; sl@0: }; sl@0: sl@0: inline CMAPMapper::CMAPMapper(const CMAPTable *cmap) sl@0: : fcmap(cmap) sl@0: { sl@0: // nothing else to do sl@0: } sl@0: sl@0: inline CMAPMapper::~CMAPMapper() sl@0: { sl@0: LE_DELETE_ARRAY(fcmap); sl@0: } sl@0: sl@0: #endif sl@0: