jdk/src/java.desktop/share/native/libfontmanager/layout/IndicRearrangementProcessor.cpp
author prr
Mon, 09 Mar 2015 16:44:39 -0700
changeset 31692 6f9d9bd603ce
parent 25859 3317bb8137f4
child 33299 78f5508cde89
permissions -rw-r--r--
8071715: Tune font layout engine Reviewed-by: srl, bae, mschoene
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) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
        firstGlyph = currGlyph;
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) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
        lastGlyph = currGlyph;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
    doRearrangementAction(glyphStorage, (IndicRearrangementVerb) (flags & irfVerbMask));
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
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
void IndicRearrangementProcessor::doRearrangementAction(LEGlyphStorage &glyphStorage, IndicRearrangementVerb verb) const
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;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
    LEErrorCode success = LE_NO_ERROR;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
    switch(verb)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
    {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
    case irvNoAction:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
        break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
    case irvxA:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
        a = glyphStorage[firstGlyph];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
        ia = glyphStorage.getCharIndex(firstGlyph, success);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
        x = firstGlyph + 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
        while (x <= lastGlyph) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
            glyphStorage[x - 1] = glyphStorage[x];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
            ix = glyphStorage.getCharIndex(x, success);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
            glyphStorage.setCharIndex(x - 1, ix, success);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
            x += 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
        glyphStorage[lastGlyph] = a;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
        glyphStorage.setCharIndex(lastGlyph, ia, success);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
        break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
    case irvDx:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
        d = glyphStorage[lastGlyph];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
        id = glyphStorage.getCharIndex(lastGlyph, success);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
        x = lastGlyph - 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
        while (x >= firstGlyph) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
            glyphStorage[x + 1] = glyphStorage[x];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
            ix = glyphStorage.getCharIndex(x, success);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
            glyphStorage.setCharIndex(x + 1, ix, success);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
            x -= 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
        glyphStorage[firstGlyph] = d;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
        glyphStorage.setCharIndex(firstGlyph, id, success);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
        break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
    case irvDxA:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
        a = glyphStorage[firstGlyph];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
        ia = glyphStorage.getCharIndex(firstGlyph, success);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
        id = glyphStorage.getCharIndex(lastGlyph,  success);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
        glyphStorage[firstGlyph] = glyphStorage[lastGlyph];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
        glyphStorage[lastGlyph] = a;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
        glyphStorage.setCharIndex(firstGlyph, id, success);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
        glyphStorage.setCharIndex(lastGlyph,  ia, success);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
        break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
    case irvxAB:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
        a = glyphStorage[firstGlyph];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
        b = glyphStorage[firstGlyph + 1];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
        ia = glyphStorage.getCharIndex(firstGlyph, success);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
        ib = glyphStorage.getCharIndex(firstGlyph + 1, success);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
        x = firstGlyph + 2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
        while (x <= lastGlyph) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
            glyphStorage[x - 2] = glyphStorage[x];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
            ix = glyphStorage.getCharIndex(x, success);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
            glyphStorage.setCharIndex(x - 2, ix, success);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
            x += 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
        glyphStorage[lastGlyph - 1] = a;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
        glyphStorage[lastGlyph] = b;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
        glyphStorage.setCharIndex(lastGlyph - 1, ia, success);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
        glyphStorage.setCharIndex(lastGlyph, ib, success);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
        break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
    case irvxBA:
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] = b;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
        glyphStorage[lastGlyph] = a;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
        glyphStorage.setCharIndex(lastGlyph - 1, ib, success);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
        glyphStorage.setCharIndex(lastGlyph, ia, 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 irvCDx:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
        c = glyphStorage[lastGlyph - 1];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
        d = glyphStorage[lastGlyph];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
        ic = glyphStorage.getCharIndex(lastGlyph - 1, success);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
        id = glyphStorage.getCharIndex(lastGlyph, success);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
        x = lastGlyph - 2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
        while (x >= firstGlyph) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
            glyphStorage[x + 2] = glyphStorage[x];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
            ix = glyphStorage.getCharIndex(x, success);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
            glyphStorage.setCharIndex(x + 2, ix, success);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
            x -= 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
        glyphStorage[firstGlyph] = c;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
        glyphStorage[firstGlyph + 1] = d;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
        glyphStorage.setCharIndex(firstGlyph, ic, success);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
        glyphStorage.setCharIndex(firstGlyph + 1, id, success);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
        break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
    case irvDCx:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
        c = glyphStorage[lastGlyph - 1];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
        d = glyphStorage[lastGlyph];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
        ic = glyphStorage.getCharIndex(lastGlyph - 1, success);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
        id = glyphStorage.getCharIndex(lastGlyph, success);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   223
        x = lastGlyph - 2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   224
90ce3da70b43 Initial load
duke
parents:
diff changeset
   225
        while (x >= firstGlyph) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
            glyphStorage[x + 2] = glyphStorage[x];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   227
            ix = glyphStorage.getCharIndex(x, success);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   228
            glyphStorage.setCharIndex(x + 2, ix, success);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   229
            x -= 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   230
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   231
90ce3da70b43 Initial load
duke
parents:
diff changeset
   232
        glyphStorage[firstGlyph] = d;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   233
        glyphStorage[firstGlyph + 1] = c;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   234
90ce3da70b43 Initial load
duke
parents:
diff changeset
   235
        glyphStorage.setCharIndex(firstGlyph, id, success);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   236
        glyphStorage.setCharIndex(firstGlyph + 1, ic, success);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   237
        break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   238
90ce3da70b43 Initial load
duke
parents:
diff changeset
   239
    case irvCDxA:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   240
        a = glyphStorage[firstGlyph];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   241
        c = glyphStorage[lastGlyph - 1];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   242
        d = glyphStorage[lastGlyph];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   243
        ia = glyphStorage.getCharIndex(firstGlyph, success);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   244
        ic = glyphStorage.getCharIndex(lastGlyph - 1, success);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   245
        id = glyphStorage.getCharIndex(lastGlyph, success);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   246
        x = lastGlyph - 2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   247
90ce3da70b43 Initial load
duke
parents:
diff changeset
   248
        while (x > firstGlyph) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   249
            glyphStorage[x + 1] = glyphStorage[x];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   250
            ix = glyphStorage.getCharIndex(x, success);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   251
            glyphStorage.setCharIndex(x + 1, ix, success);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   252
            x -= 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   253
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   254
90ce3da70b43 Initial load
duke
parents:
diff changeset
   255
        glyphStorage[firstGlyph] = c;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   256
        glyphStorage[firstGlyph + 1] = d;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   257
        glyphStorage[lastGlyph] = a;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   258
90ce3da70b43 Initial load
duke
parents:
diff changeset
   259
        glyphStorage.setCharIndex(firstGlyph, ic, success);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   260
        glyphStorage.setCharIndex(firstGlyph + 1, id, success);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   261
        glyphStorage.setCharIndex(lastGlyph, ia, success);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   262
        break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   263
90ce3da70b43 Initial load
duke
parents:
diff changeset
   264
    case irvDCxA:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   265
        a = glyphStorage[firstGlyph];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   266
        c = glyphStorage[lastGlyph - 1];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   267
        d = glyphStorage[lastGlyph];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   268
        ia = glyphStorage.getCharIndex(firstGlyph, success);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   269
        ic = glyphStorage.getCharIndex(lastGlyph - 1, success);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   270
        id = glyphStorage.getCharIndex(lastGlyph, success);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   271
        x = lastGlyph - 2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   272
90ce3da70b43 Initial load
duke
parents:
diff changeset
   273
        while (x > firstGlyph) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   274
            glyphStorage[x + 1] = glyphStorage[x];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   275
            ix = glyphStorage.getCharIndex(x, success);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   276
            glyphStorage.setCharIndex(x + 1, ix, success);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   277
            x -= 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   278
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   279
90ce3da70b43 Initial load
duke
parents:
diff changeset
   280
        glyphStorage[firstGlyph] = d;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   281
        glyphStorage[firstGlyph + 1] = c;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   282
        glyphStorage[lastGlyph] = a;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   283
90ce3da70b43 Initial load
duke
parents:
diff changeset
   284
        glyphStorage.setCharIndex(firstGlyph, id, success);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   285
        glyphStorage.setCharIndex(firstGlyph + 1, ic, success);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   286
        glyphStorage.setCharIndex(lastGlyph, ia, success);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   287
        break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   288
90ce3da70b43 Initial load
duke
parents:
diff changeset
   289
    case irvDxAB:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   290
        a = glyphStorage[firstGlyph];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   291
        b = glyphStorage[firstGlyph + 1];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   292
        d = glyphStorage[lastGlyph];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   293
        ia = glyphStorage.getCharIndex(firstGlyph, success);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   294
        ib = glyphStorage.getCharIndex(firstGlyph + 1, success);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   295
        id = glyphStorage.getCharIndex(lastGlyph, success);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   296
        x = firstGlyph + 2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   297
90ce3da70b43 Initial load
duke
parents:
diff changeset
   298
        while (x < lastGlyph) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   299
            glyphStorage[x - 2] = glyphStorage[x];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   300
            ix = glyphStorage.getCharIndex(x, success);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   301
            glyphStorage.setCharIndex(x - 2, ix, success);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   302
            x += 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   303
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   304
90ce3da70b43 Initial load
duke
parents:
diff changeset
   305
        glyphStorage[firstGlyph] = d;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   306
        glyphStorage[lastGlyph - 1] = a;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   307
        glyphStorage[lastGlyph] = b;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   308
90ce3da70b43 Initial load
duke
parents:
diff changeset
   309
        glyphStorage.setCharIndex(firstGlyph, id, success);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   310
        glyphStorage.setCharIndex(lastGlyph - 1, ia, success);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   311
        glyphStorage.setCharIndex(lastGlyph, ib, success);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   312
        break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   313
90ce3da70b43 Initial load
duke
parents:
diff changeset
   314
    case irvDxBA:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   315
        a = glyphStorage[firstGlyph];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   316
        b = glyphStorage[firstGlyph + 1];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   317
        d = glyphStorage[lastGlyph];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   318
        ia = glyphStorage.getCharIndex(firstGlyph, success);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   319
        ib = glyphStorage.getCharIndex(firstGlyph + 1, success);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   320
        id = glyphStorage.getCharIndex(lastGlyph, success);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   321
        x = firstGlyph + 2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   322
90ce3da70b43 Initial load
duke
parents:
diff changeset
   323
        while (x < lastGlyph) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   324
            glyphStorage[x - 2] = glyphStorage[x];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   325
            ix = glyphStorage.getCharIndex(x, success);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   326
            glyphStorage.setCharIndex(x - 2, ix, success);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   327
            x += 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   328
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   329
90ce3da70b43 Initial load
duke
parents:
diff changeset
   330
        glyphStorage[firstGlyph] = d;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   331
        glyphStorage[lastGlyph - 1] = b;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   332
        glyphStorage[lastGlyph] = a;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   333
90ce3da70b43 Initial load
duke
parents:
diff changeset
   334
        glyphStorage.setCharIndex(firstGlyph, id, success);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   335
        glyphStorage.setCharIndex(lastGlyph - 1, ib, success);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   336
        glyphStorage.setCharIndex(lastGlyph, ia, success);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   337
        break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   338
90ce3da70b43 Initial load
duke
parents:
diff changeset
   339
    case irvCDxAB:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   340
        a = glyphStorage[firstGlyph];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   341
        b = glyphStorage[firstGlyph + 1];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   342
90ce3da70b43 Initial load
duke
parents:
diff changeset
   343
        glyphStorage[firstGlyph] = glyphStorage[lastGlyph - 1];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   344
        glyphStorage[firstGlyph + 1] = glyphStorage[lastGlyph];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   345
90ce3da70b43 Initial load
duke
parents:
diff changeset
   346
        glyphStorage[lastGlyph - 1] = a;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   347
        glyphStorage[lastGlyph] = b;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   348
90ce3da70b43 Initial load
duke
parents:
diff changeset
   349
        ia = glyphStorage.getCharIndex(firstGlyph, success);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   350
        ib = glyphStorage.getCharIndex(firstGlyph + 1, success);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   351
        ic = glyphStorage.getCharIndex(lastGlyph - 1, success);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   352
        id = glyphStorage.getCharIndex(lastGlyph, success);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   353
90ce3da70b43 Initial load
duke
parents:
diff changeset
   354
        glyphStorage.setCharIndex(firstGlyph, ic, success);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   355
        glyphStorage.setCharIndex(firstGlyph + 1, id, success);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   356
90ce3da70b43 Initial load
duke
parents:
diff changeset
   357
        glyphStorage.setCharIndex(lastGlyph - 1, ia, success);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   358
        glyphStorage.setCharIndex(lastGlyph, ib, success);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   359
        break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   360
90ce3da70b43 Initial load
duke
parents:
diff changeset
   361
    case irvCDxBA:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   362
        a = glyphStorage[firstGlyph];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   363
        b = glyphStorage[firstGlyph + 1];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   364
90ce3da70b43 Initial load
duke
parents:
diff changeset
   365
        glyphStorage[firstGlyph] = glyphStorage[lastGlyph - 1];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   366
        glyphStorage[firstGlyph + 1] = glyphStorage[lastGlyph];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   367
90ce3da70b43 Initial load
duke
parents:
diff changeset
   368
        glyphStorage[lastGlyph - 1] = b;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   369
        glyphStorage[lastGlyph] = a;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   370
90ce3da70b43 Initial load
duke
parents:
diff changeset
   371
        ia = glyphStorage.getCharIndex(firstGlyph, success);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   372
        ib = glyphStorage.getCharIndex(firstGlyph + 1, success);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   373
        ic = glyphStorage.getCharIndex(lastGlyph - 1, success);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   374
        id = glyphStorage.getCharIndex(lastGlyph, success);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   375
90ce3da70b43 Initial load
duke
parents:
diff changeset
   376
        glyphStorage.setCharIndex(firstGlyph, ic, success);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   377
        glyphStorage.setCharIndex(firstGlyph + 1, id, success);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   378
90ce3da70b43 Initial load
duke
parents:
diff changeset
   379
        glyphStorage.setCharIndex(lastGlyph - 1, ib, success);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   380
        glyphStorage.setCharIndex(lastGlyph, ia, success);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   381
        break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   382
90ce3da70b43 Initial load
duke
parents:
diff changeset
   383
    case irvDCxAB:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   384
        a = glyphStorage[firstGlyph];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   385
        b = glyphStorage[firstGlyph + 1];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   386
90ce3da70b43 Initial load
duke
parents:
diff changeset
   387
        glyphStorage[firstGlyph] = glyphStorage[lastGlyph];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   388
        glyphStorage[firstGlyph + 1] = glyphStorage[lastGlyph - 1];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   389
90ce3da70b43 Initial load
duke
parents:
diff changeset
   390
        glyphStorage[lastGlyph - 1] = a;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   391
        glyphStorage[lastGlyph] = b;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   392
90ce3da70b43 Initial load
duke
parents:
diff changeset
   393
        ia = glyphStorage.getCharIndex(firstGlyph, success);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   394
        ib = glyphStorage.getCharIndex(firstGlyph + 1, success);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   395
        ic = glyphStorage.getCharIndex(lastGlyph - 1, success);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   396
        id = glyphStorage.getCharIndex(lastGlyph, success);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   397
90ce3da70b43 Initial load
duke
parents:
diff changeset
   398
        glyphStorage.setCharIndex(firstGlyph, id, success);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   399
        glyphStorage.setCharIndex(firstGlyph + 1, ic, success);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   400
90ce3da70b43 Initial load
duke
parents:
diff changeset
   401
        glyphStorage.setCharIndex(lastGlyph - 1, ia, success);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   402
        glyphStorage.setCharIndex(lastGlyph, ib, success);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   403
        break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   404
90ce3da70b43 Initial load
duke
parents:
diff changeset
   405
    case irvDCxBA:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   406
        a = glyphStorage[firstGlyph];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   407
        b = glyphStorage[firstGlyph + 1];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   408
90ce3da70b43 Initial load
duke
parents:
diff changeset
   409
        glyphStorage[firstGlyph] = glyphStorage[lastGlyph];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   410
        glyphStorage[firstGlyph + 1] = glyphStorage[lastGlyph - 1];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   411
90ce3da70b43 Initial load
duke
parents:
diff changeset
   412
        glyphStorage[lastGlyph - 1] = b;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   413
        glyphStorage[lastGlyph] = a;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   414
90ce3da70b43 Initial load
duke
parents:
diff changeset
   415
        ia = glyphStorage.getCharIndex(firstGlyph, success);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   416
        ib = glyphStorage.getCharIndex(firstGlyph + 1, success);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   417
        ic = glyphStorage.getCharIndex(lastGlyph - 1, success);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   418
        id = glyphStorage.getCharIndex(lastGlyph, success);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   419
90ce3da70b43 Initial load
duke
parents:
diff changeset
   420
        glyphStorage.setCharIndex(firstGlyph, id, success);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   421
        glyphStorage.setCharIndex(firstGlyph + 1, ic, success);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   422
90ce3da70b43 Initial load
duke
parents:
diff changeset
   423
        glyphStorage.setCharIndex(lastGlyph - 1, ib, success);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   424
        glyphStorage.setCharIndex(lastGlyph, ia, success);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   425
        break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   426
90ce3da70b43 Initial load
duke
parents:
diff changeset
   427
    default:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   428
        break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   429
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   430
}
3935
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   431
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   432
U_NAMESPACE_END