jdk/src/share/native/sun/font/layout/ArabicLayoutEngine.cpp
author prr
Thu, 07 Mar 2013 10:02:20 -0800
changeset 16891 91e99bed64ae
parent 16890 36b30720a997
child 22330 cafb826672bd
permissions -rw-r--r--
8001031: Better font processing Reviewed-by: srl, vadim
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
 *
16890
36b30720a997 8004986: Better handling of glyph table
prr
parents: 7486
diff changeset
    29
 * (C) Copyright IBM Corp. 1998-2013 - All Rights Reserved
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
#include "LETypes.h"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
#include "LEScripts.h"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
#include "LEGlyphFilter.h"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
#include "LEGlyphStorage.h"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
#include "LayoutEngine.h"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
#include "OpenTypeLayoutEngine.h"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
#include "ArabicLayoutEngine.h"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
#include "ScriptAndLanguageTags.h"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
#include "CharSubstitutionFilter.h"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
#include "GlyphSubstitutionTables.h"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
#include "GlyphDefinitionTables.h"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
#include "GlyphPositioningTables.h"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
#include "GDEFMarkFilter.h"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
#include "ArabicShaping.h"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
#include "CanonShaping.h"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
3935
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
    52
U_NAMESPACE_BEGIN
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
    53
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
le_bool CharSubstitutionFilter::accept(LEGlyphID glyph) const
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
    return fFontInstance->canDisplay((LEUnicode) glyph);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
3935
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
    59
UOBJECT_DEFINE_RTTI_IMPLEMENTATION(ArabicOpenTypeLayoutEngine)
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
    60
16891
91e99bed64ae 8001031: Better font processing
prr
parents: 16890
diff changeset
    61
ArabicOpenTypeLayoutEngine::ArabicOpenTypeLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode,
91e99bed64ae 8001031: Better font processing
prr
parents: 16890
diff changeset
    62
                                                       le_int32 languageCode, le_int32 typoFlags,
91e99bed64ae 8001031: Better font processing
prr
parents: 16890
diff changeset
    63
                                                       const LEReferenceTo<GlyphSubstitutionTableHeader> &gsubTable,
91e99bed64ae 8001031: Better font processing
prr
parents: 16890
diff changeset
    64
                                                       LEErrorCode &success)
7486
6a36b1ebc620 6886358: layout code update
srl
parents: 5506
diff changeset
    65
    : OpenTypeLayoutEngine(fontInstance, scriptCode, languageCode, typoFlags, gsubTable, success)
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
    fFeatureMap = ArabicShaping::getFeatureMap(fFeatureMapCount);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
    fFeatureOrder = TRUE;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
16891
91e99bed64ae 8001031: Better font processing
prr
parents: 16890
diff changeset
    71
ArabicOpenTypeLayoutEngine::ArabicOpenTypeLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode,
91e99bed64ae 8001031: Better font processing
prr
parents: 16890
diff changeset
    72
                                                       le_int32 languageCode,
7486
6a36b1ebc620 6886358: layout code update
srl
parents: 5506
diff changeset
    73
                                                       le_int32 typoFlags, LEErrorCode &success)
6a36b1ebc620 6886358: layout code update
srl
parents: 5506
diff changeset
    74
    : OpenTypeLayoutEngine(fontInstance, scriptCode, languageCode, typoFlags, success)
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
    fFeatureMap = ArabicShaping::getFeatureMap(fFeatureMapCount);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
    // NOTE: We don't need to set fFeatureOrder to TRUE here
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
    // because this constructor is only called by the constructor
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
    // for UnicodeArabicOpenTypeLayoutEngine, which uses a pre-built
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
    // GSUB table that has the features in the correct order.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
    //fFeatureOrder = TRUE;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
ArabicOpenTypeLayoutEngine::~ArabicOpenTypeLayoutEngine()
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
    // nothing to do
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
// Input: characters
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
// Output: characters, char indices, tags
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
// Returns: output character count
16891
91e99bed64ae 8001031: Better font processing
prr
parents: 16890
diff changeset
    94
