jdk/src/share/native/sun/font/layout/PairPositioningSubtables.cpp
changeset 16891 91e99bed64ae
parent 7486 6a36b1ebc620
child 18254 e4083179f1c9
equal deleted inserted replaced
16890:36b30720a997 16891:91e99bed64ae
    39 #include "OpenTypeUtilities.h"
    39 #include "OpenTypeUtilities.h"
    40 #include "LESwaps.h"
    40 #include "LESwaps.h"
    41 
    41 
    42 U_NAMESPACE_BEGIN
    42 U_NAMESPACE_BEGIN
    43 
    43 
    44 le_uint32 PairPositioningSubtable::process(GlyphIterator *glyphIterator, const LEFontInstance *fontInstance) const
    44 le_uint32 PairPositioningSubtable::process(const LEReferenceTo<PairPositioningSubtable> &base, GlyphIterator *glyphIterator, const LEFontInstance *fontInstance, LEErrorCode &success) const
    45 {
    45 {
    46     switch(SWAPW(subtableFormat))
    46     switch(SWAPW(subtableFormat))
    47     {
    47     {
    48     case 0:
    48     case 0:
    49         return 0;
    49         return 0;
    50 
    50 
    51     case 1:
    51     case 1:
    52     {
    52     {
    53         const PairPositioningFormat1Subtable *subtable = (const PairPositioningFormat1Subtable *) this;
    53       const LEReferenceTo<PairPositioningFormat1Subtable> subtable(base, success, (const PairPositioningFormat1Subtable *) this);
    54 
    54 
    55         return subtable->process(glyphIterator, fontInstance);
    55       if(LE_SUCCESS(success))
       
    56       return subtable->process(subtable, glyphIterator, fontInstance, success);
       
    57       else
       
    58         return 0;
    56     }
    59     }
    57 
    60 
    58     case 2:
    61     case 2:
    59     {
    62     {
    60         const PairPositioningFormat2Subtable *subtable = (const PairPositioningFormat2Subtable *) this;
    63       const LEReferenceTo<PairPositioningFormat2Subtable> subtable(base, success, (const PairPositioningFormat2Subtable *) this);
    61 
    64 
    62         return subtable->process(glyphIterator, fontInstance);
    65       if(LE_SUCCESS(success))
    63     }
    66       return subtable->process(subtable, glyphIterator, fontInstance, success);
    64 
    67       else
       
    68         return 0;
       
    69     }
    65     default:
    70     default:
    66         return 0;
    71       return 0;
    67     }
    72     }
    68 }
    73 }
    69 
    74 
    70 le_uint32 PairPositioningFormat1Subtable::process(GlyphIterator *glyphIterator, const LEFontInstance *fontInstance) const
    75 le_uint32 PairPositioningFormat1Subtable::process(const LEReferenceTo<PairPositioningFormat1Subtable> &base, GlyphIterator *glyphIterator, const LEFontInstance *fontInstance, LEErrorCode &success) const
    71 {
    76 {
    72     LEGlyphID firstGlyph = glyphIterator->getCurrGlyphID();
    77     LEGlyphID firstGlyph = glyphIterator->getCurrGlyphID();
    73     le_int32 coverageIndex = getGlyphCoverage(firstGlyph);
    78     le_int32 coverageIndex = getGlyphCoverage(base, firstGlyph, success);
    74     GlyphIterator tempIterator(*glyphIterator);
    79     GlyphIterator tempIterator(*glyphIterator);
    75 
    80 
    76     if (coverageIndex >= 0 && glyphIterator->next()) {
    81     if (coverageIndex >= 0 && glyphIterator->next()) {
    77         Offset pairSetTableOffset = SWAPW(pairSetTableOffsetArray[coverageIndex]);
    82         Offset pairSetTableOffset = SWAPW(pairSetTableOffsetArray[coverageIndex]);
    78         PairSetTable *pairSetTable = (PairSetTable *) ((char *) this + pairSetTableOffset);
    83         PairSetTable *pairSetTable = (PairSetTable *) ((char *) this + pairSetTableOffset);
   108     }
   113     }
   109 
   114 
   110     return 0;
   115     return 0;
   111 }
   116 }
   112 
   117 
   113 le_uint32 PairPositioningFormat2Subtable::process(GlyphIterator *glyphIterator, const LEFontInstance *fontInstance) const
   118 le_uint32 PairPositioningFormat2Subtable::process(const LEReferenceTo<PairPositioningFormat2Subtable> &base, GlyphIterator *glyphIterator, const LEFontInstance *fontInstance, LEErrorCode &success) const
   114 {
   119 {
   115     LEGlyphID firstGlyph = glyphIterator->getCurrGlyphID();
   120     LEGlyphID firstGlyph = glyphIterator->getCurrGlyphID();
   116     le_int32 coverageIndex = getGlyphCoverage(firstGlyph);
   121     le_int32 coverageIndex = getGlyphCoverage(base, firstGlyph, success);
   117     GlyphIterator tempIterator(*glyphIterator);
   122     GlyphIterator tempIterator(*glyphIterator);
   118 
   123 
   119     if (coverageIndex >= 0 && glyphIterator->next()) {
   124     if (coverageIndex >= 0 && glyphIterator->next()) {
   120         LEGlyphID secondGlyph = glyphIterator->getCurrGlyphID();
   125         LEGlyphID secondGlyph = glyphIterator->getCurrGlyphID();
   121         const ClassDefinitionTable *classDef1 = (const ClassDefinitionTable *) ((char *) this + SWAPW(classDef1Offset));
   126         const ClassDefinitionTable *classDef1 = (const ClassDefinitionTable *) ((char *) this + SWAPW(classDef1Offset));