scuffed-code/icu4c/source/test/letest/cmaps.h

85 lines
1.7 KiB
C
Raw Normal View History

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