le_int32 ArabicOpenTypeLayoutEngine::characterProcessing(const LEUnicode chars[], le_int32 offset, le_int32 count,
91e99bed64ae 8001031: Better font processing
prr
parents: 16890
diff changeset
    95
                                                         le_int32 max, le_bool rightToLeft, LEUnicode *&outChars,
91e99bed64ae 8001031: Better font processing
prr
parents: 16890
diff changeset
    96
                                                         LEGlyphStorage &glyphStorage, LEErrorCode &success)
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
    if (LE_FAILURE(success)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
        return 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
    if (chars == NULL || offset < 0 || count < 0 || max < 0 || offset >= max || offset + count > max) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
        success = LE_ILLEGAL_ARGUMENT_ERROR;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
        return 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
    outChars = LE_NEW_ARRAY(LEUnicode, count);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
    if (outChars == NULL) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
        success = LE_MEMORY_ALLOCATION_ERROR;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
        return 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
    glyphStorage.allocateGlyphArray(count, rightToLeft, success);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
    glyphStorage.allocateAuxData(success);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
    if (LE_FAILURE(success)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
        LE_DELETE_ARRAY(outChars);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
        return 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
    CanonShaping::reorderMarks(&chars[offset], count, rightToLeft, outChars, glyphStorage);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
    // Note: This processes the *original* character array so we can get context
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
    // for the first and last characters. This is OK because only the marks
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
    // will have been reordered, and they don't contribute to shaping.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
    ArabicShaping::shape(chars, offset, count, max, rightToLeft, glyphStorage);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
    return count;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
3935
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   132
void ArabicOpenTypeLayoutEngine::adjustGlyphPositions(const LEUnicode chars[], le_int32 offset, le_int32 count, le_bool reverse,
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   133
                                                      LEGlyphStorage &glyphStorage, LEErrorCode &success)
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
    if (LE_FAILURE(success)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
        return;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
    if (chars == NULL || offset < 0 || count < 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
        success = LE_ILLEGAL_ARGUMENT_ERROR;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
        return;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
16891
91e99bed64ae 8001031: Better font processing
prr
parents: 16890
diff changeset
   144
    if (!fGPOSTable.isEmpty()) {
3935
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   145
        OpenTypeLayoutEngine::adjustGlyphPositions(chars, offset, count, reverse, glyphStorage, success);
16891
91e99bed64ae 8001031: Better font processing
prr
parents: 16890
diff changeset
   146
    } else if (!fGDEFTable.isEmpty()) {
91e99bed64ae 8001031: Better font processing
prr
parents: 16890
diff changeset
   147
        GDEFMarkFilter filter(fGDEFTable, success);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
        adjustMarkGlyphs(glyphStorage, &filter, success);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
    } else {
16891
91e99bed64ae 8001031: Better font processing
prr
parents: 16890
diff changeset
   150
        LEReferenceTo<GlyphDefinitionTableHeader> gdefTable(CanonShaping::glyphDefinitionTable, CanonShaping::glyphDefinitionTableLen);
91e99bed64ae 8001031: Better font processing
prr
parents: 16890
diff changeset
   151
        GDEFMarkFilter filter(gdefTable, success);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
        adjustMarkGlyphs(&chars[offset], count, reverse, glyphStorage, &filter, success);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
7486
6a36b1ebc620 6886358: layout code update
srl
parents: 5506
diff changeset
   157
UnicodeArabicOpenTypeLayoutEngine::UnicodeArabicOpenTypeLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode, le_int32 typoFlags, LEErrorCode &success)
16891
91e99bed64ae 8001031: Better font processing
prr
parents: 16890
diff changeset
   158
  : ArabicOpenTypeLayoutEngine(fontInstance, scriptCode, languageCode, typoFlags | LE_CHAR_FILTER_FEATURE_FLAG, success)
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
    fGSUBTable = (const GlyphSubstitutionTableHeader *) CanonShaping::glyphSubstitutionTable;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
    fGDEFTable = (const GlyphDefinitionTableHeader *) CanonShaping::glyphDefinitionTable;
16890
36b30720a997 8004986: Better handling of glyph table
prr
parents: 7486
diff changeset
   162
    /* OpenTypeLayoutEngine will allocate a substitution filter */
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
UnicodeArabicOpenTypeLayoutEngine::~UnicodeArabicOpenTypeLayoutEngine()
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
{
16890
36b30720a997 8004986: Better handling of glyph table
prr
parents: 7486
diff changeset
   167
    /* OpenTypeLayoutEngine will cleanup the substitution filter */
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
// "glyphs", "indices" -> glyphs, indices
3935
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   171
le_int32 UnicodeArabicOpenTypeLayoutEngine::glyphPostProcessing(LEGlyphStorage &tempGlyphStorage, LEGlyphStorage &glyphStorage, LEErrorCode &success)
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
    if (LE_FAILURE(success)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
        return 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
    // FIXME: we could avoid the memory allocation and copy if we
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
    // made a clone of mapCharsToGlyphs which took the fake glyphs
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
    // directly.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
    le_int32 tempGlyphCount = tempGlyphStorage.getGlyphCount();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
    LEUnicode *tempChars = LE_NEW_ARRAY(LEUnicode, tempGlyphCount);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
    if (tempChars == NULL) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
        success = LE_MEMORY_ALLOCATION_ERROR;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
        return 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
    for (le_int32 i = 0; i < tempGlyphCount; i += 1) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
        tempChars[i] = (LEUnicode) LE_GET_GLYPH(tempGlyphStorage[i]);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
    glyphStorage.adoptCharIndicesArray(tempGlyphStorage);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
3935
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   194
    ArabicOpenTypeLayoutEngine::mapCharsToGlyphs(tempChars, 0, tempGlyphCount, FALSE, TRUE, glyphStorage, success);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
    LE_DELETE_ARRAY(tempChars);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
    return tempGlyphCount;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
3935
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   201
void UnicodeArabicOpenTypeLayoutEngine::mapCharsToGlyphs(const LEUnicode chars[], le_int32 offset, le_int32 count, le_bool reverse, le_bool /*mirror*/, LEGlyphStorage &glyphStorage, LEErrorCode &success)
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
    if (LE_FAILURE(success)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
        return;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
    if (chars == NULL || offset < 0 || count < 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
        success = LE_ILLEGAL_ARGUMENT_ERROR;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
        return;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
    le_int32 i, dir = 1, out = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
    if (reverse) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
        out = count - 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
        dir = -1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
    glyphStorage.allocateGlyphArray(count, reverse, success);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
    for (i = 0; i < count; i += 1, out += dir) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
        glyphStorage[out] = (LEGlyphID) chars[offset + i];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   223
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   224
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   225
3935
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   226
void UnicodeArabicOpenTypeLayoutEngine::adjustGlyphPositions(const LEUnicode chars[], le_int32 offset, le_int32 count, le_bool reverse,
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   227
                                                      LEGlyphStorage &glyphStorage, LEErrorCode &success)
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   228
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   229
    if (LE_FAILURE(success)) {
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 (chars == NULL || offset < 0 || count < 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   234
        success = LE_ILLEGAL_ARGUMENT_ERROR;
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
16891
91e99bed64ae 8001031: Better font processing
prr
parents: 16890
diff changeset
   238
    GDEFMarkFilter filter(fGDEFTable, success);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   239
90ce3da70b43 Initial load
duke
parents:
diff changeset
   240
    adjustMarkGlyphs(&chars[offset], count, reverse, glyphStorage, &filter, success);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   241
}
3935
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   242
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   243
U_NAMESPACE_END
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   244