1/*
2 *
3 * (C) Copyright IBM Corp. 1998-2004 - All Rights Reserved
4 *
5 */
6
7#include "LETypes.h"
8#include "LEFontInstance.h"
9#include "OpenTypeTables.h"
10#include "AnchorTables.h"
11#include "MarkArrays.h"
12#include "LESwaps.h"
13
14U_NAMESPACE_BEGIN
15
16le_int32 MarkArray::getMarkClass(LEGlyphID glyphID, le_int32 coverageIndex, const LEFontInstance *fontInstance,
17                              LEPoint &anchor) const
18{
19    le_int32 markClass = -1;
20
21    if (coverageIndex >= 0) {
22        le_uint16 mCount = SWAPW(markCount);
23
24        if (coverageIndex < mCount) {
25            const MarkRecord *markRecord = &markRecordArray[coverageIndex];
26            Offset anchorTableOffset = SWAPW(markRecord->markAnchorTableOffset);
27            const AnchorTable *anchorTable = (AnchorTable *) ((char *) this + anchorTableOffset);
28
29            anchorTable->getAnchor(glyphID, fontInstance, anchor);
30            markClass = SWAPW(markRecord->markClass);
31        }
32
33        // XXXX If we get here, the table is mal-formed
34    }
35
36    return markClass;
37}
38
39U_NAMESPACE_END
40