2000-11-28 20:56:52 +00:00
|
|
|
/*
|
2010-01-07 22:57:20 +00:00
|
|
|
* (C) Copyright IBM Corp. 1998 - 2010 - All Rights Reserved
|
2000-11-28 20:56:52 +00:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "LETypes.h"
|
|
|
|
#include "LEFontInstance.h"
|
|
|
|
#include "OpenTypeTables.h"
|
2010-01-07 22:57:20 +00:00
|
|
|
#include "ICUFeatures.h"
|
2000-11-28 20:56:52 +00:00
|
|
|
#include "Lookups.h"
|
|
|
|
#include "ScriptAndLanguage.h"
|
|
|
|
#include "GlyphDefinitionTables.h"
|
|
|
|
#include "GlyphPositioningTables.h"
|
|
|
|
#include "SinglePositioningSubtables.h"
|
|
|
|
#include "PairPositioningSubtables.h"
|
2002-06-10 23:40:33 +00:00
|
|
|
#include "CursiveAttachmentSubtables.h"
|
2000-12-21 02:44:45 +00:00
|
|
|
#include "MarkToBasePosnSubtables.h"
|
|
|
|
#include "MarkToLigaturePosnSubtables.h"
|
|
|
|
#include "MarkToMarkPosnSubtables.h"
|
2000-11-28 20:56:52 +00:00
|
|
|
//#include "ContextualPositioningSubtables.h"
|
2000-12-21 02:44:45 +00:00
|
|
|
#include "ContextualSubstSubtables.h"
|
2002-12-30 19:53:40 +00:00
|
|
|
#include "ExtensionSubtables.h"
|
2000-11-28 20:56:52 +00:00
|
|
|
#include "LookupProcessor.h"
|
2000-12-21 02:44:45 +00:00
|
|
|
#include "GlyphPosnLookupProc.h"
|
2000-11-28 20:56:52 +00:00
|
|
|
#include "LESwaps.h"
|
|
|
|
|
2001-10-16 00:39:01 +00:00
|
|
|
U_NAMESPACE_BEGIN
|
|
|
|
|
2000-11-28 20:56:52 +00:00
|
|
|
// Aside from the names, the contextual positioning subtables are
|
|
|
|
// the same as the contextual substitution subtables.
|
|
|
|
typedef ContextualSubstitutionSubtable ContextualPositioningSubtable;
|
|
|
|
typedef ChainingContextualSubstitutionSubtable ChainingContextualPositioningSubtable;
|
|
|
|
|
|
|
|
GlyphPositioningLookupProcessor::GlyphPositioningLookupProcessor(
|
2001-01-19 00:30:17 +00:00
|
|
|
const GlyphPositioningTableHeader *glyphPositioningTableHeader,
|
2008-12-02 17:17:15 +00:00
|
|
|
LETag scriptTag,
|
|
|
|
LETag languageTag,
|
|
|
|
const FeatureMap *featureMap,
|
|
|
|
le_int32 featureMapCount,
|
|
|
|
le_bool featureOrder,
|
|
|
|
LEErrorCode& success)
|
2000-11-28 20:56:52 +00:00
|
|
|
: LookupProcessor(
|
|
|
|
(char *) glyphPositioningTableHeader,
|
|
|
|
SWAPW(glyphPositioningTableHeader->scriptListOffset),
|
|
|
|
SWAPW(glyphPositioningTableHeader->featureListOffset),
|
|
|
|
SWAPW(glyphPositioningTableHeader->lookupListOffset),
|
2008-12-02 17:17:15 +00:00
|
|
|
scriptTag,
|
|
|
|
languageTag,
|
|
|
|
featureMap,
|
|
|
|
featureMapCount,
|
|
|
|
featureOrder,
|
|
|
|
success
|
|
|
|
)
|
2000-11-28 20:56:52 +00:00
|
|
|
{
|
|
|
|
// anything?
|
|
|
|
}
|
|
|
|
|
|
|
|
GlyphPositioningLookupProcessor::GlyphPositioningLookupProcessor()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2001-01-19 00:30:17 +00:00
|
|
|
le_uint32 GlyphPositioningLookupProcessor::applySubtable(const LookupSubtable *lookupSubtable, le_uint16 lookupType,
|
2000-11-28 20:56:52 +00:00
|
|
|
GlyphIterator *glyphIterator,
|
2008-10-28 14:50:15 +00:00
|
|
|
const LEFontInstance *fontInstance,
|
|
|
|
LEErrorCode& success) const
|
2000-11-28 20:56:52 +00:00
|
|
|
{
|
2008-10-28 14:50:15 +00:00
|
|
|
if (LE_FAILURE(success)) {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2000-11-28 20:56:52 +00:00
|
|
|
le_uint32 delta = 0;
|
|
|
|
|
|
|
|
switch(lookupType)
|
|
|
|
{
|
|
|
|
case 0:
|
|
|
|
break;
|
|
|
|
|
|
|
|
case gpstSingle:
|
|
|
|
{
|
2001-01-19 00:30:17 +00:00
|
|
|
const SinglePositioningSubtable *subtable = (const SinglePositioningSubtable *) lookupSubtable;
|
2000-11-28 20:56:52 +00:00
|
|
|
|
|
|
|
delta = subtable->process(glyphIterator, fontInstance);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
case gpstPair:
|
|
|
|
{
|
2001-01-19 00:30:17 +00:00
|
|
|
const PairPositioningSubtable *subtable = (const PairPositioningSubtable *) lookupSubtable;
|
2000-11-28 20:56:52 +00:00
|
|
|
|
|
|
|
delta = subtable->process(glyphIterator, fontInstance);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
case gpstCursive:
|
|
|
|
{
|
2002-06-10 23:40:33 +00:00
|
|
|
const CursiveAttachmentSubtable *subtable = (const CursiveAttachmentSubtable *) lookupSubtable;
|
2000-11-28 20:56:52 +00:00
|
|
|
|
|
|
|
delta = subtable->process(glyphIterator, fontInstance);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
case gpstMarkToBase:
|
|
|
|
{
|
2001-01-19 00:30:17 +00:00
|
|
|
const MarkToBasePositioningSubtable *subtable = (const MarkToBasePositioningSubtable *) lookupSubtable;
|
2000-11-28 20:56:52 +00:00
|
|
|
|
|
|
|
delta = subtable->process(glyphIterator, fontInstance);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
case gpstMarkToLigature:
|
|
|
|
{
|
2001-01-19 00:30:17 +00:00
|
|
|
const MarkToLigaturePositioningSubtable *subtable = (const MarkToLigaturePositioningSubtable *) lookupSubtable;
|
2000-11-28 20:56:52 +00:00
|
|
|
|
|
|
|
delta = subtable->process(glyphIterator, fontInstance);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
case gpstMarkToMark:
|
|
|
|
{
|
2001-01-19 00:30:17 +00:00
|
|
|
const MarkToMarkPositioningSubtable *subtable = (const MarkToMarkPositioningSubtable *) lookupSubtable;
|
2000-11-28 20:56:52 +00:00
|
|
|
|
|
|
|
delta = subtable->process(glyphIterator, fontInstance);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
case gpstContext:
|
|
|
|
{
|
2001-01-19 00:30:17 +00:00
|
|
|
const ContextualPositioningSubtable *subtable = (const ContextualPositioningSubtable *) lookupSubtable;
|
2000-11-28 20:56:52 +00:00
|
|
|
|
2008-10-28 14:50:15 +00:00
|
|
|
delta = subtable->process(this, glyphIterator, fontInstance, success);
|
2000-11-28 20:56:52 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
case gpstChainedContext:
|
|
|
|
{
|
2001-01-19 00:30:17 +00:00
|
|
|
const ChainingContextualPositioningSubtable *subtable = (const ChainingContextualPositioningSubtable *) lookupSubtable;
|
2000-11-28 20:56:52 +00:00
|
|
|
|
2008-10-28 14:50:15 +00:00
|
|
|
delta = subtable->process(this, glyphIterator, fontInstance, success);
|
2000-11-28 20:56:52 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2002-12-30 19:53:40 +00:00
|
|
|
case gpstExtension:
|
|
|
|
{
|
|
|
|
const ExtensionSubtable *subtable = (const ExtensionSubtable *) lookupSubtable;
|
|
|
|
|
2008-10-28 14:50:15 +00:00
|
|
|
delta = subtable->process(this, lookupType, glyphIterator, fontInstance, success);
|
2002-12-30 19:53:40 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2000-11-28 20:56:52 +00:00
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return delta;
|
|
|
|
}
|
|
|
|
|
|
|
|
GlyphPositioningLookupProcessor::~GlyphPositioningLookupProcessor()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2001-10-16 00:39:01 +00:00
|
|
|
U_NAMESPACE_END
|