2000-11-28 20:56:52 +00:00
|
|
|
/*
|
2000-12-21 02:44:45 +00:00
|
|
|
* @(#)GlyphSubstLookupProc.cpp 1.6 00/03/15
|
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 "LEGlyphFilter.h"
|
|
|
|
#include "LEFontInstance.h"
|
|
|
|
#include "OpenTypeTables.h"
|
|
|
|
#include "Features.h"
|
|
|
|
#include "Lookups.h"
|
|
|
|
#include "ScriptAndLanguage.h"
|
|
|
|
#include "GlyphDefinitionTables.h"
|
|
|
|
#include "GlyphSubstitutionTables.h"
|
|
|
|
#include "SingleSubstitutionSubtables.h"
|
2000-12-21 21:57:18 +00:00
|
|
|
#include "MultipleSubstSubtables.h"
|
2000-12-21 02:44:45 +00:00
|
|
|
#include "AlternateSubstSubtables.h"
|
2000-12-21 21:57:18 +00:00
|
|
|
#include "LigatureSubstSubtables.h"
|
2000-12-21 02:44:45 +00:00
|
|
|
#include "ContextualSubstSubtables.h"
|
2000-11-28 20:56:52 +00:00
|
|
|
#include "LookupProcessor.h"
|
2000-12-21 02:44:45 +00:00
|
|
|
#include "GlyphSubstLookupProc.h"
|
2000-11-28 20:56:52 +00:00
|
|
|
#include "LESwaps.h"
|
|
|
|
|
|
|
|
GlyphSubstitutionLookupProcessor::GlyphSubstitutionLookupProcessor(
|
2001-01-19 00:30:17 +00:00
|
|
|
const GlyphSubstitutionTableHeader *glyphSubstitutionTableHeader,
|
|
|
|
LETag scriptTag, LETag languageTag, const LEGlyphFilter *filter)
|
2000-11-28 20:56:52 +00:00
|
|
|
: LookupProcessor(
|
|
|
|
(char *) glyphSubstitutionTableHeader,
|
|
|
|
SWAPW(glyphSubstitutionTableHeader->scriptListOffset),
|
|
|
|
SWAPW(glyphSubstitutionTableHeader->featureListOffset),
|
|
|
|
SWAPW(glyphSubstitutionTableHeader->lookupListOffset),
|
|
|
|
scriptTag, languageTag), fFilter(filter)
|
|
|
|
{
|
|
|
|
// anything?
|
|
|
|
}
|
|
|
|
|
|
|
|
GlyphSubstitutionLookupProcessor::GlyphSubstitutionLookupProcessor()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2001-01-19 00:30:17 +00:00
|
|
|
le_uint32 GlyphSubstitutionLookupProcessor::applySubtable(const LookupSubtable *lookupSubtable, le_uint16 lookupType,
|
|
|
|
GlyphIterator *glyphIterator, const LEFontInstance *fontInstance) const
|
2000-11-28 20:56:52 +00:00
|
|
|
{
|
|
|
|
le_uint32 delta = 0;
|
|
|
|
|
|
|
|
switch(lookupType)
|
|
|
|
{
|
|
|
|
case 0:
|
|
|
|
break;
|
|
|
|
|
|
|
|
case gsstSingle:
|
|
|
|
{
|
2001-01-19 00:30:17 +00:00
|
|
|
const SingleSubstitutionSubtable *subtable = (const SingleSubstitutionSubtable *) lookupSubtable;
|
2000-11-28 20:56:52 +00:00
|
|
|
|
|
|
|
delta = subtable->process(glyphIterator, fFilter);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
case gsstMultiple:
|
|
|
|
{
|
2001-01-19 00:30:17 +00:00
|
|
|
const MultipleSubstitutionSubtable *subtable = (const MultipleSubstitutionSubtable *) lookupSubtable;
|
2000-11-28 20:56:52 +00:00
|
|
|
|
|
|
|
delta = subtable->process(glyphIterator, fFilter);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
case gsstAlternate:
|
|
|
|
{
|
2001-01-19 00:30:17 +00:00
|
|
|
const AlternateSubstitutionSubtable *subtable = (const AlternateSubstitutionSubtable *) lookupSubtable;
|
2000-11-28 20:56:52 +00:00
|
|
|
|
|
|
|
delta = subtable->process(glyphIterator, fFilter);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
case gsstLigature:
|
|
|
|
{
|
2001-01-19 00:30:17 +00:00
|
|
|
const LigatureSubstitutionSubtable *subtable = (const LigatureSubstitutionSubtable *) lookupSubtable;
|
2000-11-28 20:56:52 +00:00
|
|
|
|
|
|
|
delta = subtable->process(glyphIterator, fFilter);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
case gsstContext:
|
|
|
|
{
|
2001-01-19 00:30:17 +00:00
|
|
|
const ContextualSubstitutionSubtable *subtable = (const ContextualSubstitutionSubtable *) lookupSubtable;
|
2000-11-28 20:56:52 +00:00
|
|
|
|
|
|
|
delta = subtable->process(this, glyphIterator, fontInstance);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
case gsstChainingContext:
|
|
|
|
{
|
2001-01-19 00:30:17 +00:00
|
|
|
const ChainingContextualSubstitutionSubtable *subtable = (const ChainingContextualSubstitutionSubtable *) lookupSubtable;
|
2000-11-28 20:56:52 +00:00
|
|
|
|
|
|
|
delta = subtable->process(this, glyphIterator, fontInstance);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return delta;
|
|
|
|
}
|
|
|
|
|
|
|
|
GlyphSubstitutionLookupProcessor::~GlyphSubstitutionLookupProcessor()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|