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
|
|
|
*
|
2013-04-18 21:24:51 +00:00
|
|
|
* (C) Copyright IBM Corp. 1998 - 2013 - 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"
|
2004-04-12 18:51:31 +00:00
|
|
|
#include "LEGlyphStorage.h"
|
2000-11-28 20:56:52 +00:00
|
|
|
#include "LESwaps.h"
|
|
|
|
|
2001-10-16 00:39:01 +00:00
|
|
|
U_NAMESPACE_BEGIN
|
|
|
|
|
2013-04-18 21:24:51 +00:00
|
|
|
void MorphTableHeader::process(const LETableReference &base, LEGlyphStorage &glyphStorage, LEErrorCode &success) const
|
2000-11-28 20:56:52 +00:00
|
|
|
{
|
2013-04-18 21:24:51 +00:00
|
|
|
le_uint32 chainCount = SWAPL(this->nChains);
|
|
|
|
LEReferenceTo<ChainHeader> chainHeader(base, success, chains); // moving header
|
|
|
|
LEReferenceToArrayOf<ChainHeader> chainHeaderArray(base, success, chains, chainCount);
|
2000-11-28 20:56:52 +00:00
|
|
|
le_uint32 chain;
|
|
|
|
|
2013-04-18 21:24:51 +00:00
|
|
|
for (chain = 0; LE_SUCCESS(success) && (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);
|
2013-04-18 21:24:51 +00:00
|
|
|
LEReferenceTo<MorphSubtableHeader> subtableHeader =
|
|
|
|
LEReferenceTo<MorphSubtableHeader>(chainHeader,success, &(chainHeader->featureTable[nFeatureEntries]));
|
2000-11-28 20:56:52 +00:00
|
|
|
le_int16 subtable;
|
|
|
|
|
2013-04-18 21:24:51 +00:00
|
|
|
for (subtable = 0; LE_SUCCESS(success) && (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...
|
2013-04-18 21:24:51 +00:00
|
|
|
if ((coverage & scfVertical) == 0 && (subtableFeatures & defaultFlags) != 0 && LE_SUCCESS(success)) {
|
|
|
|
subtableHeader->process(subtableHeader, glyphStorage, success);
|
2000-11-28 20:56:52 +00:00
|
|
|
}
|
|
|
|
|
2013-04-18 21:24:51 +00:00
|
|
|
subtableHeader.addOffset(length, success);
|
2000-11-28 20:56:52 +00:00
|
|
|
}
|
2013-04-18 21:24:51 +00:00
|
|
|
chainHeader.addOffset(chainLength, success);
|
2000-11-28 20:56:52 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-04-18 21:24:51 +00:00
|
|
|
void MorphSubtableHeader::process(const LEReferenceTo<MorphSubtableHeader> &base, LEGlyphStorage &glyphStorage, LEErrorCode &success) const
|
2000-11-28 20:56:52 +00:00
|
|
|
{
|
|
|
|
SubtableProcessor *processor = NULL;
|
|
|
|
|
|
|
|
switch (SWAPW(coverage) & scfTypeMask)
|
|
|
|
{
|
|
|
|
case mstIndicRearrangement:
|
2013-04-18 21:24:51 +00:00
|
|
|
processor = new IndicRearrangementProcessor(base, success);
|
2000-11-28 20:56:52 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case mstContextualGlyphSubstitution:
|
2013-04-18 21:24:51 +00:00
|
|
|
processor = new ContextualGlyphSubstitutionProcessor(base, success);
|
2000-11-28 20:56:52 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case mstLigatureSubstitution:
|
2013-04-18 21:24:51 +00:00
|
|
|
processor = new LigatureSubstitutionProcessor(base, success);
|
2000-11-28 20:56:52 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case mstReservedUnused:
|
|
|
|
break;
|
|
|
|
|
|
|
|
case mstNonContextualGlyphSubstitution:
|
2013-04-18 21:24:51 +00:00
|
|
|
processor = NonContextualGlyphSubstitutionProcessor::createInstance(base, success);
|
2000-11-28 20:56:52 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
/*
|
|
|
|
case mstContextualGlyphInsertion:
|
|
|
|
processor = new ContextualGlyphInsertionProcessor(this);
|
|
|
|
break;
|
|
|
|
*/
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2001-01-19 00:30:17 +00:00
|
|
|
if (processor != NULL) {
|
2013-04-18 21:24:51 +00:00
|
|
|
if(LE_SUCCESS(success)) {
|
|
|
|
processor->process(glyphStorage, success);
|
|
|
|
}
|
|
|
|
delete processor;
|
2000-11-28 20:56:52 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2001-10-16 00:39:01 +00:00
|
|
|
U_NAMESPACE_END
|