2002-12-30 19:53:40 +00:00
|
|
|
/*
|
|
|
|
* %W% %E%
|
|
|
|
*
|
2013-04-18 21:24:51 +00:00
|
|
|
* (C) Copyright IBM Corp. 2008-2013 - All Rights Reserved
|
2002-12-30 19:53:40 +00:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "LETypes.h"
|
|
|
|
#include "OpenTypeTables.h"
|
|
|
|
#include "GlyphSubstitutionTables.h"
|
|
|
|
#include "LookupProcessor.h"
|
|
|
|
#include "ExtensionSubtables.h"
|
|
|
|
#include "GlyphIterator.h"
|
|
|
|
#include "LESwaps.h"
|
|
|
|
|
|
|
|
U_NAMESPACE_BEGIN
|
|
|
|
|
2010-01-07 22:32:53 +00:00
|
|
|
// read a 32-bit value that might only be 16-bit-aligned in memory
|
2011-07-22 22:02:57 +00:00
|
|
|
static inline le_uint32 READ_LONG(le_uint32 code) {
|
|
|
|
le_uint16* first = ((le_uint16*)&code);
|
|
|
|
le_uint16* second = (((le_uint16*)&code) + 1);
|
2011-08-11 18:45:09 +00:00
|
|
|
return (le_uint32)((SWAPW(*first) << 16) + SWAPW(*second));
|
2011-07-22 22:02:57 +00:00
|
|
|
}
|
2002-12-30 19:53:40 +00:00
|
|
|
|
|
|
|
// FIXME: should look at the format too... maybe have a sub-class for it?
|
|
|
|
le_uint32 ExtensionSubtable::process(const LookupProcessor *lookupProcessor, le_uint16 lookupType,
|
2008-10-28 14:50:15 +00:00
|
|
|
GlyphIterator *glyphIterator, const LEFontInstance *fontInstance, LEErrorCode& success) const
|
2002-12-30 19:53:40 +00:00
|
|
|
{
|
2013-04-18 21:24:51 +00:00
|
|
|
const LEReferenceTo<ExtensionSubtable> thisRef(lookupProcessor->getReference(), success); // create a reference to this
|
|
|
|
|
2008-10-28 14:50:15 +00:00
|
|
|
if (LE_FAILURE(success)) {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2002-12-30 19:53:40 +00:00
|
|
|
le_uint16 elt = SWAPW(extensionLookupType);
|
|
|
|
|
2011-07-22 22:02:57 +00:00
|
|
|
if (elt != lookupType) {
|
2010-01-07 22:32:53 +00:00
|
|
|
le_uint32 extOffset = READ_LONG(extensionOffset);
|
2013-04-18 21:24:51 +00:00
|
|
|
LEReferenceTo<LookupSubtable> subtable(thisRef, success, extOffset);
|
2002-12-30 19:53:40 +00:00
|
|
|
|
2013-04-18 21:24:51 +00:00
|
|
|
if(LE_SUCCESS(success)) {
|
|
|
|
return lookupProcessor->applySubtable(subtable, elt, glyphIterator, fontInstance, success);
|
|
|
|
}
|
2002-12-30 19:53:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
U_NAMESPACE_END
|