jdk/src/java.desktop/share/native/libfontmanager/layout/IndicRearrangementProcessor.cpp
author prr
Wed, 29 Jul 2015 11:04:39 -0700
changeset 33299 78f5508cde89
parent 31692 6f9d9bd603ce
child 35291 924c479304a5
permissions -rw-r--r--
8132042: Preserve layout presentation Reviewed-by: mschoene, srl, serb
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
     2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
 * This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
 * under the terms of the GNU General Public License version 2 only, as
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 3935
diff changeset
     6
 * published by the Free Software Foundation.  Oracle designates this
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     7
 * particular file as subject to the "Classpath" exception as provided
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 3935
diff changeset
     8
 * by Oracle in the LICENSE file that accompanied this code.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     9
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 * This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 * version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 * accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 * You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 * 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
 *
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 3935
diff changeset
    20
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 3935
diff changeset
    21
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 3935
diff changeset
    22
 * questions.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    23
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
 * (C) Copyright IBM Corp. 1998-2004 - All Rights Reserved
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
#include "LETypes.h"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
#include "MorphTables.h"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
#include "StateTables.h"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
#include "MorphStateTables.h"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
#include "SubtableProcessor.h"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
#include "StateTableProcessor.h"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
#include "IndicRearrangementProcessor.h"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
#include "LEGlyphStorage.h"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
#include "LESwaps.h"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
3935
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
    42
U_NAMESPACE_BEGIN
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
    43
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
    44
UOBJECT_DEFINE_RTTI_IMPLEMENTATION(IndicRearrangementProcessor)
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
    45
16891
91e99bed64ae 8001031: Better font processing
prr
parents: 5506
diff changeset
    46
  IndicRearrangementProcessor::IndicRearrangementProcessor(const LEReferenceTo<MorphSubtableHeader> &morphSubtableHeader, LEErrorCode &success)
91e99bed64ae 8001031: Better font processing
prr
parents: 5506
diff changeset
    47
  : StateTableProcessor(morphSubtableHeader, success),
91e99bed64ae 8001031: Better font processing
prr
parents: 5506
diff changeset
    48
  indicRearrangementSubtableHeader(morphSubtableHeader, success),
91e99bed64ae 8001031: Better font processing
prr
parents: 5506
diff changeset
    49
  entryTable(stateTableHeader, success, (const IndicRearrangementStateEntry*)(&stateTableHeader->stHeader),
91e99bed64ae 8001031: Better font processing
prr
parents: 5506
diff changeset
    50
             entryTableOffset, LE_UNBOUNDED_ARRAY),
91e99bed64ae 8001031: Better font processing
prr
parents: 5506
diff changeset
    51
  int16Table(stateTableHeader, success, (const le_int16*)entryTable.getAlias(), 0, LE_UNBOUNDED_ARRAY)
91e99bed64ae 8001031: Better font processing
prr
parents: 5506
diff changeset
    52
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
IndicRearrangementProcessor::~IndicRearrangementProcessor()
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
void IndicRearrangementProcessor::beginStateTable()
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
    firstGlyph = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
    lastGlyph = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
3935
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
    66
