2000-11-28 20:56:52 +00:00
|
|
|
/*
|
2001-09-20 00:37:55 +00:00
|
|
|
* %W% %W%
|
2000-11-28 20:56:52 +00:00
|
|
|
*
|
2001-01-19 00:30:17 +00:00
|
|
|
* (C) Copyright IBM Corp. 1998, 1999, 2000, 2001 - All Rights Reserved
|
2000-11-28 20:56:52 +00:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
#include "LETypes.h"
|
|
|
|
#include "LayoutTables.h"
|
|
|
|
#include "MorphTables.h"
|
|
|
|
#include "SubtableProcessor.h"
|
|
|
|
#include "IndicRearrangementProcessor.h"
|
2000-12-21 02:52:24 +00:00
|
|
|
#include "ContextualGlyphSubstProc.h"
|
2000-12-21 21:57:18 +00:00
|
|
|
#include "LigatureSubstProc.h"
|
2000-12-21 02:52:24 +00:00
|
|
|
#include "NonContextualGlyphSubstProc.h"
|
2000-11-28 20:56:52 +00:00
|
|
|
//#include "ContextualGlyphInsertionProcessor.h"
|
|
|
|
#include "LESwaps.h"
|
|
|
|
|
2001-10-16 00:39:01 +00:00
|
|
|
U_NAMESPACE_BEGIN
|
|
|
|
|
2001-01-19 00:30:17 +00:00
|
|
|
void MorphTableHeader::process(LEGlyphID *glyphs, le_int32 *glyphIndices, le_int32 glyphCount) const
|
2000-11-28 20:56:52 +00:00
|
|
|
{
|
2001-01-19 00:30:17 +00:00
|
|
|
const ChainHeader *chainHeader = chains;
|
2000-11-28 20:56:52 +00:00
|
|
|
le_uint32 chainCount = SWAPL(this->nChains);
|
|
|
|
le_uint32 chain;
|
|
|
|
|
2001-01-19 00:30:17 +00:00
|
|
|
for (chain = 0; chain < chainCount; chain += 1) {
|
2000-11-28 20:56:52 +00:00
|
|
|
FeatureFlags defaultFlags = SWAPL(chainHeader->defaultFlags);
|
|
|
|
le_uint32 chainLength = SWAPL(chainHeader->chainLength);
|
|
|
|
le_int16 nFeatureEntries = SWAPW(chainHeader->nFeatureEntries);
|
|
|
|
le_int16 nSubtables = SWAPW(chainHeader->nSubtables);
|
2001-01-19 00:30:17 +00:00
|
|
|
const MorphSubtableHeader *subtableHeader =
|
|
|
|
(const MorphSubtableHeader *)&chainHeader->featureTable[nFeatureEntries];
|
2000-11-28 20:56:52 +00:00
|
|
|
le_int16 subtable;
|
|
|
|
|
2001-01-19 00:30:17 +00:00
|
|
|
for (subtable = 0; subtable < nSubtables; subtable += 1) {
|
2000-11-28 20:56:52 +00:00
|
|
|
le_int16 length = SWAPW(subtableHeader->length);
|
|
|
|
SubtableCoverage coverage = SWAPW(subtableHeader->coverage);
|
|
|
|
FeatureFlags subtableFeatures = SWAPL(subtableHeader->subtableFeatures);
|
|
|
|
|
2001-09-20 00:37:55 +00:00
|
|
|
// should check coverage more carefully...
|
|
|
|
if ((coverage & scfVertical) == 0 && (subtableFeatures & defaultFlags) != 0) {
|
2000-11-28 20:56:52 +00:00
|
|
|
subtableHeader->process(glyphs, glyphIndices, glyphCount);
|
|
|
|
}
|
|
|
|
|
2001-01-19 00:30:17 +00:00
|
|
|
subtableHeader = (const MorphSubtableHeader *) ((char *)subtableHeader + length);
|
2000-11-28 20:56:52 +00:00
|
|
|
}
|
|
|
|
|
2001-01-19 00:30:17 +00:00
|
|
|
chainHeader = (const ChainHeader *)((char *)chainHeader + chainLength);
|
2000-11-28 20:56:52 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2001-01-19 00:30:17 +00:00
|
|
|
void MorphSubtableHeader::process(LEGlyphID *glyphs, le_int32 *glyphIndices, le_int32 glyphCount) const
|
2000-11-28 20:56:52 +00:00
|
|
|
{
|
|
|
|
SubtableProcessor *processor = NULL;
|
|
|
|
|
|
|
|
switch (SWAPW(coverage) & scfTypeMask)
|
|
|
|
{
|
|
|
|
case mstIndicRearrangement:
|
|
|
|
processor = new IndicRearrangementProcessor(this);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case mstContextualGlyphSubstitution:
|
|
|
|
processor = new ContextualGlyphSubstitutionProcessor(this);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case mstLigatureSubstitution:
|
|
|
|
processor = new LigatureSubstitutionProcessor(this);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case mstReservedUnused:
|
|
|
|
break;
|
|
|
|
|
|
|
|
case mstNonContextualGlyphSubstitution:
|
|
|
|
processor = NonContextualGlyphSubstitutionProcessor::createInstance(this);
|
|
|
|
break;
|
|
|
|
|
|
|
|
/*
|
|
|
|
case mstContextualGlyphInsertion:
|
|
|
|
processor = new ContextualGlyphInsertionProcessor(this);
|
|
|
|
break;
|
|
|
|
*/
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2001-01-19 00:30:17 +00:00
|
|
|
if (processor != NULL) {
|
2000-11-28 20:56:52 +00:00
|
|
|
processor->process(glyphs, glyphIndices, glyphCount);
|
|
|
|
delete processor;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2001-10-16 00:39:01 +00:00
|
|
|
U_NAMESPACE_END
|