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