]> git.saurik.com Git - apple/icu.git/blame - icuSources/layout/SinglePositioningSubtables.cpp
ICU-6.2.16.tar.gz
[apple/icu.git] / icuSources / layout / SinglePositioningSubtables.cpp
CommitLineData
b75a7d8f 1/*
b75a7d8f 2 *
374ca955 3 * (C) Copyright IBM Corp. 1998-2004 - 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"
14#include "GlyphPositionAdjustments.h"
15#include "LESwaps.h"
16
17U_NAMESPACE_BEGIN
18
19le_uint32 SinglePositioningSubtable::process(GlyphIterator *glyphIterator, const LEFontInstance *fontInstance) const
20{
21 switch(SWAPW(subtableFormat))
22 {
23 case 0:
24 return 0;
25
26 case 1:
27 {
28 const SinglePositioningFormat1Subtable *subtable = (const SinglePositioningFormat1Subtable *) this;
29
30 return subtable->process(glyphIterator, fontInstance);
31 }
32
33 case 2:
34 {
35 const SinglePositioningFormat2Subtable *subtable = (const SinglePositioningFormat2Subtable *) this;
36
37 return subtable->process(glyphIterator, fontInstance);
38 }
39
40 default:
41 return 0;
42 }
43}
44
45le_uint32 SinglePositioningFormat1Subtable::process(GlyphIterator *glyphIterator, const LEFontInstance *fontInstance) const
46{
47 LEGlyphID glyph = glyphIterator->getCurrGlyphID();
48 le_int32 coverageIndex = getGlyphCoverage(glyph);
49
50 if (coverageIndex >= 0) {
51 GlyphPositionAdjustment adjustment;
52
53 glyphIterator->getCurrGlyphPositionAdjustment(adjustment);
54
55 valueRecord.adjustPosition(SWAPW(valueFormat), (const char *) this, adjustment, fontInstance);
56
57 glyphIterator->setCurrGlyphPositionAdjustment(&adjustment);
58
59 return 1;
60 }
61
62 return 0;
63}
64
65le_uint32 SinglePositioningFormat2Subtable::process(GlyphIterator *glyphIterator, const LEFontInstance *fontInstance) const
66{
67 LEGlyphID glyph = glyphIterator->getCurrGlyphID();
68 le_int16 coverageIndex = (le_int16) getGlyphCoverage(glyph);
69
70 if (coverageIndex >= 0) {
71 GlyphPositionAdjustment adjustment;
72
73 glyphIterator->getCurrGlyphPositionAdjustment(adjustment);
74
75 valueRecordArray[0].adjustPosition(coverageIndex, SWAPW(valueFormat), (const char *) this, adjustment, fontInstance);
76
77 glyphIterator->setCurrGlyphPositionAdjustment(&adjustment);
78
79 return 1;
80 }
81
82 return 0;
83}
84
85U_NAMESPACE_END