os/textandloc/fontservices/textshaperplugin/IcuSource/layout/SinglePositioningSubtables.cpp
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/textandloc/fontservices/textshaperplugin/IcuSource/layout/SinglePositioningSubtables.cpp Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,72 @@
1.4 +/*
1.5 + *
1.6 + * (C) Copyright IBM Corp. 1998-2005 - All Rights Reserved
1.7 + *
1.8 + */
1.9 +
1.10 +#include "LETypes.h"
1.11 +#include "LEFontInstance.h"
1.12 +#include "OpenTypeTables.h"
1.13 +#include "GlyphPositioningTables.h"
1.14 +#include "SinglePositioningSubtables.h"
1.15 +#include "ValueRecords.h"
1.16 +#include "GlyphIterator.h"
1.17 +#include "LESwaps.h"
1.18 +
1.19 +U_NAMESPACE_BEGIN
1.20 +
1.21 +le_uint32 SinglePositioningSubtable::process(GlyphIterator *glyphIterator, const LEFontInstance *fontInstance) const
1.22 +{
1.23 + switch(SWAPW(subtableFormat))
1.24 + {
1.25 + case 0:
1.26 + return 0;
1.27 +
1.28 + case 1:
1.29 + {
1.30 + const SinglePositioningFormat1Subtable *subtable = (const SinglePositioningFormat1Subtable *) this;
1.31 +
1.32 + return subtable->process(glyphIterator, fontInstance);
1.33 + }
1.34 +
1.35 + case 2:
1.36 + {
1.37 + const SinglePositioningFormat2Subtable *subtable = (const SinglePositioningFormat2Subtable *) this;
1.38 +
1.39 + return subtable->process(glyphIterator, fontInstance);
1.40 + }
1.41 +
1.42 + default:
1.43 + return 0;
1.44 + }
1.45 +}
1.46 +
1.47 +le_uint32 SinglePositioningFormat1Subtable::process(GlyphIterator *glyphIterator, const LEFontInstance *fontInstance) const
1.48 +{
1.49 + LEGlyphID glyph = glyphIterator->getCurrGlyphID();
1.50 + le_int32 coverageIndex = getGlyphCoverage(glyph);
1.51 +
1.52 + if (coverageIndex >= 0) {
1.53 + valueRecord.adjustPosition(SWAPW(valueFormat), (const char *) this, *glyphIterator, fontInstance);
1.54 +
1.55 + return 1;
1.56 + }
1.57 +
1.58 + return 0;
1.59 +}
1.60 +
1.61 +le_uint32 SinglePositioningFormat2Subtable::process(GlyphIterator *glyphIterator, const LEFontInstance *fontInstance) const
1.62 +{
1.63 + LEGlyphID glyph = glyphIterator->getCurrGlyphID();
1.64 + le_int16 coverageIndex = (le_int16) getGlyphCoverage(glyph);
1.65 +
1.66 + if (coverageIndex >= 0) {
1.67 + valueRecordArray[0].adjustPosition(coverageIndex, SWAPW(valueFormat), (const char *) this, *glyphIterator, fontInstance);
1.68 +
1.69 + return 1;
1.70 + }
1.71 +
1.72 + return 0;
1.73 +}
1.74 +
1.75 +U_NAMESPACE_END