1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/textandloc/fontservices/textshaperplugin/test/letest/cmaps.h Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,84 @@
1.4 +/***************************************************************************
1.5 +*
1.6 +* Copyright (C) 1998-2003, International Business Machines
1.7 +* Corporation and others. All Rights Reserved.
1.8 +*
1.9 +************************************************************************/
1.10 +
1.11 +
1.12 +#ifndef __CMAPS_H
1.13 +#define __CMAPS_H
1.14 +
1.15 +#include "LETypes.h"
1.16 +#include "sfnt.h"
1.17 +
1.18 +class CMAPMapper
1.19 +{
1.20 +public:
1.21 + virtual LEGlyphID unicodeToGlyph(LEUnicode32 unicode32) const = 0;
1.22 +
1.23 + virtual ~CMAPMapper();
1.24 +
1.25 + static CMAPMapper *createUnicodeMapper(const CMAPTable *cmap);
1.26 +
1.27 +protected:
1.28 + CMAPMapper(const CMAPTable *cmap);
1.29 +
1.30 + CMAPMapper() {};
1.31 +
1.32 +private:
1.33 + const CMAPTable *fcmap;
1.34 +};
1.35 +
1.36 +class CMAPFormat4Mapper : public CMAPMapper
1.37 +{
1.38 +public:
1.39 + CMAPFormat4Mapper(const CMAPTable *cmap, const CMAPFormat4Encoding *header);
1.40 +
1.41 + virtual ~CMAPFormat4Mapper();
1.42 +
1.43 + virtual LEGlyphID unicodeToGlyph(LEUnicode32 unicode32) const;
1.44 +
1.45 +protected:
1.46 + CMAPFormat4Mapper() {};
1.47 +
1.48 +private:
1.49 + le_uint16 fEntrySelector;
1.50 + le_uint16 fRangeShift;
1.51 + const le_uint16 *fEndCodes;
1.52 + const le_uint16 *fStartCodes;
1.53 + const le_uint16 *fIdDelta;
1.54 + const le_uint16 *fIdRangeOffset;
1.55 +};
1.56 +
1.57 +class CMAPGroupMapper : public CMAPMapper
1.58 +{
1.59 +public:
1.60 + CMAPGroupMapper(const CMAPTable *cmap, const CMAPGroup *groups, le_uint32 nGroups);
1.61 +
1.62 + virtual ~CMAPGroupMapper();
1.63 +
1.64 + virtual LEGlyphID unicodeToGlyph(LEUnicode32 unicode32) const;
1.65 +
1.66 +protected:
1.67 + CMAPGroupMapper() {};
1.68 +
1.69 +private:
1.70 + le_int32 fPower;
1.71 + le_int32 fRangeOffset;
1.72 + const CMAPGroup *fGroups;
1.73 +};
1.74 +
1.75 +inline CMAPMapper::CMAPMapper(const CMAPTable *cmap)
1.76 + : fcmap(cmap)
1.77 +{
1.78 + // nothing else to do
1.79 +}
1.80 +
1.81 +inline CMAPMapper::~CMAPMapper()
1.82 +{
1.83 + LE_DELETE_ARRAY(fcmap);
1.84 +}
1.85 +
1.86 +#endif
1.87 +