jdk/src/share/native/sun/font/layout/GlyphIterator.cpp
author srl
Mon, 06 Dec 2010 16:10:01 -0800
changeset 7486 6a36b1ebc620
parent 5506 202f599c92aa
child 16891 91e99bed64ae
permissions -rw-r--r--
6886358: layout code update Reviewed-by: igor, prr
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-2005 - 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 "OpenTypeTables.h"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
#include "GlyphDefinitionTables.h"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
#include "GlyphPositionAdjustments.h"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
#include "GlyphIterator.h"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
#include "LEGlyphStorage.h"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
#include "Lookups.h"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
#include "LESwaps.h"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
3935
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
    41
U_NAMESPACE_BEGIN
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
3935
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
    43
GlyphIterator::GlyphIterator(LEGlyphStorage &theGlyphStorage, GlyphPositionAdjustments *theGlyphPositionAdjustments, le_bool rightToLeft, le_uint16 theLookupFlags,
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
    44
                             FeatureMask theFeatureMask, const GlyphDefinitionTableHeader *theGlyphDefinitionTableHeader)
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
  : direction(1), position(-1), nextLimit(-1), prevLimit(-1),
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
    glyphStorage(theGlyphStorage), glyphPositionAdjustments(theGlyphPositionAdjustments),
7486
6a36b1ebc620 6886358: layout code update
srl
parents: 5506
diff changeset
    47
    srcIndex(-1), destIndex(-1), lookupFlags(theLookupFlags), featureMask(theFeatureMask), glyphGroup(0),
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
    glyphClassDefinitionTable(NULL), markAttachClassDefinitionTable(NULL)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
    le_int32 glyphCount = glyphStorage.getGlyphCount();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
    if (theGlyphDefinitionTableHeader != NULL) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
        glyphClassDefinitionTable = theGlyphDefinitionTableHeader->getGlyphClassDefinitionTable();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
        markAttachClassDefinitionTable = theGlyphDefinitionTableHeader->getMarkAttachClassDefinitionTable();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
    nextLimit = glyphCount;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
    if (rightToLeft) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
        direction = -1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
        position = glyphCount;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
        nextLimit = -1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
        prevLimit = glyphCount;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
GlyphIterator::GlyphIterator(GlyphIterator &that)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
  : glyphStorage(that.glyphStorage)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
    direction    = that.direction;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
    position     = that.position;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
    nextLimit    = that.nextLimit;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
    prevLimit    = that.prevLimit;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
    glyphPositionAdjustments = that.glyphPositionAdjustments;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
    srcIndex = that.srcIndex;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
    destIndex = that.destIndex;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
    lookupFlags = that.lookupFlags;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
    featureMask = that.featureMask;
7486
6a36b1ebc620 6886358: layout code update
srl
parents: 5506
diff changeset
    81
    glyphGroup  = that.glyphGroup;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
    glyphClassDefinitionTable = that.glyphClassDefinitionTable;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
    markAttachClassDefinitionTable = that.markAttachClassDefinitionTable;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
GlyphIterator::GlyphIterator(GlyphIterator &that, FeatureMask newFeatureMask)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
  : glyphStorage(that.glyphStorage)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
    direction    = that.direction;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
    position     = that.position;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
    nextLimit    = that.nextLimit;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
    prevLimit    = that.prevLimit;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
    glyphPositionAdjustments = that.glyphPositionAdjustments;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
    srcIndex = that.srcIndex;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
    destIndex = that.destIndex;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
    lookupFlags = that.lookupFlags;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
    featureMask = newFeatureMask;
7486
6a36b1ebc620 6886358: layout code update
srl
parents: 5506
diff changeset
    99
    glyphGroup  = 0;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
    glyphClassDefinitionTable = that.glyphClassDefinitionTable;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
    markAttachClassDefinitionTable = that.markAttachClassDefinitionTable;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
GlyphIterator::GlyphIterator(GlyphIterator &that, le_uint16 newLookupFlags)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
  : glyphStorage(that.glyphStorage)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
    direction    = that.direction;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
    position     = that.position;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
    nextLimit    = that.nextLimit;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
    prevLimit    = that.prevLimit;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
    glyphPositionAdjustments = that.glyphPositionAdjustments;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
    srcIndex = that.srcIndex;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
    destIndex = that.destIndex;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
    lookupFlags = newLookupFlags;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
    featureMask = that.featureMask;
