~ubuntu-branches/ubuntu/quantal/icu/quantal

« back to all changes in this revision

Viewing changes to source/layout/MorphTables.cpp

  • Committer: Package Import Robot
  • Author(s): Yves Arrouye
  • Date: 2002-03-03 15:31:13 UTC
  • Revision ID: package-import@ubuntu.com-20020303153113-3ssceqlq45xbmbnc
Tags: upstream-2.0-2.1pre20020303
ImportĀ upstreamĀ versionĀ 2.0-2.1pre20020303

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * %W% %W%
 
3
 *
 
4
 * (C) Copyright IBM Corp. 1998, 1999, 2000, 2001 - All Rights Reserved
 
5
 *
 
6
 */
 
7
 
 
8
 
 
9
#include "LETypes.h"
 
10
#include "LayoutTables.h"
 
11
#include "MorphTables.h"
 
12
#include "SubtableProcessor.h"
 
13
#include "IndicRearrangementProcessor.h"
 
14
#include "ContextualGlyphSubstProc.h"
 
15
#include "LigatureSubstProc.h"
 
16
#include "NonContextualGlyphSubstProc.h"
 
17
//#include "ContextualGlyphInsertionProcessor.h"
 
18
#include "LESwaps.h"
 
19
 
 
20
U_NAMESPACE_BEGIN
 
21
 
 
22
void MorphTableHeader::process(LEGlyphID *glyphs, le_int32 *glyphIndices, le_int32 glyphCount) const
 
23
{
 
24
    const ChainHeader *chainHeader = chains;
 
25
    le_uint32 chainCount = SWAPL(this->nChains);
 
26
    le_uint32 chain;
 
27
 
 
28
    for (chain = 0; chain < chainCount; chain += 1) {
 
29
        FeatureFlags defaultFlags = SWAPL(chainHeader->defaultFlags);
 
30
        le_uint32 chainLength = SWAPL(chainHeader->chainLength);
 
31
        le_int16 nFeatureEntries = SWAPW(chainHeader->nFeatureEntries);
 
32
        le_int16 nSubtables = SWAPW(chainHeader->nSubtables);
 
33
        const MorphSubtableHeader *subtableHeader =
 
34
            (const MorphSubtableHeader *)&chainHeader->featureTable[nFeatureEntries];
 
35
        le_int16 subtable;
 
36
 
 
37
        for (subtable = 0; subtable < nSubtables; subtable += 1) {
 
38
            le_int16 length = SWAPW(subtableHeader->length);
 
39
            SubtableCoverage coverage = SWAPW(subtableHeader->coverage);
 
40
            FeatureFlags subtableFeatures = SWAPL(subtableHeader->subtableFeatures);
 
41
 
 
42
            // should check coverage more carefully...
 
43
            if ((coverage & scfVertical) == 0 && (subtableFeatures & defaultFlags) != 0) {
 
44
                subtableHeader->process(glyphs, glyphIndices, glyphCount);
 
45
            }
 
46
 
 
47
            subtableHeader = (const MorphSubtableHeader *) ((char *)subtableHeader + length);
 
48
        }
 
49
 
 
50
        chainHeader = (const ChainHeader *)((char *)chainHeader + chainLength);
 
51
    }
 
52
}
 
53
 
 
54
void MorphSubtableHeader::process(LEGlyphID *glyphs, le_int32 *glyphIndices, le_int32 glyphCount) const
 
55
{
 
56
    SubtableProcessor *processor = NULL;
 
57
 
 
58
    switch (SWAPW(coverage) & scfTypeMask)
 
59
    {
 
60
    case mstIndicRearrangement:
 
61
        processor = new IndicRearrangementProcessor(this);
 
62
        break;
 
63
 
 
64
    case mstContextualGlyphSubstitution:
 
65
        processor = new ContextualGlyphSubstitutionProcessor(this);
 
66
        break;
 
67
 
 
68
    case mstLigatureSubstitution:
 
69
        processor = new LigatureSubstitutionProcessor(this);
 
70
        break;
 
71
 
 
72
    case mstReservedUnused:
 
73
        break;
 
74
 
 
75
    case mstNonContextualGlyphSubstitution:
 
76
        processor = NonContextualGlyphSubstitutionProcessor::createInstance(this);
 
77
        break;
 
78
 
 
79
    /*
 
80
    case mstContextualGlyphInsertion:
 
81
        processor = new ContextualGlyphInsertionProcessor(this);
 
82
        break;
 
83
    */
 
84
 
 
85
    default:
 
86
        break;
 
87
    }
 
88
 
 
89
    if (processor != NULL) {
 
90
        processor->process(glyphs, glyphIndices, glyphCount);
 
91
        delete processor;
 
92
    }
 
93
}
 
94
 
 
95
U_NAMESPACE_END