1ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru/*
2ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *
3ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * (C) Copyright IBM Corp. 1998-2005 - All Rights Reserved
4ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *
5ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */
6ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
7ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#include "LETypes.h"
8ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#include "LEFontInstance.h"
9ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#include "OpenTypeTables.h"
10ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#include "GlyphPositioningTables.h"
11ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#include "SinglePositioningSubtables.h"
12ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#include "ValueRecords.h"
13ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#include "GlyphIterator.h"
14ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#include "LESwaps.h"
15ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
16ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste QueruU_NAMESPACE_BEGIN
17ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
18ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Querule_uint32 SinglePositioningSubtable::process(GlyphIterator *glyphIterator, const LEFontInstance *fontInstance) const
19ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru{
20ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    switch(SWAPW(subtableFormat))
21ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    {
22ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    case 0:
23ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru        return 0;
24ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
25ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    case 1:
26ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    {
27ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru        const SinglePositioningFormat1Subtable *subtable = (const SinglePositioningFormat1Subtable *) this;
28ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
29ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru        return subtable->process(glyphIterator, fontInstance);
30ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    }
31ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
32ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    case 2:
33ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    {
34ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru        const SinglePositioningFormat2Subtable *subtable = (const SinglePositioningFormat2Subtable *) this;
35ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
36ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru        return subtable->process(glyphIterator, fontInstance);
37ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    }
38ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
39ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    default:
40ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru        return 0;
41ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    }
42ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru}
43ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
44ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Querule_uint32 SinglePositioningFormat1Subtable::process(GlyphIterator *glyphIterator, const LEFontInstance *fontInstance) const
45ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru{
46ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    LEGlyphID glyph = glyphIterator->getCurrGlyphID();
47ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    le_int32 coverageIndex = getGlyphCoverage(glyph);
48ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
49ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    if (coverageIndex >= 0) {
50ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru        valueRecord.adjustPosition(SWAPW(valueFormat), (const char *) this, *glyphIterator, fontInstance);
51ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
52ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru        return 1;
53ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    }
54ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
55ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    return 0;
56ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru}
57ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
58ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Querule_uint32 SinglePositioningFormat2Subtable::process(GlyphIterator *glyphIterator, const LEFontInstance *fontInstance) const
59ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru{
60ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    LEGlyphID glyph = glyphIterator->getCurrGlyphID();
61ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    le_int16 coverageIndex = (le_int16) getGlyphCoverage(glyph);
62ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
63ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    if (coverageIndex >= 0) {
64ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru        valueRecordArray[0].adjustPosition(coverageIndex, SWAPW(valueFormat), (const char *) this, *glyphIterator, fontInstance);
65ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
66ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru        return 1;
67ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    }
68ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
69ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru    return 0;
70ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru}
71ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
72ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste QueruU_NAMESPACE_END
73