1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/textandloc/fontservices/textshaperplugin/IcuSource/layout/MorphTables.cpp Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,96 @@
1.4 +/*
1.5 + * %W% %W%
1.6 + *
1.7 + * (C) Copyright IBM Corp. 1998 - 2004 - All Rights Reserved
1.8 + *
1.9 + */
1.10 +
1.11 +
1.12 +#include "LETypes.h"
1.13 +#include "LayoutTables.h"
1.14 +#include "MorphTables.h"
1.15 +#include "SubtableProcessor.h"
1.16 +#include "IndicRearrangementProcessor.h"
1.17 +#include "ContextualGlyphSubstProc.h"
1.18 +#include "LigatureSubstProc.h"
1.19 +#include "NonContextualGlyphSubstProc.h"
1.20 +//#include "ContextualGlyphInsertionProcessor.h"
1.21 +#include "LEGlyphStorage.h"
1.22 +#include "LESwaps.h"
1.23 +
1.24 +U_NAMESPACE_BEGIN
1.25 +
1.26 +void MorphTableHeader::process(LEGlyphStorage &glyphStorage) const
1.27 +{
1.28 + const ChainHeader *chainHeader = chains;
1.29 + le_uint32 chainCount = SWAPL(this->nChains);
1.30 + le_uint32 chain;
1.31 +
1.32 + for (chain = 0; chain < chainCount; chain += 1) {
1.33 + FeatureFlags defaultFlags = SWAPL(chainHeader->defaultFlags);
1.34 + le_uint32 chainLength = SWAPL(chainHeader->chainLength);
1.35 + le_int16 nFeatureEntries = SWAPW(chainHeader->nFeatureEntries);
1.36 + le_int16 nSubtables = SWAPW(chainHeader->nSubtables);
1.37 + const MorphSubtableHeader *subtableHeader =
1.38 + (const MorphSubtableHeader *)&chainHeader->featureTable[nFeatureEntries];
1.39 + le_int16 subtable;
1.40 +
1.41 + for (subtable = 0; subtable < nSubtables; subtable += 1) {
1.42 + le_int16 length = SWAPW(subtableHeader->length);
1.43 + SubtableCoverage coverage = SWAPW(subtableHeader->coverage);
1.44 + FeatureFlags subtableFeatures = SWAPL(subtableHeader->subtableFeatures);
1.45 +
1.46 + // should check coverage more carefully...
1.47 + if ((coverage & scfVertical) == 0 && (subtableFeatures & defaultFlags) != 0) {
1.48 + subtableHeader->process(glyphStorage);
1.49 + }
1.50 +
1.51 + subtableHeader = (const MorphSubtableHeader *) ((char *)subtableHeader + length);
1.52 + }
1.53 +
1.54 + chainHeader = (const ChainHeader *)((char *)chainHeader + chainLength);
1.55 + }
1.56 +}
1.57 +
1.58 +void MorphSubtableHeader::process(LEGlyphStorage &glyphStorage) const
1.59 +{
1.60 + SubtableProcessor *processor = NULL;
1.61 +
1.62 + switch (SWAPW(coverage) & scfTypeMask)
1.63 + {
1.64 + case mstIndicRearrangement:
1.65 + processor = new IndicRearrangementProcessor(this);
1.66 + break;
1.67 +
1.68 + case mstContextualGlyphSubstitution:
1.69 + processor = new ContextualGlyphSubstitutionProcessor(this);
1.70 + break;
1.71 +
1.72 + case mstLigatureSubstitution:
1.73 + processor = new LigatureSubstitutionProcessor(this);
1.74 + break;
1.75 +
1.76 + case mstReservedUnused:
1.77 + break;
1.78 +
1.79 + case mstNonContextualGlyphSubstitution:
1.80 + processor = NonContextualGlyphSubstitutionProcessor::createInstance(this);
1.81 + break;
1.82 +
1.83 + /*
1.84 + case mstContextualGlyphInsertion:
1.85 + processor = new ContextualGlyphInsertionProcessor(this);
1.86 + break;
1.87 + */
1.88 +
1.89 + default:
1.90 + break;
1.91 + }
1.92 +
1.93 + if (processor != NULL) {
1.94 + processor->process(glyphStorage);
1.95 + delete processor;
1.96 + }
1.97 +}
1.98 +
1.99 +U_NAMESPACE_END