os/textandloc/fontservices/textshaperplugin/include/cmaps.h
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
sl@0
     1
/***************************************************************************
sl@0
     2
*
sl@0
     3
*   Copyright (C) 1998-2003, International Business Machines
sl@0
     4
*   Corporation and others.  All Rights Reserved.
sl@0
     5
*
sl@0
     6
************************************************************************/
sl@0
     7
sl@0
     8
sl@0
     9
#ifndef __CMAPS_H
sl@0
    10
#define __CMAPS_H
sl@0
    11
sl@0
    12
#include "LETypes.h"
sl@0
    13
#include "sfnt.h"
sl@0
    14
sl@0
    15
class CMAPMapper
sl@0
    16
{
sl@0
    17
public:
sl@0
    18
    virtual LEGlyphID unicodeToGlyph(LEUnicode32 unicode32) const = 0;
sl@0
    19
sl@0
    20
    virtual ~CMAPMapper();
sl@0
    21
sl@0
    22
    static CMAPMapper *createUnicodeMapper(const CMAPTable *cmap);
sl@0
    23
sl@0
    24
protected:
sl@0
    25
    CMAPMapper(const CMAPTable *cmap);
sl@0
    26
sl@0
    27
    CMAPMapper() {};
sl@0
    28
sl@0
    29
private:
sl@0
    30
    const CMAPTable *fcmap;
sl@0
    31
};
sl@0
    32
sl@0
    33
class CMAPFormat4Mapper : public CMAPMapper
sl@0
    34
{
sl@0
    35
public:
sl@0
    36
    CMAPFormat4Mapper(const CMAPTable *cmap, const CMAPFormat4Encoding *header);
sl@0
    37
sl@0
    38
    virtual ~CMAPFormat4Mapper();
sl@0
    39
sl@0
    40
    virtual LEGlyphID unicodeToGlyph(LEUnicode32 unicode32) const;
sl@0
    41
sl@0
    42
protected:
sl@0
    43
    CMAPFormat4Mapper() {};
sl@0
    44
sl@0
    45
private:
sl@0
    46
    le_uint16       fEntrySelector;
sl@0
    47
    le_uint16       fRangeShift;
sl@0
    48
    const le_uint16 *fEndCodes;
sl@0
    49
    const le_uint16 *fStartCodes;
sl@0
    50
    const le_uint16 *fIdDelta;
sl@0
    51
    const le_uint16 *fIdRangeOffset;
sl@0
    52
};
sl@0
    53
sl@0
    54
class CMAPGroupMapper : public CMAPMapper
sl@0
    55
{
sl@0
    56
public:
sl@0
    57
    CMAPGroupMapper(const CMAPTable *cmap, const CMAPGroup *groups, le_uint32 nGroups);
sl@0
    58
sl@0
    59
    virtual ~CMAPGroupMapper();
sl@0
    60
sl@0
    61
    virtual LEGlyphID unicodeToGlyph(LEUnicode32 unicode32) const;
sl@0
    62
sl@0
    63
protected:
sl@0
    64
    CMAPGroupMapper() {};
sl@0
    65
sl@0
    66
private:
sl@0
    67
    le_int32 fPower;
sl@0
    68
    le_int32 fRangeOffset;
sl@0
    69
    const CMAPGroup *fGroups;
sl@0
    70
};
sl@0
    71
sl@0
    72
inline CMAPMapper::CMAPMapper(const CMAPTable *cmap)
sl@0
    73
    : fcmap(cmap)
sl@0
    74
{
sl@0
    75
    // nothing else to do
sl@0
    76
}
sl@0
    77
sl@0
    78
inline CMAPMapper::~CMAPMapper()
sl@0
    79
{
sl@0
    80
    LE_DELETE_ARRAY(fcmap);
sl@0
    81
}
sl@0
    82
sl@0
    83
#endif
sl@0
    84