]> git.saurik.com Git - apple/icu.git/blame - icuSources/layout/SinglePositioningSubtables.cpp
ICU-551.24.tar.gz
[apple/icu.git] / icuSources / layout / SinglePositioningSubtables.cpp
CommitLineData
b75a7d8f 1/*
b75a7d8f 2 *
57a6839d 3 * (C) Copyright IBM Corp. 1998-2013 - All Rights Reserved
b75a7d8f
A
4 *
5 */
6
7#include "LETypes.h"
8#include "LEFontInstance.h"
9#include "OpenTypeTables.h"
10#include "GlyphPositioningTables.h"
11#include "SinglePositioningSubtables.h"
12#include "ValueRecords.h"
13#include "GlyphIterator.h"
b75a7d8f
A
14#include "LESwaps.h"
15
16U_NAMESPACE_BEGIN
17
57a6839d 18le_uint32 SinglePositioningSubtable::process(const LEReferenceTo<SinglePositioningSubtable> &base, GlyphIterator *glyphIterator, const LEFontInstance *fontInstance, LEErrorCode &success) const
b75a7d8f
A
19{
20 switch(SWAPW(subtableFormat))
21 {
22 case 0:
23 return 0;
24
25 case 1:
26 {
57a6839d 27 const LEReferenceTo<SinglePositioningFormat1Subtable> subtable(base, success, (const SinglePositioningFormat1Subtable *) this);
b75a7d8f 28
57a6839d 29 return subtable->process(subtable, glyphIterator, fontInstance, success);
b75a7d8f
A
30 }
31
32 case 2:
33 {
57a6839d 34 const LEReferenceTo<SinglePositioningFormat2Subtable> subtable(base, success, (const SinglePositioningFormat2Subtable *) this);
b75a7d8f 35
57a6839d 36 return subtable->process(subtable, glyphIterator, fontInstance, success);
b75a7d8f
A
37 }
38
39 default:
40 return 0;
41 }
42}
43
57a6839d 44le_uint32 SinglePositioningFormat1Subtable::process(const LEReferenceTo<SinglePositioningFormat1Subtable> &base, GlyphIterator *glyphIterator, const LEFontInstance *fontInstance, LEErrorCode &success) const
b75a7d8f
A
45{
46 LEGlyphID glyph = glyphIterator->getCurrGlyphID();
57a6839d 47 le_int32 coverageIndex = getGlyphCoverage(base, glyph, success);
b75a7d8f
A
48
49 if (coverageIndex >= 0) {
73c04bcf 50 valueRecord.adjustPosition(SWAPW(valueFormat), (const char *) this, *glyphIterator, fontInstance);
b75a7d8f
A
51
52 return 1;
53 }
54
55 return 0;
56}
57
57a6839d 58le_uint32 SinglePositioningFormat2Subtable::process(const LEReferenceTo<SinglePositioningFormat2Subtable> &base, GlyphIterator *glyphIterator, const LEFontInstance *fontInstance, LEErrorCode &success) const
b75a7d8f
A
59{
60 LEGlyphID glyph = glyphIterator->getCurrGlyphID();
57a6839d 61 le_int16 coverageIndex = (le_int16) getGlyphCoverage(base, glyph, success);
b75a7d8f
A
62
63 if (coverageIndex >= 0) {
73c04bcf 64 valueRecordArray[0].adjustPosition(coverageIndex, SWAPW(valueFormat), (const char *) this, *glyphIterator, fontInstance);
b75a7d8f
A
65
66 return 1;
67 }
68
69 return 0;
70}
71
72U_NAMESPACE_END