7486
6a36b1ebc620 6886358: layout code update
srl
parents: 5506
diff changeset
   117
    glyphGroup  = that.glyphGroup;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
    glyphClassDefinitionTable = that.glyphClassDefinitionTable;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
    markAttachClassDefinitionTable = that.markAttachClassDefinitionTable;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
GlyphIterator::~GlyphIterator()
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
    // nothing to do, right?
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
void GlyphIterator::reset(le_uint16 newLookupFlags, FeatureMask newFeatureMask)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
    position     = prevLimit;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
    featureMask  = newFeatureMask;
7486
6a36b1ebc620 6886358: layout code update
srl
parents: 5506
diff changeset
   131
    glyphGroup   = 0;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
    lookupFlags  = newLookupFlags;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
7486
6a36b1ebc620 6886358: layout code update
srl
parents: 5506
diff changeset
   135
LEGlyphID *GlyphIterator::insertGlyphs(le_int32 count, LEErrorCode& success)
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
{
7486
6a36b1ebc620 6886358: layout code update
srl
parents: 5506
diff changeset
   137
    return glyphStorage.insertGlyphs(position, count, success);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
le_int32 GlyphIterator::applyInsertions()
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
    le_int32 newGlyphCount = glyphStorage.applyInsertions();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
    if (direction < 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
        prevLimit = newGlyphCount;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
    } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
        nextLimit = newGlyphCount;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
    return newGlyphCount;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
le_int32 GlyphIterator::getCurrStreamPosition() const
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
    return position;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
le_bool GlyphIterator::isRightToLeft() const
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
    return direction < 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
le_bool GlyphIterator::ignoresMarks() const
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
    return (lookupFlags & lfIgnoreMarks) != 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
le_bool GlyphIterator::baselineIsLogicalEnd() const
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
    return (lookupFlags & lfBaselineIsLogicalEnd) != 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
LEGlyphID GlyphIterator::getCurrGlyphID() const
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
    if (direction < 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
        if (position <= nextLimit || position >= prevLimit) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
            return 0xFFFF;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
    } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
        if (position <= prevLimit || position >= nextLimit) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
            return 0xFFFF;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
    return glyphStorage[position];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
void GlyphIterator::getCursiveEntryPoint(LEPoint &entryPoint) const
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
    if (direction < 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
        if (position <= nextLimit || position >= prevLimit) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
            return;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
    } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
        if (position <= prevLimit || position >= nextLimit) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
            return;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
    glyphPositionAdjustments->getEntryPoint(position, entryPoint);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
void GlyphIterator::getCursiveExitPoint(LEPoint &exitPoint) const
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
    if (direction < 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
        if (position <= nextLimit || position >= prevLimit) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
            return;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
    } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
        if (position <= prevLimit || position >= nextLimit) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
            return;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
    glyphPositionAdjustments->getExitPoint(position, exitPoint);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
void GlyphIterator::setCurrGlyphID(TTGlyphID glyphID)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
    LEGlyphID glyph = glyphStorage[position];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
    glyphStorage[position] = LE_SET_GLYPH(glyph, glyphID);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   223
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   224
90ce3da70b43 Initial load
duke
parents:
diff changeset
   225
void GlyphIterator::setCurrStreamPosition(le_int32 newPosition)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   227
    if (direction < 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   228
        if (newPosition >= prevLimit) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   229
            position = prevLimit;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   230
            return;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   231
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   232
90ce3da70b43 Initial load
duke
parents:
diff changeset
   233
        if (newPosition <= nextLimit) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   234
            position = nextLimit;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   235
            return;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   236
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   237
    } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   238
        if (newPosition <= prevLimit) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   239
            position = prevLimit;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   240
            return;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   241
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   242
90ce3da70b43 Initial load
duke
parents:
diff changeset
   243
        if (newPosition >= nextLimit) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   244
            position = nextLimit;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   245
            return;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   246
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   247
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   248
90ce3da70b43 Initial load
duke
parents:
diff changeset
   249
    position = newPosition - direction;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   250
    next();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   251
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   252
90ce3da70b43 Initial load
duke
parents:
diff changeset
   253
void GlyphIterator::setCurrGlyphBaseOffset(le_int32 baseOffset)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   254
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   255
    if (direction < 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   256
        if (position <= nextLimit || position >= prevLimit) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   257
            return;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   258
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   259
    } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   260
        if (position <= prevLimit || position >= nextLimit) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   261
            return;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   262
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   263
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   264
90ce3da70b43 Initial load
duke
parents:
diff changeset
   265
    glyphPositionAdjustments->setBaseOffset(position, baseOffset);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   266
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   267
3935
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   268
void GlyphIterator::adjustCurrGlyphPositionAdjustment(float xPlacementAdjust, float yPlacementAdjust,
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   269
                                                      float xAdvanceAdjust, float yAdvanceAdjust)
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   270
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   271
    if (direction < 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   272
        if (position <= nextLimit || position >= prevLimit) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   273
            return;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   274
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   275
    } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   276
        if (position <= prevLimit || position >= nextLimit) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   277
            return;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   278
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   279
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   280
90ce3da70b43 Initial load
duke
parents:
diff changeset
   281
    glyphPositionAdjustments->adjustXPlacement(position, xPlacementAdjust);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   282
    glyphPositionAdjustments->adjustYPlacement(position, yPlacementAdjust);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   283
    glyphPositionAdjustments->adjustXAdvance(position, xAdvanceAdjust);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   284
    glyphPositionAdjustments->adjustYAdvance(position, yAdvanceAdjust);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   285
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   286
3935
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   287
void GlyphIterator::setCurrGlyphPositionAdjustment(float xPlacementAdjust, float yPlacementAdjust,
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   288
                                                      float xAdvanceAdjust, float yAdvanceAdjust)
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   289
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   290
    if (direction < 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   291
        if (position <= nextLimit || position >= prevLimit) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   292
            return;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   293
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   294
    } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   295
        if (position <= prevLimit || position >= nextLimit) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   296
            return;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   297
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   298
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   299
90ce3da70b43 Initial load
duke
parents:
diff changeset
   300
    glyphPositionAdjustments->setXPlacement(position, xPlacementAdjust);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   301
    glyphPositionAdjustments->setYPlacement(position, yPlacementAdjust);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   302
    glyphPositionAdjustments->setXAdvance(position, xAdvanceAdjust);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   303
    glyphPositionAdjustments->setYAdvance(position, yAdvanceAdjust);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   304
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   305
7486
6a36b1ebc620 6886358: layout code update
srl
parents: 5506
diff changeset
   306
void GlyphIterator::clearCursiveEntryPoint()
6a36b1ebc620 6886358: layout code update
srl
parents: 5506
diff changeset
   307
{
6a36b1ebc620 6886358: layout code update
srl
parents: 5506
diff changeset
   308
    if (direction < 0) {
6a36b1ebc620 6886358: layout code update
srl
parents: 5506
diff changeset
   309
        if (position <= nextLimit || position >= prevLimit) {
6a36b1ebc620 6886358: layout code update
srl
parents: 5506
diff changeset
   310
            return;
6a36b1ebc620 6886358: layout code update
srl
parents: 5506
diff changeset
   311
        }
6a36b1ebc620 6886358: layout code update
srl
parents: 5506
diff changeset
   312
    } else {
6a36b1ebc620 6886358: layout code update
srl
parents: 5506
diff changeset
   313
        if (position <= prevLimit || position >= nextLimit) {
6a36b1ebc620 6886358: layout code update
srl
parents: 5506
diff changeset
   314
            return;
6a36b1ebc620 6886358: layout code update
srl
parents: 5506
diff changeset
   315
        }
6a36b1ebc620 6886358: layout code update
srl
parents: 5506
diff changeset
   316
    }
6a36b1ebc620 6886358: layout code update
srl
parents: 5506
diff changeset
   317
6a36b1ebc620 6886358: layout code update
srl
parents: 5506
diff changeset
   318
    glyphPositionAdjustments->clearEntryPoint(position);
6a36b1ebc620 6886358: layout code update
srl
parents: 5506
diff changeset
   319
}
6a36b1ebc620 6886358: layout code update
srl
parents: 5506
diff changeset
   320
6a36b1ebc620 6886358: layout code update
srl
parents: 5506
diff changeset
   321
void GlyphIterator::clearCursiveExitPoint()
6a36b1ebc620 6886358: layout code update
srl
parents: 5506
diff changeset
   322
{
6a36b1ebc620 6886358: layout code update
srl
parents: 5506
diff changeset
   323
    if (direction < 0) {
6a36b1ebc620 6886358: layout code update
srl
parents: 5506
diff changeset
   324
        if (position <= nextLimit || position >= prevLimit) {
6a36b1ebc620 6886358: layout code update
srl
parents: 5506
diff changeset
   325
            return;
6a36b1ebc620 6886358: layout code update
srl
parents: 5506
diff changeset
   326
        }
6a36b1ebc620 6886358: layout code update
srl
parents: 5506
diff changeset
   327
    } else {
6a36b1ebc620 6886358: layout code update
srl
parents: 5506
diff changeset
   328
        if (position <= prevLimit || position >= nextLimit) {
6a36b1ebc620 6886358: layout code update
srl
parents: 5506
diff changeset
   329
            return;
6a36b1ebc620 6886358: layout code update
srl
parents: 5506
diff changeset
   330
        }
6a36b1ebc620 6886358: layout code update
srl
parents: 5506
diff changeset
   331
    }
6a36b1ebc620 6886358: layout code update
srl
parents: 5506
diff changeset
   332
6a36b1ebc620 6886358: layout code update
srl
parents: 5506
diff changeset
   333
    glyphPositionAdjustments->clearExitPoint(position);
6a36b1ebc620 6886358: layout code update
srl
parents: 5506
diff changeset
   334
}
6a36b1ebc620 6886358: layout code update
srl
parents: 5506
diff changeset
   335
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   336
void GlyphIterator::setCursiveEntryPoint(LEPoint &entryPoint)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   337
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   338
    if (direction < 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   339
        if (position <= nextLimit || position >= prevLimit) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   340
            return;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   341
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   342
    } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   343
        if (position <= prevLimit || position >= nextLimit) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   344
            return;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   345
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   346
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   347
90ce3da70b43 Initial load
duke
parents:
diff changeset
   348
    glyphPositionAdjustments->setEntryPoint(position, entryPoint, baselineIsLogicalEnd());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   349
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   350
90ce3da70b43 Initial load
duke
parents:
diff changeset
   351
void GlyphIterator::setCursiveExitPoint(LEPoint &exitPoint)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   352
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   353
    if (direction < 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   354
        if (position <= nextLimit || position >= prevLimit) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   355
            return;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   356
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   357
    } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   358
        if (position <= prevLimit || position >= nextLimit) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   359
            return;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   360
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   361
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   362
90ce3da70b43 Initial load
duke
parents:
diff changeset
   363
    glyphPositionAdjustments->setExitPoint(position, exitPoint, baselineIsLogicalEnd());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   364
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   365
90ce3da70b43 Initial load
duke
parents:
diff changeset
   366
void GlyphIterator::setCursiveGlyph()
90ce3da70b43 Initial load
duke
parents:
diff changeset
   367
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   368
    if (direction < 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   369
        if (position <= nextLimit || position >= prevLimit) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   370
            return;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   371
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   372
    } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   373
        if (position <= prevLimit || position >= nextLimit) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   374
            return;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   375
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   376
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   377
90ce3da70b43 Initial load
duke
parents:
diff changeset
   378
    glyphPositionAdjustments->setCursiveGlyph(position, baselineIsLogicalEnd());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   379
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   380
90ce3da70b43 Initial load
duke
parents:
diff changeset
   381
le_bool GlyphIterator::filterGlyph(le_uint32 index) const
90ce3da70b43 Initial load
duke
parents:
diff changeset
   382
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   383
    LEGlyphID glyphID = glyphStorage[index];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   384
    le_int32 glyphClass = gcdNoGlyphClass;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   385
90ce3da70b43 Initial load
duke
parents:
diff changeset
   386
    if (LE_GET_GLYPH(glyphID) >= 0xFFFE) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   387
        return TRUE;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   388
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   389
90ce3da70b43 Initial load
duke
parents:
diff changeset
   390
    if (glyphClassDefinitionTable != NULL) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   391
        glyphClass = glyphClassDefinitionTable->getGlyphClass(glyphID);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   392
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   393
90ce3da70b43 Initial load
duke
parents:
diff changeset
   394
    switch (glyphClass)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   395
    {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   396
    case gcdNoGlyphClass:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   397
        return FALSE;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   398
90ce3da70b43 Initial load
duke
parents:
diff changeset
   399
    case gcdSimpleGlyph:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   400
        return (lookupFlags & lfIgnoreBaseGlyphs) != 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   401
90ce3da70b43 Initial load
duke
parents:
diff changeset
   402
    case gcdLigatureGlyph:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   403
        return (lookupFlags & lfIgnoreLigatures) != 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   404
90ce3da70b43 Initial load
duke
parents:
diff changeset
   405
    case gcdMarkGlyph:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   406
    {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   407
        if ((lookupFlags & lfIgnoreMarks) != 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   408
            return TRUE;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   409
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   410
90ce3da70b43 Initial load
duke
parents:
diff changeset
   411
        le_uint16 markAttachType = (lookupFlags & lfMarkAttachTypeMask) >> lfMarkAttachTypeShift;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   412
90ce3da70b43 Initial load
duke
parents:
diff changeset
   413
        if ((markAttachType != 0) && (markAttachClassDefinitionTable != NULL)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   414
            return markAttachClassDefinitionTable->getGlyphClass(glyphID) != markAttachType;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   415
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   416
90ce3da70b43 Initial load
duke
parents:
diff changeset
   417
        return FALSE;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   418
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   419
90ce3da70b43 Initial load
duke
parents:
diff changeset
   420
    case gcdComponentGlyph:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   421
        return (lookupFlags & lfIgnoreBaseGlyphs) != 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   422
90ce3da70b43 Initial load
duke
parents:
diff changeset
   423
    default:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   424
        return FALSE;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   425
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   426
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   427
7486
6a36b1ebc620 6886358: layout code update
srl
parents: 5506
diff changeset
   428
le_bool GlyphIterator::hasFeatureTag(le_bool matchGroup) const
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   429
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   430
    if (featureMask == 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   431
        return TRUE;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   432
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   433
90ce3da70b43 Initial load
duke
parents:
diff changeset
   434
    LEErrorCode success = LE_NO_ERROR;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   435
    FeatureMask fm = glyphStorage.getAuxData(position, success);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   436
7486
6a36b1ebc620 6886358: layout code update
srl
parents: 5506
diff changeset
   437
    return ((fm & featureMask) == featureMask) && (!matchGroup || (le_int32)(fm & LE_GLYPH_GROUP_MASK) == glyphGroup);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   438
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   439
90ce3da70b43 Initial load
duke
parents:
diff changeset
   440
le_bool GlyphIterator::findFeatureTag()
90ce3da70b43 Initial load
duke
parents:
diff changeset
   441
{
7486
6a36b1ebc620 6886358: layout code update
srl
parents: 5506
diff changeset
   442
  //glyphGroup = 0;
6a36b1ebc620 6886358: layout code update
srl
parents: 5506
diff changeset
   443
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   444
    while (nextInternal()) {
7486
6a36b1ebc620 6886358: layout code update
srl
parents: 5506
diff changeset
   445
        if (hasFeatureTag(FALSE)) {
6a36b1ebc620 6886358: layout code update
srl
parents: 5506
diff changeset
   446
            LEErrorCode success = LE_NO_ERROR;
6a36b1ebc620 6886358: layout code update
srl
parents: 5506
diff changeset
   447
6a36b1ebc620 6886358: layout code update
srl
parents: 5506
diff changeset
   448
            glyphGroup = (glyphStorage.getAuxData(position, success) & LE_GLYPH_GROUP_MASK);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   449
            return TRUE;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   450
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   451
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   452
90ce3da70b43 Initial load
duke
parents:
diff changeset
   453
    return FALSE;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   454
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   455
90ce3da70b43 Initial load
duke
parents:
diff changeset
   456
90ce3da70b43 Initial load
duke
parents:
diff changeset
   457
le_bool GlyphIterator::nextInternal(le_uint32 delta)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   458
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   459
    le_int32 newPosition = position;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   460
90ce3da70b43 Initial load
duke
parents:
diff changeset
   461
    while (newPosition != nextLimit && delta > 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   462
        do {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   463
            newPosition += direction;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   464
        } while (newPosition != nextLimit && filterGlyph(newPosition));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   465
90ce3da70b43 Initial load
duke
parents:
diff changeset
   466
        delta -= 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   467
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   468
90ce3da70b43 Initial load
duke
parents:
diff changeset
   469
    position = newPosition;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   470
90ce3da70b43 Initial load
duke
parents:
diff changeset
   471
    return position != nextLimit;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   472
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   473
90ce3da70b43 Initial load
duke
parents:
diff changeset
   474
le_bool GlyphIterator::next(le_uint32 delta)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   475
{
7486
6a36b1ebc620 6886358: layout code update
srl
parents: 5506
diff changeset
   476
    return nextInternal(delta) && hasFeatureTag(TRUE);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   477
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   478
90ce3da70b43 Initial load
duke
parents:
diff changeset
   479
le_bool GlyphIterator::prevInternal(le_uint32 delta)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   480
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   481
    le_int32 newPosition = position;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   482
90ce3da70b43 Initial load
duke
parents:
diff changeset
   483
    while (newPosition != prevLimit && delta > 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   484
        do {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   485
            newPosition -= direction;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   486
        } while (newPosition != prevLimit && filterGlyph(newPosition));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   487
90ce3da70b43 Initial load
duke
parents:
diff changeset
   488
        delta -= 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   489
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   490
90ce3da70b43 Initial load
duke
parents:
diff changeset
   491
    position = newPosition;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   492
90ce3da70b43 Initial load
duke
parents:
diff changeset
   493
    return position != prevLimit;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   494
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   495
90ce3da70b43 Initial load
duke
parents:
diff changeset
   496
le_bool GlyphIterator::prev(le_uint32 delta)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   497
{
7486
6a36b1ebc620 6886358: layout code update
srl
parents: 5506
diff changeset
   498
    return prevInternal(delta) && hasFeatureTag(TRUE);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   499
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   500
90ce3da70b43 Initial load
duke
parents:
diff changeset
   501
le_int32 GlyphIterator::getMarkComponent(le_int32 markPosition) const
90ce3da70b43 Initial load
duke
parents:
diff changeset
   502
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   503
    le_int32 component = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   504
    le_int32 posn;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   505
90ce3da70b43 Initial load
duke
parents:
diff changeset
   506
    for (posn = position; posn != markPosition; posn += direction) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   507
        if (glyphStorage[posn] == 0xFFFE) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   508
            component += 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   509
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   510
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   511
90ce3da70b43 Initial load
duke
parents:
diff changeset
   512
    return component;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   513
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   514
90ce3da70b43 Initial load
duke
parents:
diff changeset
   515
// This is basically prevInternal except that it
90ce3da70b43 Initial load
duke
parents:
diff changeset
   516
// doesn't take a delta argument, and it doesn't
90ce3da70b43 Initial load
duke
parents:
diff changeset
   517
// filter out 0xFFFE glyphs.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   518
le_bool GlyphIterator::findMark2Glyph()
90ce3da70b43 Initial load
duke
parents:
diff changeset
   519
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   520
    le_int32 newPosition = position;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   521
90ce3da70b43 Initial load
duke
parents:
diff changeset
   522
    do {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   523
        newPosition -= direction;
3935
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   524
    } while (newPosition != prevLimit && glyphStorage[newPosition] != 0xFFFE && filterGlyph(newPosition));
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   525
90ce3da70b43 Initial load
duke
parents:
diff changeset
   526
    position = newPosition;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   527
90ce3da70b43 Initial load
duke
parents:
diff changeset
   528
    return position != prevLimit;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   529
}
3935
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   530
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   531
U_NAMESPACE_END