ByteOffset IndicRearrangementProcessor::processStateEntry(LEGlyphStorage &glyphStorage, le_int32 &currGlyph, EntryTableIndex index)
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
{
16891
91e99bed64ae 8001031: Better font processing
prr
parents: 5506
diff changeset
    68
  LEErrorCode success = LE_NO_ERROR; // todo- make a param?
91e99bed64ae 8001031: Better font processing
prr
parents: 5506
diff changeset
    69
  const IndicRearrangementStateEntry *entry = entryTable.getAlias(index,success);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
    ByteOffset newState = SWAPW(entry->newStateOffset);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
    IndicRearrangementFlags flags = (IndicRearrangementFlags) SWAPW(entry->flags);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
31692
6f9d9bd603ce 8071715: Tune font layout engine
prr
parents: 25859
diff changeset
    73
    if (currGlyph < 0 || currGlyph >= glyphStorage.getGlyphCount()) {
6f9d9bd603ce 8071715: Tune font layout engine
prr
parents: 25859
diff changeset
    74
       success = LE_INDEX_OUT_OF_BOUNDS_ERROR;
6f9d9bd603ce 8071715: Tune font layout engine
prr
parents: 25859
diff changeset
    75
       return 0;
6f9d9bd603ce 8071715: Tune font layout engine
prr
parents: 25859
diff changeset
    76
    }
6f9d9bd603ce 8071715: Tune font layout engine
prr
parents: 25859
diff changeset
    77
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
    if (flags & irfMarkFirst) {
33299
78f5508cde89 8132042: Preserve layout presentation
prr
parents: 31692
diff changeset
    79
        firstGlyph = (le_uint32)currGlyph;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
    if (flags & irfMarkLast) {
33299
78f5508cde89 8132042: Preserve layout presentation
prr
parents: 31692
diff changeset
    83
        lastGlyph = (le_uint32)currGlyph;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
33299
78f5508cde89 8132042: Preserve layout presentation
prr
parents: 31692
diff changeset
    86
    doRearrangementAction(glyphStorage, (IndicRearrangementVerb) (flags & irfVerbMask), success);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
    if (!(flags & irfDontAdvance)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
        // XXX: Should handle reverse too...
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
        currGlyph += 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
    return newState;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
void IndicRearrangementProcessor::endStateTable()
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
33299
78f5508cde89 8132042: Preserve layout presentation
prr
parents: 31692
diff changeset
   100
void IndicRearrangementProcessor::doRearrangementAction(LEGlyphStorage &glyphStorage, IndicRearrangementVerb verb, LEErrorCode &success) const
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
    LEGlyphID a, b, c, d;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
    le_int32 ia, ib, ic, id, ix, x;
33299
78f5508cde89 8132042: Preserve layout presentation
prr
parents: 31692
diff changeset
   104
78f5508cde89 8132042: Preserve layout presentation
prr
parents: 31692
diff changeset
   105
    if (LE_FAILURE(success)) return;
78f5508cde89 8132042: Preserve layout presentation
prr
parents: 31692
diff changeset
   106
78f5508cde89 8132042: Preserve layout presentation
prr
parents: 31692
diff changeset
   107
    if (verb == irvNoAction) {
78f5508cde89 8132042: Preserve layout presentation
prr
parents: 31692
diff changeset
   108
        return;
78f5508cde89 8132042: Preserve layout presentation
prr
parents: 31692
diff changeset
   109
    }
78f5508cde89 8132042: Preserve layout presentation
prr
parents: 31692
diff changeset
   110
    if (firstGlyph > lastGlyph) {
78f5508cde89 8132042: Preserve layout presentation
prr
parents: 31692
diff changeset
   111
        success = LE_INDEX_OUT_OF_BOUNDS_ERROR;
78f5508cde89 8132042: Preserve layout presentation
prr
parents: 31692
diff changeset
   112
        return;
78f5508cde89 8132042: Preserve layout presentation
prr
parents: 31692
diff changeset
   113
    }
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
    switch(verb)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
    {
33299
78f5508cde89 8132042: Preserve layout presentation
prr
parents: 31692
diff changeset
   117
    case irvxA:
78f5508cde89 8132042: Preserve layout presentation
prr
parents: 31692
diff changeset
   118
        if (firstGlyph == lastGlyph) break;
78f5508cde89 8132042: Preserve layout presentation
prr
parents: 31692
diff changeset
   119
        if (firstGlyph + 1 < firstGlyph) {
78f5508cde89 8132042: Preserve layout presentation
prr
parents: 31692
diff changeset
   120
            success = LE_INDEX_OUT_OF_BOUNDS_ERROR;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
        break;
33299
78f5508cde89 8132042: Preserve layout presentation
prr
parents: 31692
diff changeset
   122
        }
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
        a = glyphStorage[firstGlyph];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
        ia = glyphStorage.getCharIndex(firstGlyph, success);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
        x = firstGlyph + 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
        while (x <= lastGlyph) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
            glyphStorage[x - 1] = glyphStorage[x];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
            ix = glyphStorage.getCharIndex(x, success);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
            glyphStorage.setCharIndex(x - 1, ix, success);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
            x += 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
        glyphStorage[lastGlyph] = a;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
        glyphStorage.setCharIndex(lastGlyph, ia, success);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
        break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
    case irvDx:
33299
78f5508cde89 8132042: Preserve layout presentation
prr
parents: 31692
diff changeset
   139
        if (firstGlyph == lastGlyph) break;
78f5508cde89 8132042: Preserve layout presentation
prr
parents: 31692
diff changeset
   140
        if (lastGlyph - 1 > lastGlyph) {
78f5508cde89 8132042: Preserve layout presentation
prr
parents: 31692
diff changeset
   141
            success = LE_INDEX_OUT_OF_BOUNDS_ERROR;
78f5508cde89 8132042: Preserve layout presentation
prr
parents: 31692
diff changeset
   142
            break;
78f5508cde89 8132042: Preserve layout presentation
prr
parents: 31692
diff changeset
   143
        }
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
        d = glyphStorage[lastGlyph];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
        id = glyphStorage.getCharIndex(lastGlyph, success);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
        x = lastGlyph - 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
        while (x >= firstGlyph) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
            glyphStorage[x + 1] = glyphStorage[x];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
            ix = glyphStorage.getCharIndex(x, success);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
            glyphStorage.setCharIndex(x + 1, ix, success);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
            x -= 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
        glyphStorage[firstGlyph] = d;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
        glyphStorage.setCharIndex(firstGlyph, id, success);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
        break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
    case irvDxA:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
        a = glyphStorage[firstGlyph];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
        ia = glyphStorage.getCharIndex(firstGlyph, success);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
        id = glyphStorage.getCharIndex(lastGlyph,  success);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
        glyphStorage[firstGlyph] = glyphStorage[lastGlyph];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
        glyphStorage[lastGlyph] = a;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
        glyphStorage.setCharIndex(firstGlyph, id, success);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
        glyphStorage.setCharIndex(lastGlyph,  ia, success);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
        break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
    case irvxAB:
33299
78f5508cde89 8132042: Preserve layout presentation
prr
parents: 31692
diff changeset
   172
        if ((firstGlyph + 2 < firstGlyph) ||
78f5508cde89 8132042: Preserve layout presentation
prr
parents: 31692
diff changeset
   173
            (lastGlyph - firstGlyph < 1)) { // difference == 1 is a no-op, < 1 is an error.
78f5508cde89 8132042: Preserve layout presentation
prr
parents: 31692
diff changeset
   174
            success = LE_INDEX_OUT_OF_BOUNDS_ERROR;
78f5508cde89 8132042: Preserve layout presentation
prr
parents: 31692
diff changeset
   175
            break;
78f5508cde89 8132042: Preserve layout presentation
prr
parents: 31692
diff changeset
   176
        }
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
        a = glyphStorage[firstGlyph];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
        b = glyphStorage[firstGlyph + 1];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
        ia = glyphStorage.getCharIndex(firstGlyph, success);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
        ib = glyphStorage.getCharIndex(firstGlyph + 1, success);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
        x = firstGlyph + 2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
        while (x <= lastGlyph) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
            glyphStorage[x - 2] = glyphStorage[x];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
            ix = glyphStorage.getCharIndex(x, success);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
            glyphStorage.setCharIndex(x - 2, ix, success);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
            x += 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
        glyphStorage[lastGlyph - 1] = a;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
        glyphStorage[lastGlyph] = b;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
        glyphStorage.setCharIndex(lastGlyph - 1, ia, success);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
        glyphStorage.setCharIndex(lastGlyph, ib, success);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
        break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
    case irvxBA:
33299
78f5508cde89 8132042: Preserve layout presentation
prr
parents: 31692
diff changeset
   198
        if ((firstGlyph + 2 < firstGlyph) ||
78f5508cde89 8132042: Preserve layout presentation
prr
parents: 31692
diff changeset
   199
            (lastGlyph - firstGlyph < 1)) {
78f5508cde89 8132042: Preserve layout presentation
prr
parents: 31692
diff changeset
   200
            success = LE_INDEX_OUT_OF_BOUNDS_ERROR;
78f5508cde89 8132042: Preserve layout presentation
prr
parents: 31692
diff changeset
   201
            break;
78f5508cde89 8132042: Preserve layout presentation
prr
parents: 31692
diff changeset
   202
        }
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
        a = glyphStorage[firstGlyph];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
        b = glyphStorage[firstGlyph + 1];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
        ia = glyphStorage.getCharIndex(firstGlyph, success);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
        ib = glyphStorage.getCharIndex(firstGlyph + 1, success);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
        x = firstGlyph + 2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
        while (x <= lastGlyph) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
            glyphStorage[x - 2] = glyphStorage[x];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
            ix = glyphStorage.getCharIndex(x, success);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
            glyphStorage.setCharIndex(x - 2, ix, success);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
            x += 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
        glyphStorage[lastGlyph - 1] = b;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
        glyphStorage[lastGlyph] = a;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
        glyphStorage.setCharIndex(lastGlyph - 1, ib, success);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
        glyphStorage.setCharIndex(lastGlyph, ia, success);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
        break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
90ce3da70b43 Initial load
duke
parents:
diff changeset
   223
    case irvCDx:
33299
78f5508cde89 8132042: Preserve layout presentation
prr
parents: 31692
diff changeset
   224
        if ((lastGlyph - 2 > lastGlyph) ||
78f5508cde89 8132042: Preserve layout presentation
prr
parents: 31692
diff changeset
   225
            (lastGlyph - firstGlyph < 1)) {
78f5508cde89 8132042: Preserve layout presentation
prr
parents: 31692
diff changeset
   226
            success = LE_INDEX_OUT_OF_BOUNDS_ERROR;
78f5508cde89 8132042: Preserve layout presentation
prr
parents: 31692
diff changeset
   227
            break;
78f5508cde89 8132042: Preserve layout presentation
prr
parents: 31692
diff changeset
   228
        }
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   229
        c = glyphStorage[lastGlyph - 1];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   230
        d = glyphStorage[lastGlyph];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   231
        ic = glyphStorage.getCharIndex(lastGlyph - 1, success);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   232
        id = glyphStorage.getCharIndex(lastGlyph, success);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   233
        x = lastGlyph - 2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   234
90ce3da70b43 Initial load
duke
parents:
diff changeset
   235
        while (x >= firstGlyph) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   236
            glyphStorage[x + 2] = glyphStorage[x];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   237
            ix = glyphStorage.getCharIndex(x, success);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   238
            glyphStorage.setCharIndex(x + 2, ix, success);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   239
            x -= 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   240
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   241
90ce3da70b43 Initial load
duke
parents:
diff changeset
   242
        glyphStorage[firstGlyph] = c;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   243
        glyphStorage[firstGlyph + 1] = d;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   244
90ce3da70b43 Initial load
duke
parents:
diff changeset
   245
        glyphStorage.setCharIndex(firstGlyph, ic, success);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   246
        glyphStorage.setCharIndex(firstGlyph + 1, id, success);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   247
        break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   248
90ce3da70b43 Initial load
duke
parents:
diff changeset
   249
    case irvDCx:
33299
78f5508cde89 8132042: Preserve layout presentation
prr
parents: 31692
diff changeset
   250
        if ((lastGlyph - 2 > lastGlyph) ||
78f5508cde89 8132042: Preserve layout presentation
prr
parents: 31692
diff changeset
   251
            (lastGlyph - firstGlyph < 1)) {
78f5508cde89 8132042: Preserve layout presentation
prr
parents: 31692
diff changeset
   252
            success = LE_INDEX_OUT_OF_BOUNDS_ERROR;
78f5508cde89 8132042: Preserve layout presentation
prr
parents: 31692
diff changeset
   253
            break;
78f5508cde89 8132042: Preserve layout presentation
prr
parents: 31692
diff changeset
   254
        }
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   255
        c = glyphStorage[lastGlyph - 1];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   256
        d = glyphStorage[lastGlyph];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   257
        ic = glyphStorage.getCharIndex(lastGlyph - 1, success);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   258
        id = glyphStorage.getCharIndex(lastGlyph, success);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   259
        x = lastGlyph - 2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   260
90ce3da70b43 Initial load
duke
parents:
diff changeset
   261
        while (x >= firstGlyph) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   262
            glyphStorage[x + 2] = glyphStorage[x];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   263
            ix = glyphStorage.getCharIndex(x, success);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   264
            glyphStorage.setCharIndex(x + 2, ix, success);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   265
            x -= 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   266
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   267
90ce3da70b43 Initial load
duke
parents:
diff changeset
   268
        glyphStorage[firstGlyph] = d;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   269
        glyphStorage[firstGlyph + 1] = c;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   270
90ce3da70b43 Initial load
duke
parents:
diff changeset
   271
        glyphStorage.setCharIndex(firstGlyph, id, success);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   272
        glyphStorage.setCharIndex(firstGlyph + 1, ic, success);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   273
        break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   274
90ce3da70b43 Initial load
duke
parents:
diff changeset
   275
    case irvCDxA:
33299
78f5508cde89 8132042: Preserve layout presentation
prr
parents: 31692
diff changeset
   276
        if ((lastGlyph - 2 > lastGlyph) ||
78f5508cde89 8132042: Preserve layout presentation
prr
parents: 31692
diff changeset
   277
            (lastGlyph - firstGlyph < 2)) {
78f5508cde89 8132042: Preserve layout presentation
prr
parents: 31692
diff changeset
   278
            success = LE_INDEX_OUT_OF_BOUNDS_ERROR;
78f5508cde89 8132042: Preserve layout presentation
prr
parents: 31692
diff changeset
   279
            break;
78f5508cde89 8132042: Preserve layout presentation
prr
parents: 31692
diff changeset
   280
        }
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   281
        a = glyphStorage[firstGlyph];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   282
        c = glyphStorage[lastGlyph - 1];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   283
        d = glyphStorage[lastGlyph];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   284
        ia = glyphStorage.getCharIndex(firstGlyph, success);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   285
        ic = glyphStorage.getCharIndex(lastGlyph - 1, success);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   286
        id = glyphStorage.getCharIndex(lastGlyph, success);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   287
        x = lastGlyph - 2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   288
90ce3da70b43 Initial load
duke
parents:
diff changeset
   289
        while (x > firstGlyph) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   290
            glyphStorage[x + 1] = glyphStorage[x];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   291
            ix = glyphStorage.getCharIndex(x, success);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   292
            glyphStorage.setCharIndex(x + 1, ix, success);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   293
            x -= 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   294
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   295
90ce3da70b43 Initial load
duke
parents:
diff changeset
   296
        glyphStorage[firstGlyph] = c;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   297
        glyphStorage[firstGlyph + 1] = d;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   298
        glyphStorage[lastGlyph] = a;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   299
90ce3da70b43 Initial load
duke
parents:
diff changeset
   300
        glyphStorage.setCharIndex(firstGlyph, ic, success);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   301
        glyphStorage.setCharIndex(firstGlyph + 1, id, success);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   302
        glyphStorage.setCharIndex(lastGlyph, ia, success);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   303
        break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   304
90ce3da70b43 Initial load
duke
parents:
diff changeset
   305
    case irvDCxA:
33299
78f5508cde89 8132042: Preserve layout presentation
prr
parents: 31692
diff changeset
   306
        if ((lastGlyph - 2 > lastGlyph) ||
78f5508cde89 8132042: Preserve layout presentation
prr
parents: 31692
diff changeset
   307
            (lastGlyph - firstGlyph < 2)) {
78f5508cde89 8132042: Preserve layout presentation
prr
parents: 31692
diff changeset
   308
            success = LE_INDEX_OUT_OF_BOUNDS_ERROR;
78f5508cde89 8132042: Preserve layout presentation
prr
parents: 31692
diff changeset
   309
            break;
78f5508cde89 8132042: Preserve layout presentation
prr
parents: 31692
diff changeset
   310
        }
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   311
        a = glyphStorage[firstGlyph];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   312
        c = glyphStorage[lastGlyph - 1];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   313
        d = glyphStorage[lastGlyph];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   314
        ia = glyphStorage.getCharIndex(firstGlyph, success);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   315
        ic = glyphStorage.getCharIndex(lastGlyph - 1, success);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   316
        id = glyphStorage.getCharIndex(lastGlyph, success);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   317
        x = lastGlyph - 2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   318
90ce3da70b43 Initial load
duke
parents:
diff changeset
   319
        while (x > firstGlyph) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   320
            glyphStorage[x + 1] = glyphStorage[x];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   321
            ix = glyphStorage.getCharIndex(x, success);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   322
            glyphStorage.setCharIndex(x + 1, ix, success);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   323
            x -= 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   324
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   325
90ce3da70b43 Initial load
duke
parents:
diff changeset
   326
        glyphStorage[firstGlyph] = d;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   327
        glyphStorage[firstGlyph + 1] = c;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   328
        glyphStorage[lastGlyph] = a;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   329
90ce3da70b43 Initial load
duke
parents:
diff changeset
   330
        glyphStorage.setCharIndex(firstGlyph, id, success);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   331
        glyphStorage.setCharIndex(firstGlyph + 1, ic, success);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   332
        glyphStorage.setCharIndex(lastGlyph, ia, success);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   333
        break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   334
90ce3da70b43 Initial load
duke
parents:
diff changeset
   335
    case irvDxAB:
33299
78f5508cde89 8132042: Preserve layout presentation
prr
parents: 31692
diff changeset
   336
        if ((firstGlyph + 2 < firstGlyph) ||
78f5508cde89 8132042: Preserve layout presentation
prr
parents: 31692
diff changeset
   337
            (lastGlyph - firstGlyph < 2)) {
78f5508cde89 8132042: Preserve layout presentation
prr
parents: 31692
diff changeset
   338
            success = LE_INDEX_OUT_OF_BOUNDS_ERROR;
78f5508cde89 8132042: Preserve layout presentation
prr
parents: 31692
diff changeset
   339
            break;
78f5508cde89 8132042: Preserve layout presentation
prr
parents: 31692
diff changeset
   340
        }
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   341
        a = glyphStorage[firstGlyph];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   342
        b = glyphStorage[firstGlyph + 1];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   343
        d = glyphStorage[lastGlyph];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   344
        ia = glyphStorage.getCharIndex(firstGlyph, success);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   345
        ib = glyphStorage.getCharIndex(firstGlyph + 1, success);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   346
        id = glyphStorage.getCharIndex(lastGlyph, success);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   347
        x = firstGlyph + 2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   348
90ce3da70b43 Initial load
duke
parents:
diff changeset
   349
        while (x < lastGlyph) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   350
            glyphStorage[x - 2] = glyphStorage[x];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   351
            ix = glyphStorage.getCharIndex(x, success);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   352
            glyphStorage.setCharIndex(x - 2, ix, success);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   353
            x += 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   354
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   355
90ce3da70b43 Initial load
duke
parents:
diff changeset
   356
        glyphStorage[firstGlyph] = d;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   357
        glyphStorage[lastGlyph - 1] = a;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   358
        glyphStorage[lastGlyph] = b;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   359
90ce3da70b43 Initial load
duke
parents:
diff changeset
   360
        glyphStorage.setCharIndex(firstGlyph, id, success);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   361
        glyphStorage.setCharIndex(lastGlyph - 1, ia, success);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   362
        glyphStorage.setCharIndex(lastGlyph, ib, success);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   363
        break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   364
90ce3da70b43 Initial load
duke
parents:
diff changeset
   365
    case irvDxBA:
33299
78f5508cde89 8132042: Preserve layout presentation
prr
parents: 31692
diff changeset
   366
        if ((firstGlyph + 2 < firstGlyph) ||
78f5508cde89 8132042: Preserve layout presentation
prr
parents: 31692
diff changeset
   367
            (lastGlyph - firstGlyph < 2)) {
78f5508cde89 8132042: Preserve layout presentation
prr
parents: 31692
diff changeset
   368
            success = LE_INDEX_OUT_OF_BOUNDS_ERROR;
78f5508cde89 8132042: Preserve layout presentation
prr
parents: 31692
diff changeset
   369
            break;
78f5508cde89 8132042: Preserve layout presentation
prr
parents: 31692
diff changeset
   370
        }
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   371
        a = glyphStorage[firstGlyph];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   372
        b = glyphStorage[firstGlyph + 1];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   373
        d = glyphStorage[lastGlyph];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   374
        ia = glyphStorage.getCharIndex(firstGlyph, success);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   375
        ib = glyphStorage.getCharIndex(firstGlyph + 1, success);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   376
        id = glyphStorage.getCharIndex(lastGlyph, success);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   377
        x = firstGlyph + 2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   378
90ce3da70b43 Initial load
duke
parents:
diff changeset
   379
        while (x < lastGlyph) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   380
            glyphStorage[x - 2] = glyphStorage[x];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   381
            ix = glyphStorage.getCharIndex(x, success);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   382
            glyphStorage.setCharIndex(x - 2, ix, success);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   383
            x += 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   384
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   385
90ce3da70b43 Initial load
duke
parents:
diff changeset
   386
        glyphStorage[firstGlyph] = d;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   387
        glyphStorage[lastGlyph - 1] = b;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   388
        glyphStorage[lastGlyph] = a;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   389
90ce3da70b43 Initial load
duke
parents:
diff changeset
   390
        glyphStorage.setCharIndex(firstGlyph, id, success);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   391
        glyphStorage.setCharIndex(lastGlyph - 1, ib, success);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   392
        glyphStorage.setCharIndex(lastGlyph, ia, success);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   393
        break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   394
90ce3da70b43 Initial load
duke
parents:
diff changeset
   395
    case irvCDxAB:
33299
78f5508cde89 8132042: Preserve layout presentation
prr
parents: 31692
diff changeset
   396
        if (lastGlyph - firstGlyph < 3) {
78f5508cde89 8132042: Preserve layout presentation
prr
parents: 31692
diff changeset
   397
            success = LE_INDEX_OUT_OF_BOUNDS_ERROR;
78f5508cde89 8132042: Preserve layout presentation
prr
parents: 31692
diff changeset
   398
            break;
78f5508cde89 8132042: Preserve layout presentation
prr
parents: 31692
diff changeset
   399
        }
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   400
        a = glyphStorage[firstGlyph];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   401
        b = glyphStorage[firstGlyph + 1];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   402
90ce3da70b43 Initial load
duke
parents:
diff changeset
   403
        glyphStorage[firstGlyph] = glyphStorage[lastGlyph - 1];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   404
        glyphStorage[firstGlyph + 1] = glyphStorage[lastGlyph];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   405
90ce3da70b43 Initial load
duke
parents:
diff changeset
   406
        glyphStorage[lastGlyph - 1] = a;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   407
        glyphStorage[lastGlyph] = b;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   408
90ce3da70b43 Initial load
duke
parents:
diff changeset
   409
        ia = glyphStorage.getCharIndex(firstGlyph, success);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   410
        ib = glyphStorage.getCharIndex(firstGlyph + 1, success);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   411
        ic = glyphStorage.getCharIndex(lastGlyph - 1, success);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   412
        id = glyphStorage.getCharIndex(lastGlyph, success);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   413
90ce3da70b43 Initial load
duke
parents:
diff changeset
   414
        glyphStorage.setCharIndex(firstGlyph, ic, success);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   415
        glyphStorage.setCharIndex(firstGlyph + 1, id, success);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   416
90ce3da70b43 Initial load
duke
parents:
diff changeset
   417
        glyphStorage.setCharIndex(lastGlyph - 1, ia, success);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   418
        glyphStorage.setCharIndex(lastGlyph, ib, success);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   419
        break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   420
90ce3da70b43 Initial load
duke
parents:
diff changeset
   421
    case irvCDxBA:
33299
78f5508cde89 8132042: Preserve layout presentation
prr
parents: 31692
diff changeset
   422
        if (lastGlyph - firstGlyph < 3) {
78f5508cde89 8132042: Preserve layout presentation
prr
parents: 31692
diff changeset
   423
            success = LE_INDEX_OUT_OF_BOUNDS_ERROR;
78f5508cde89 8132042: Preserve layout presentation
prr
parents: 31692
diff changeset
   424
            break;
78f5508cde89 8132042: Preserve layout presentation
prr
parents: 31692
diff changeset
   425
        }
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   426
        a = glyphStorage[firstGlyph];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   427
        b = glyphStorage[firstGlyph + 1];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   428
90ce3da70b43 Initial load
duke
parents:
diff changeset
   429
        glyphStorage[firstGlyph] = glyphStorage[lastGlyph - 1];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   430
        glyphStorage[firstGlyph + 1] = glyphStorage[lastGlyph];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   431
90ce3da70b43 Initial load
duke
parents:
diff changeset
   432
        glyphStorage[lastGlyph - 1] = b;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   433
        glyphStorage[lastGlyph] = a;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   434
90ce3da70b43 Initial load
duke
parents:
diff changeset
   435
        ia = glyphStorage.getCharIndex(firstGlyph, success);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   436
        ib = glyphStorage.getCharIndex(firstGlyph + 1, success);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   437
        ic = glyphStorage.getCharIndex(lastGlyph - 1, success);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   438
        id = glyphStorage.getCharIndex(lastGlyph, success);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   439
90ce3da70b43 Initial load
duke
parents:
diff changeset
   440
        glyphStorage.setCharIndex(firstGlyph, ic, success);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   441
        glyphStorage.setCharIndex(firstGlyph + 1, id, success);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   442
90ce3da70b43 Initial load
duke
parents:
diff changeset
   443
        glyphStorage.setCharIndex(lastGlyph - 1, ib, success);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   444
        glyphStorage.setCharIndex(lastGlyph, ia, success);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   445
        break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   446
90ce3da70b43 Initial load
duke
parents:
diff changeset
   447
    case irvDCxAB:
33299
78f5508cde89 8132042: Preserve layout presentation
prr
parents: 31692
diff changeset
   448
        if (lastGlyph - firstGlyph < 3) {
78f5508cde89 8132042: Preserve layout presentation
prr
parents: 31692
diff changeset
   449
            success = LE_INDEX_OUT_OF_BOUNDS_ERROR;
78f5508cde89 8132042: Preserve layout presentation
prr
parents: 31692
diff changeset
   450
            break;
78f5508cde89 8132042: Preserve layout presentation
prr
parents: 31692
diff changeset
   451
        }
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   452
        a = glyphStorage[firstGlyph];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   453
        b = glyphStorage[firstGlyph + 1];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   454
90ce3da70b43 Initial load
duke
parents:
diff changeset
   455
        glyphStorage[firstGlyph] = glyphStorage[lastGlyph];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   456
        glyphStorage[firstGlyph + 1] = glyphStorage[lastGlyph - 1];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   457
90ce3da70b43 Initial load
duke
parents:
diff changeset
   458
        glyphStorage[lastGlyph - 1] = a;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   459
        glyphStorage[lastGlyph] = b;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   460
90ce3da70b43 Initial load
duke
parents:
diff changeset
   461
        ia = glyphStorage.getCharIndex(firstGlyph, success);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   462
        ib = glyphStorage.getCharIndex(firstGlyph + 1, success);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   463
        ic = glyphStorage.getCharIndex(lastGlyph - 1, success);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   464
        id = glyphStorage.getCharIndex(lastGlyph, success);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   465
90ce3da70b43 Initial load
duke
parents:
diff changeset
   466
        glyphStorage.setCharIndex(firstGlyph, id, success);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   467
        glyphStorage.setCharIndex(firstGlyph + 1, ic, success);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   468
90ce3da70b43 Initial load
duke
parents:
diff changeset
   469
        glyphStorage.setCharIndex(lastGlyph - 1, ia, success);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   470
        glyphStorage.setCharIndex(lastGlyph, ib, success);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   471
        break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   472
90ce3da70b43 Initial load
duke
parents:
diff changeset
   473
    case irvDCxBA:
33299
78f5508cde89 8132042: Preserve layout presentation
prr
parents: 31692
diff changeset
   474
        if (lastGlyph - firstGlyph < 3) {
78f5508cde89 8132042: Preserve layout presentation
prr
parents: 31692
diff changeset
   475
            success = LE_INDEX_OUT_OF_BOUNDS_ERROR;
78f5508cde89 8132042: Preserve layout presentation
prr
parents: 31692
diff changeset
   476
            break;
78f5508cde89 8132042: Preserve layout presentation
prr
parents: 31692
diff changeset
   477
        }
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   478
        a = glyphStorage[firstGlyph];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   479
        b = glyphStorage[firstGlyph + 1];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   480
90ce3da70b43 Initial load
duke
parents:
diff changeset
   481
        glyphStorage[firstGlyph] = glyphStorage[lastGlyph];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   482
        glyphStorage[firstGlyph + 1] = glyphStorage[lastGlyph - 1];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   483
90ce3da70b43 Initial load
duke
parents:
diff changeset
   484
        glyphStorage[lastGlyph - 1] = b;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   485
        glyphStorage[lastGlyph] = a;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   486
90ce3da70b43 Initial load
duke
parents:
diff changeset
   487
        ia = glyphStorage.getCharIndex(firstGlyph, success);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   488
        ib = glyphStorage.getCharIndex(firstGlyph + 1, success);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   489
        ic = glyphStorage.getCharIndex(lastGlyph - 1, success);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   490
        id = glyphStorage.getCharIndex(lastGlyph, success);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   491
90ce3da70b43 Initial load
duke
parents:
diff changeset
   492
        glyphStorage.setCharIndex(firstGlyph, id, success);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   493
        glyphStorage.setCharIndex(firstGlyph + 1, ic, success);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   494
90ce3da70b43 Initial load
duke
parents:
diff changeset
   495
        glyphStorage.setCharIndex(lastGlyph - 1, ib, success);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   496
        glyphStorage.setCharIndex(lastGlyph, ia, success);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   497
        break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   498
90ce3da70b43 Initial load
duke
parents:
diff changeset
   499
    default:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   500
        break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   501
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   502
}
3935
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   503
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   504
U_NAMESPACE_END