os/textandloc/fontservices/textshaperplugin/IcuSource/layout/CursiveAttachmentSubtables.cpp
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/textandloc/fontservices/textshaperplugin/IcuSource/layout/CursiveAttachmentSubtables.cpp Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,49 @@
1.4 +/*
1.5 + * (C) Copyright IBM Corp. 1998 - 2005 - All Rights Reserved
1.6 + *
1.7 + */
1.8 +
1.9 +#include "LETypes.h"
1.10 +#include "OpenTypeTables.h"
1.11 +#include "GlyphPositioningTables.h"
1.12 +#include "CursiveAttachmentSubtables.h"
1.13 +#include "AnchorTables.h"
1.14 +#include "GlyphIterator.h"
1.15 +#include "OpenTypeUtilities.h"
1.16 +#include "LESwaps.h"
1.17 +
1.18 +U_NAMESPACE_BEGIN
1.19 +
1.20 +le_uint32 CursiveAttachmentSubtable::process(GlyphIterator *glyphIterator, const LEFontInstance *fontInstance) const
1.21 +{
1.22 + LEGlyphID glyphID = glyphIterator->getCurrGlyphID();
1.23 + le_int32 coverageIndex = getGlyphCoverage(glyphID);
1.24 + le_uint16 eeCount = SWAPW(entryExitCount);
1.25 +
1.26 + if (coverageIndex < 0 || coverageIndex >= eeCount) {
1.27 + glyphIterator->setCursiveGlyph();
1.28 + return 0;
1.29 + }
1.30 +
1.31 + LEPoint entryAnchor, exitAnchor;
1.32 + Offset entryOffset = SWAPW(entryExitRecords[coverageIndex].entryAnchor);
1.33 + Offset exitOffset = SWAPW(entryExitRecords[coverageIndex].exitAnchor);
1.34 +
1.35 + if (entryOffset != 0) {
1.36 + const AnchorTable *entryAnchorTable = (const AnchorTable *) ((char *) this + entryOffset);
1.37 +
1.38 + entryAnchorTable->getAnchor(glyphID, fontInstance, entryAnchor);
1.39 + glyphIterator->setCursiveEntryPoint(entryAnchor);
1.40 + }
1.41 +
1.42 + if (exitOffset != 0) {
1.43 + const AnchorTable *exitAnchorTable = (const AnchorTable *) ((char *) this + exitOffset);
1.44 +
1.45 + exitAnchorTable->getAnchor(glyphID, fontInstance, exitAnchor);
1.46 + glyphIterator->setCursiveExitPoint(exitAnchor);
1.47 + }
1.48 +
1.49 + return 1;
1.50 +}
1.51 +
1.52 +U_NAMESPACE_END