1/*
2 * %W% %E%
3 *
4 * (C) Copyright IBM Corp. 1998-2013 - All Rights Reserved
5 *
6 */
7
8#ifndef __LOOKUPPROCESSOR_H
9#define __LOOKUPPROCESSOR_H
10
11/**
12 * \file
13 * \internal
14 */
15
16#include "LETypes.h"
17#include "LEFontInstance.h"
18#include "OpenTypeTables.h"
19#include "LETableReference.h"
20//#include "Lookups.h"
21//#include "Features.h"
22
23U_NAMESPACE_BEGIN
24
25class  LEFontInstance;
26class  LEGlyphStorage;
27class  GlyphIterator;
28class  GlyphPositionAdjustments;
29struct FeatureTable;
30struct FeatureListTable;
31struct GlyphDefinitionTableHeader;
32struct LookupSubtable;
33struct LookupTable;
34
35class LookupProcessor : public UMemory {
36public:
37    le_int32 process(LEGlyphStorage &glyphStorage, GlyphPositionAdjustments *glyphPositionAdjustments,
38                 le_bool rightToLeft, const LEReferenceTo<GlyphDefinitionTableHeader> &glyphDefinitionTableHeader, const LEFontInstance *fontInstance, LEErrorCode& success) const;
39
40    le_uint32 applyLookupTable(const LEReferenceTo<LookupTable> &lookupTable, GlyphIterator *glyphIterator, const LEFontInstance *fontInstance, LEErrorCode& success) const;
41
42    le_uint32 applySingleLookup(le_uint16 lookupTableIndex, GlyphIterator *glyphIterator, const LEFontInstance *fontInstance, LEErrorCode& success) const;
43
44    virtual le_uint32 applySubtable(const LEReferenceTo<LookupSubtable> &lookupSubtable, le_uint16 subtableType,
45        GlyphIterator *glyphIterator, const LEFontInstance *fontInstance, LEErrorCode& success) const = 0;
46
47    virtual ~LookupProcessor();
48
49    const LETableReference &getReference() const { return fReference; }
50
51protected:
52    LookupProcessor(const LETableReference &baseAddress,
53        Offset scriptListOffset,
54        Offset featureListOffset,
55        Offset lookupListOffset,
56        LETag scriptTag,
57        LETag languageTag,
58        const FeatureMap *featureMap,
59        le_int32 featureMapCount,
60        le_bool orderFeatures,
61        LEErrorCode& success);
62
63    LookupProcessor();
64
65    le_int32 selectLookups(const LEReferenceTo<FeatureTable> &featureTable, FeatureMask featureMask, le_int32 order, LEErrorCode &success);
66
67    LEReferenceTo<LookupListTable>   lookupListTable;
68    LEReferenceTo<FeatureListTable>  featureListTable;
69
70    FeatureMask            *lookupSelectArray;
71    le_uint32              lookupSelectCount;
72
73    le_uint16               *lookupOrderArray;
74    le_uint32               lookupOrderCount;
75
76    LETableReference        fReference;
77
78private:
79
80    LookupProcessor(const LookupProcessor &other); // forbid copying of this class
81    LookupProcessor &operator=(const LookupProcessor &other); // forbid copying of this class
82};
83
84U_NAMESPACE_END
85#endif
86