diff --git a/icu4c/source/layout/ExtensionSubtables.cpp b/icu4c/source/layout/ExtensionSubtables.cpp new file mode 100644 index 0000000000..3453743e40 --- /dev/null +++ b/icu4c/source/layout/ExtensionSubtables.cpp @@ -0,0 +1,35 @@ +/* + * %W% %E% + * + * (C) Copyright IBM Corp. 2002 - All Rights Reserved + * + */ + +#include "LETypes.h" +#include "OpenTypeTables.h" +#include "GlyphSubstitutionTables.h" +#include "LookupProcessor.h" +#include "ExtensionSubtables.h" +#include "GlyphIterator.h" +#include "LESwaps.h" + +U_NAMESPACE_BEGIN + + +// FIXME: should look at the format too... maybe have a sub-class for it? +le_uint32 ExtensionSubtable::process(const LookupProcessor *lookupProcessor, le_uint16 lookupType, + GlyphIterator *glyphIterator, const LEFontInstance *fontInstance) const +{ + le_uint16 elt = SWAPW(extensionLookupType); + + if (elt != lookupType) { + le_uint32 extOffset = SWAPL(extensionOffset); + LookupSubtable *subtable = (LookupSubtable *) ((char *) this + extOffset); + + return lookupProcessor->applySubtable(subtable, elt, glyphIterator, fontInstance); + } + + return 0; +} + +U_NAMESPACE_END diff --git a/icu4c/source/layout/ExtensionSubtables.h b/icu4c/source/layout/ExtensionSubtables.h new file mode 100644 index 0000000000..f33d346ba3 --- /dev/null +++ b/icu4c/source/layout/ExtensionSubtables.h @@ -0,0 +1,30 @@ +/* + * %W% %E% + * + * (C) Copyright IBM Corp. 2002 - All Rights Reserved + * + */ + +#ifndef __EXTENSIONSUBTABLES_H +#define __EXTENSIONSUBTABLES_H + +#include "LETypes.h" +#include "OpenTypeTables.h" +#include "GlyphSubstitutionTables.h" +#include "LookupProcessor.h" +#include "GlyphIterator.h" + +U_NAMESPACE_BEGIN + +struct ExtensionSubtable //: GlyphSubstitutionSubtable +{ + le_uint16 substFormat; + le_uint16 extensionLookupType; + le_uint32 extensionOffset; + + le_uint32 process(const LookupProcessor *lookupProcessor, le_uint16 lookupType, + GlyphIterator *glyphIterator, const LEFontInstance *fontInstance) const; +}; + +U_NAMESPACE_END +#endif diff --git a/icu4c/source/layout/GlyphPositioningTables.h b/icu4c/source/layout/GlyphPositioningTables.h index 67cd15e188..daa891199c 100644 --- a/icu4c/source/layout/GlyphPositioningTables.h +++ b/icu4c/source/layout/GlyphPositioningTables.h @@ -40,7 +40,8 @@ enum GlyphPositioningSubtableTypes gpstMarkToLigature = 5, gpstMarkToMark = 6, gpstContext = 7, - gpstChainedContext = 8 + gpstChainedContext = 8, + gpstExtension = 9 }; typedef LookupSubtable GlyphPositioningSubtable; diff --git a/icu4c/source/layout/GlyphPosnLookupProc.cpp b/icu4c/source/layout/GlyphPosnLookupProc.cpp index 71c69aa70d..50855ebe27 100644 --- a/icu4c/source/layout/GlyphPosnLookupProc.cpp +++ b/icu4c/source/layout/GlyphPosnLookupProc.cpp @@ -21,6 +21,7 @@ #include "MarkToMarkPosnSubtables.h" //#include "ContextualPositioningSubtables.h" #include "ContextualSubstSubtables.h" +#include "ExtensionSubtables.h" #include "LookupProcessor.h" #include "GlyphPosnLookupProc.h" #include "LESwaps.h" @@ -124,6 +125,14 @@ le_uint32 GlyphPositioningLookupProcessor::applySubtable(const LookupSubtable *l break; } + case gpstExtension: + { + const ExtensionSubtable *subtable = (const ExtensionSubtable *) lookupSubtable; + + delta = subtable->process(this, lookupType, glyphIterator, fontInstance); + break; + } + default: break; } diff --git a/icu4c/source/layout/GlyphSubstLookupProc.cpp b/icu4c/source/layout/GlyphSubstLookupProc.cpp index d7574502a6..1d0f0086a9 100644 --- a/icu4c/source/layout/GlyphSubstLookupProc.cpp +++ b/icu4c/source/layout/GlyphSubstLookupProc.cpp @@ -19,6 +19,7 @@ #include "AlternateSubstSubtables.h" #include "LigatureSubstSubtables.h" #include "ContextualSubstSubtables.h" +#include "ExtensionSubtables.h" #include "LookupProcessor.h" #include "GlyphSubstLookupProc.h" #include "LESwaps.h" @@ -100,6 +101,14 @@ le_uint32 GlyphSubstitutionLookupProcessor::applySubtable(const LookupSubtable * break; } + case gsstExtension: + { + const ExtensionSubtable *subtable = (const ExtensionSubtable *) lookupSubtable; + + delta = subtable->process(this, lookupType, glyphIterator, fontInstance); + break; + } + default: break; } diff --git a/icu4c/source/layout/GlyphSubstitutionTables.h b/icu4c/source/layout/GlyphSubstitutionTables.h index 3e1a08da1f..f33b568741 100644 --- a/icu4c/source/layout/GlyphSubstitutionTables.h +++ b/icu4c/source/layout/GlyphSubstitutionTables.h @@ -39,7 +39,9 @@ enum GlyphSubstitutionSubtableTypes gsstAlternate = 3, gsstLigature = 4, gsstContext = 5, - gsstChainingContext = 6 + gsstChainingContext = 6, + gsstExtension = 7, + gsstReverseChaining = 8 }; typedef LookupSubtable GlyphSubstitutionSubtable; diff --git a/icu4c/source/layout/layout.dsp b/icu4c/source/layout/layout.dsp index 3301c5544c..198baff453 100644 --- a/icu4c/source/layout/layout.dsp +++ b/icu4c/source/layout/layout.dsp @@ -194,6 +194,10 @@ SOURCE=.\DeviceTables.cpp # End Source File # Begin Source File +SOURCE=.\ExtensionSubtables.cpp +# End Source File +# Begin Source File + SOURCE=.\Features.cpp # End Source File # Begin Source File @@ -446,6 +450,10 @@ SOURCE=.\DeviceTables.h # End Source File # Begin Source File +SOURCE=.\ExtensionSubtables.h +# End Source File +# Begin Source File + SOURCE=.\Features.h # End Source File # Begin Source File