~ubuntu-branches/ubuntu/maverick/icu/maverick-updates

« back to all changes in this revision

Viewing changes to source/layout/SingleSubstitutionSubtables.cpp

  • Committer: Package Import Robot
  • Author(s): Jay Berkenbilt
  • Date: 2009-09-04 11:56:06 UTC
  • mfrom: (10.1.6 sid)
  • Revision ID: package-import@ubuntu.com-20090904115606-sqxxuizelam5tozb
Tags: 4.2.1-3
Change install-doc target to not fail if there are subdirectories of
doc/html.  This is necessary to handle the doc/html/search directory
created by doxygen 3.6.1.  (Closes: #544799)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 *
 
3
 * (C) Copyright IBM Corp. 1998-2004 - All Rights Reserved
 
4
 *
 
5
 */
 
6
 
 
7
#include "LETypes.h"
 
8
#include "LEGlyphFilter.h"
 
9
#include "OpenTypeTables.h"
 
10
#include "GlyphSubstitutionTables.h"
 
11
#include "SingleSubstitutionSubtables.h"
 
12
#include "GlyphIterator.h"
 
13
#include "LESwaps.h"
 
14
 
 
15
U_NAMESPACE_BEGIN
 
16
 
 
17
le_uint32 SingleSubstitutionSubtable::process(GlyphIterator *glyphIterator, const LEGlyphFilter *filter) const
 
18
{
 
19
    switch(SWAPW(subtableFormat))
 
20
    {
 
21
    case 0:
 
22
        return 0;
 
23
 
 
24
    case 1:
 
25
    {
 
26
        const SingleSubstitutionFormat1Subtable *subtable = (const SingleSubstitutionFormat1Subtable *) this;
 
27
 
 
28
        return subtable->process(glyphIterator, filter);
 
29
    }
 
30
 
 
31
    case 2:
 
32
    {
 
33
        const SingleSubstitutionFormat2Subtable *subtable = (const SingleSubstitutionFormat2Subtable *) this;
 
34
 
 
35
        return subtable->process(glyphIterator, filter);
 
36
    }
 
37
 
 
38
    default:
 
39
        return 0;
 
40
    }
 
41
}
 
42
 
 
43
le_uint32 SingleSubstitutionFormat1Subtable::process(GlyphIterator *glyphIterator, const LEGlyphFilter *filter) const
 
44
{
 
45
    LEGlyphID glyph = glyphIterator->getCurrGlyphID();
 
46
    le_int32 coverageIndex = getGlyphCoverage(glyph);
 
47
 
 
48
    if (coverageIndex >= 0) {
 
49
        TTGlyphID substitute = ((TTGlyphID) LE_GET_GLYPH(glyph)) + SWAPW(deltaGlyphID);
 
50
 
 
51
        if (filter == NULL || filter->accept(LE_SET_GLYPH(glyph, substitute))) {
 
52
            glyphIterator->setCurrGlyphID(substitute);
 
53
        }
 
54
 
 
55
        return 1;
 
56
    }
 
57
 
 
58
    return 0;
 
59
}
 
60
 
 
61
le_uint32 SingleSubstitutionFormat2Subtable::process(GlyphIterator *glyphIterator, const LEGlyphFilter *filter) const
 
62
{
 
63
    LEGlyphID glyph = glyphIterator->getCurrGlyphID();
 
64
    le_int32 coverageIndex = getGlyphCoverage(glyph);
 
65
 
 
66
    if (coverageIndex >= 0) {
 
67
        TTGlyphID substitute = SWAPW(substituteArray[coverageIndex]);
 
68
 
 
69
        if (filter == NULL || filter->accept(LE_SET_GLYPH(glyph, substitute))) {
 
70
            glyphIterator->setCurrGlyphID(substitute);
 
71
        }
 
72
 
 
73
        return 1;
 
74
    }
 
75
 
 
76
    return 0;
 
77
}
 
78
 
 
79
U_NAMESPACE_END