jdk/src/share/native/sun/font/layout/LayoutEngine.h
author prr
Fri, 15 Feb 2013 13:07:17 -0800
changeset 16889 3df90f344221
parent 7486 6a36b1ebc620
child 16891 91e99bed64ae
permissions -rw-r--r--
8008249: Sync ICU into JDK Reviewed-by: bae, jgodinez
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
3935
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
    26
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
 *
16889
3df90f344221 8008249: Sync ICU into JDK
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
#ifndef __LAYOUTENGINE_H
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
#define __LAYOUTENGINE_H
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
#include "LETypes.h"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
3935
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
    38
/**
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
    39
 * \file
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
    40
 * \brief C++ API: Virtual base class for complex text layout.
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
    41
 */
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
    42
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
    43
U_NAMESPACE_BEGIN
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
class LEFontInstance;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
class LEGlyphFilter;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
class LEGlyphStorage;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
/**
3935
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
    50
 * This is a virtual base class used to do complex text layout. The text must all
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
    51
 * be in a single font, script, and language. An instance of a LayoutEngine can be
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
    52
 * created by calling the layoutEngineFactory method. Fonts are identified by
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
    53
 * instances of the LEFontInstance class. Script and language codes are identified
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
 * by integer codes, which are defined in ScriptAndLanuageTags.h.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
 *
3935
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
    56
 * Note that this class is not public API. It is declared public so that it can be
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
    57
 * exported from the library that it is a part of.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
 *
3935
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
    59
 * The input to the layout process is an array of characters in logical order,
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
    60
 * and a starting X, Y position for the text. The output is an array of glyph indices,
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
    61
 * an array of character indices for the glyphs, and an array of glyph positions.
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
    62
 * These arrays are protected members of LayoutEngine which can be retreived by a
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
    63
 * public method. The reset method can be called to free these arrays so that the
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
    64
 * LayoutEngine can be reused.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
 *
3935
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
    66
 * The layout process is done in three steps. There is a protected virtual method
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
    67
 * for each step. These methods have a default implementation which only does
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
    68
 * character to glyph mapping and default positioning using the glyph's advance
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
    69
 * widths. Subclasses can override these methods for more advanced layout.
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
    70
 * There is a public method which invokes the steps in the correct order.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
 * The steps are:
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
 *
3935
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
    74
 * 1) Glyph processing - character to glyph mapping and any other glyph processing
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
    75
 *    such as ligature substitution and contextual forms.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
 *
3935
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
    77
 * 2) Glyph positioning - position the glyphs based on their advance widths.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
 *
3935
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
    79
 * 3) Glyph position adjustments - adjustment of glyph positions for kerning,
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
    80
 *    accent placement, etc.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
 *
3935
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
    82
 * NOTE: in all methods below, output parameters are references to pointers so
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
    83
 * the method can allocate and free the storage as needed. All storage allocated
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
    84
 * in this way is owned by the object which created it, and will be freed when it
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
    85
 * is no longer needed, or when the object's destructor is invoked.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
 * @see LEFontInstance
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
 * @see ScriptAndLanguageTags.h
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
 * @stable ICU 2.8
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
 */
3935
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
    92
class U_LAYOUT_API LayoutEngine : public UObject {
16889
3df90f344221 8008249: Sync ICU into JDK
prr
parents: 7486
diff changeset
    93
public:
3df90f344221 8008249: Sync ICU into JDK
prr
parents: 7486
diff changeset
    94
#ifndef U_HIDE_INTERNAL_API
3df90f344221 8008249: Sync ICU into JDK
prr
parents: 7486
diff changeset
    95
    /** @internal Flag to request kerning. Use LE_Kerning_FEATURE_FLAG instead. */
3df90f344221 8008249: Sync ICU into JDK
prr
parents: 7486
diff changeset
    96
    static const le_int32 kTypoFlagKern;
3df90f344221 8008249: Sync ICU into JDK
prr
parents: 7486
diff changeset
    97
    /** @internal Flag to request ligatures. Use LE_Ligatures_FEATURE_FLAG instead. */
3df90f344221 8008249: Sync ICU into JDK
prr
parents: 7486
diff changeset
    98
    static const le_int32 kTypoFlagLiga;
3df90f344221 8008249: Sync ICU into JDK
prr
parents: 7486
diff changeset
    99
#endif  /* U_HIDE_INTERNAL_API */
3df90f344221 8008249: Sync ICU into JDK
prr
parents: 7486
diff changeset
   100
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
protected:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
     * The object which holds the glyph storage
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
     * @internal
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
    LEGlyphStorage *fGlyphStorage;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
     * The font instance for the text font.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
     * @see LEFontInstance
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
     * @internal
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
    const LEFontInstance *fFontInstance;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
     * The script code for the text
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
     * @see ScriptAndLanguageTags.h for script codes.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
     * @internal
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
    le_int32 fScriptCode;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
     * The langauge code for the text
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
     * @see ScriptAndLanguageTags.h for language codes.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
     * @internal
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
    le_int32 fLanguageCode;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
     * The typographic control flags
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
     * @internal
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
    le_int32 fTypoFlags;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
    /**
7486
6a36b1ebc620 6886358: layout code update
srl
parents: 5506
diff changeset
   144
     * <code>TRUE</code> if <code>mapCharsToGlyphs</code> should replace ZWJ / ZWNJ with a glyph
6a36b1ebc620 6886358: layout code update
srl
parents: 5506
diff changeset
   145
     * with no contours.
6a36b1ebc620 6886358: layout code update
srl
parents: 5506
diff changeset
   146
     *
6a36b1ebc620 6886358: layout code update
srl
parents: 5506
diff changeset
   147
     * @internal
6a36b1ebc620 6886358: layout code update
srl
parents: 5506
diff changeset
   148
     */
6a36b1ebc620 6886358: layout code update
srl
parents: 5506
diff changeset
   149
    le_bool fFilterZeroWidth;
6a36b1ebc620 6886358: layout code update
srl
parents: 5506
diff changeset
   150
16889
3df90f344221 8008249: Sync ICU into JDK
prr
parents: 7486
diff changeset
   151
#ifndef U_HIDE_INTERNAL_API
7486
6a36b1ebc620 6886358: layout code update
srl
parents: 5506
diff changeset
   152
    /**
3935
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   153
     * This constructs an instance for a given font, script and language. Subclass constructors
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
     * must call this constructor.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
     * @param fontInstance - the font for the text
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
     * @param scriptCode - the script for the text
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
     * @param languageCode - the language for the text
3935
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   159
     * @param typoFlags - the typographic control flags for the text.  Set bit 1 if kerning
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   160
     * is desired, set bit 2 if ligature formation is desired.  Others are reserved.
7486
6a36b1ebc620 6886358: layout code update
srl
parents: 5506
diff changeset
   161
     * @param success - set to an error code if the operation fails
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
     * @see LEFontInstance
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
     * @see ScriptAndLanguageTags.h
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
     * @internal
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
     */
7486
6a36b1ebc620 6886358: layout code update
srl
parents: 5506
diff changeset
   168
    LayoutEngine(const LEFontInstance *fontInstance,
6a36b1ebc620 6886358: layout code update
srl
parents: 5506
diff changeset
   169
                 le_int32 scriptCode,
6a36b1ebc620 6886358: layout code update
srl
parents: 5506
diff changeset
   170
                 le_int32 languageCode,
6a36b1ebc620 6886358: layout code update
srl
parents: 5506
diff changeset
   171
                 le_int32 typoFlags,
6a36b1ebc620 6886358: layout code update
srl
parents: 5506
diff changeset
   172
                 LEErrorCode &success);
16889
3df90f344221 8008249: Sync ICU into JDK
prr
parents: 7486
diff changeset
   173
#endif  /* U_HIDE_INTERNAL_API */
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
16889
3df90f344221 8008249: Sync ICU into JDK
prr
parents: 7486
diff changeset
   175
    // Do not enclose the protected default constructor with #ifndef U_HIDE_INTERNAL_API
3df90f344221 8008249: Sync ICU into JDK
prr
parents: 7486
diff changeset
   176
    // or else the compiler will create a public default constructor.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
     * This overrides the default no argument constructor to make it
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
     * difficult for clients to call it. Clients are expected to call
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
     * layoutEngineFactory.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
     * @internal
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
    LayoutEngine();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
    /**
3935
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   187
     * This method does any required pre-processing to the input characters. It
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   188
     * may generate output characters that differ from the input charcters due to
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   189
     * insertions, deletions, or reorderings. In such cases, it will also generate an
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   190
     * output character index array reflecting these changes.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
     * Subclasses must override this method.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
     * Input parameters:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
     * @param chars - the input character context
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
     * @param offset - the index of the first character to process
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
     * @param count - the number of characters to process
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
     * @param max - the number of characters in the input context
3935
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   199
     * @param rightToLeft - TRUE if the characters are in a right to left directional run
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   200
     * @param outChars - the output character array, if different from the input
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   201
     * @param glyphStorage - the object that holds the per-glyph storage. The character index array may be set.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
     * @param success - set to an error code if the operation fails
3935
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   203
     *
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   204
     * @return the output character count (input character count if no change)
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
     * @internal
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
     */
3935
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   208
    virtual le_int32 characterProcessing(const LEUnicode chars[], le_int32 offset, le_int32 count, le_int32 max, le_bool rightToLeft,
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   209
            LEUnicode *&outChars, LEGlyphStorage &glyphStorage, LEErrorCode &success);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
    /**
3935
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   212
     * This method does the glyph processing. It converts an array of characters
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   213
     * into an array of glyph indices and character indices. The characters to be
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   214
     * processed are passed in a surrounding context. The context is specified as
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   215
     * a starting address and a maximum character count. An offset and a count are
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   216
     * used to specify the characters to be processed.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
     *
3935
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   218
     * The default implementation of this method only does character to glyph mapping.
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   219
     * Subclasses needing more elaborate glyph processing must override this method.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
     * Input parameters:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
     * @param chars - the character context
90ce3da70b43 Initial load
duke
parents:
diff changeset
   223
     * @param offset - the offset of the first character to process
90ce3da70b43 Initial load
duke
parents:
diff changeset
   224
     * @param count - the number of characters to process
90ce3da70b43 Initial load
duke
parents:
diff changeset
   225
     * @param max - the number of characters in the context.
3935
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   226
     * @param rightToLeft - TRUE if the text is in a right to left directional run
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   227
     * @param glyphStorage - the object which holds the per-glyph storage. The glyph and char indices arrays
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   228
     *                       will be set.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   229
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   230
     * Output parameters:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   231
     * @param success - set to an error code if the operation fails
90ce3da70b43 Initial load
duke
parents:
diff changeset
   232
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   233
     * @return the number of glyphs in the glyph index array
90ce3da70b43 Initial load
duke
parents:
diff changeset
   234
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   235
     * @internal
90ce3da70b43 Initial load
duke
parents:
diff changeset
   236
     */
3935
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   237
    virtual le_int32 computeGlyphs(const LEUnicode chars[], le_int32 offset, le_int32 count, le_int32 max, le_bool rightToLeft, LEGlyphStorage &glyphStorage, LEErrorCode &success);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   238
90ce3da70b43 Initial load
duke
parents:
diff changeset
   239
    /**
3935
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   240
     * This method does basic glyph positioning. The default implementation positions
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   241
     * the glyphs based on their advance widths. This is sufficient for most uses. It
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   242
     * is not expected that many subclasses will override this method.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   243
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   244
     * Input parameters:
3935
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   245
     * @param glyphStorage - the object which holds the per-glyph storage. The glyph position array will be set.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   246
     * @param x - the starting X position
90ce3da70b43 Initial load
duke
parents:
diff changeset
   247
     * @param y - the starting Y position
90ce3da70b43 Initial load
duke
parents:
diff changeset
   248
     * @param success - set to an error code if the operation fails
90ce3da70b43 Initial load
duke
parents:
diff changeset
   249
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   250
     * @internal
90ce3da70b43 Initial load
duke
parents:
diff changeset
   251
     */
3935
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   252
    virtual void positionGlyphs(LEGlyphStorage &glyphStorage, float x, float y, LEErrorCode &success);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   253
90ce3da70b43 Initial load
duke
parents:
diff changeset
   254
    /**
3935
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   255
     * This method does positioning adjustments like accent positioning and
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   256
     * kerning. The default implementation does nothing. Subclasses needing
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   257
     * position adjustments must override this method.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   258
     *
3935
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   259
     * Note that this method has both characters and glyphs as input so that
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   260
     * it can use the character codes to determine glyph types if that information
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   261
     * isn't directly available. (e.g. Some Arabic OpenType fonts don't have a GDEF
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   262
     * table)
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   263
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   264
     * @param chars - the input character context
90ce3da70b43 Initial load
duke
parents:
diff changeset
   265
     * @param offset - the offset of the first character to process
90ce3da70b43 Initial load
duke
parents:
diff changeset
   266
     * @param count - the number of characters to process
3935
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   267
     * @param reverse - <code>TRUE</code> if the glyphs in the glyph array have been reordered
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   268
     * @param glyphStorage - the object which holds the per-glyph storage. The glyph positions will be
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   269
     *                       adjusted as needed.
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   270
     * @param success - output parameter set to an error code if the operation fails
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   271
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   272
     * @internal
90ce3da70b43 Initial load
duke
parents:
diff changeset
   273
     */
3935
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   274
    virtual void adjustGlyphPositions(const LEUnicode chars[], le_int32 offset, le_int32 count, le_bool reverse, LEGlyphStorage &glyphStorage, LEErrorCode &success);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   275
90ce3da70b43 Initial load
duke
parents:
diff changeset
   276
    /**
3935
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   277
     * This method gets a table from the font associated with
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   278
     * the text. The default implementation gets the table from
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   279
     * the font instance. Subclasses which need to get the tables
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   280
     * some other way must override this method.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   281
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   282
     * @param tableTag - the four byte table tag.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   283
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   284
     * @return the address of the table.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   285
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   286
     * @internal
90ce3da70b43 Initial load
duke
parents:
diff changeset
   287
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   288
    virtual const void *getFontTable(LETag tableTag) const;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   289
90ce3da70b43 Initial load
duke
parents:
diff changeset
   290
    /**
3935
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   291
     * This method does character to glyph mapping. The default implementation
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   292
     * uses the font instance to do the mapping. It will allocate the glyph and
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   293
     * character index arrays if they're not already allocated. If it allocates the
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   294
     * character index array, it will fill it it.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   295
     *
3935
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   296
     * This method supports right to left
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   297
     * text with the ability to store the glyphs in reverse order, and by supporting
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   298
     * character mirroring, which will replace a character which has a left and right
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   299
     * form, such as parens, with the opposite form before mapping it to a glyph index.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   300
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   301
     * Input parameters:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   302
     * @param chars - the input character context
90ce3da70b43 Initial load
duke
parents:
diff changeset
   303
     * @param offset - the offset of the first character to be mapped
90ce3da70b43 Initial load
duke
parents:
diff changeset
   304
     * @param count - the number of characters to be mapped
3935
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   305
     * @param reverse - if <code>TRUE</code>, the output will be in reverse order
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   306
     * @param mirror - if <code>TRUE</code>, do character mirroring
3935
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   307
     * @param glyphStorage - the object which holds the per-glyph storage. The glyph and char
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   308
     *                       indices arrays will be filled in.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   309
     * @param success - set to an error code if the operation fails
90ce3da70b43 Initial load
duke
parents:
diff changeset
   310
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   311
     * @see LEFontInstance
90ce3da70b43 Initial load
duke
parents:
diff changeset
   312
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   313
     * @internal
90ce3da70b43 Initial load
duke
parents:
diff changeset
   314
     */
3935
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   315
    virtual void 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
   316
16889
3df90f344221 8008249: Sync ICU into JDK
prr
parents: 7486
diff changeset
   317
#ifndef U_HIDE_INTERNAL_API
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   318
    /**
3935
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   319
     * This is a convenience method that forces the advance width of mark
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   320
     * glyphs to be zero, which is required for proper selection and highlighting.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   321
     *
3935
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   322
     * @param glyphStorage - the object containing the per-glyph storage. The positions array will be modified.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   323
     * @param markFilter - used to identify mark glyphs
3935
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   324
     * @param success - output parameter set to an error code if the operation fails
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   325
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   326
     * @see LEGlyphFilter
90ce3da70b43 Initial load
duke
parents:
diff changeset
   327
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   328
     * @internal
90ce3da70b43 Initial load
duke
parents:
diff changeset
   329
     */
3935
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   330
    static void adjustMarkGlyphs(LEGlyphStorage &glyphStorage, LEGlyphFilter *markFilter, LEErrorCode &success);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   331
90ce3da70b43 Initial load
duke
parents:
diff changeset
   332
90ce3da70b43 Initial load
duke
parents:
diff changeset
   333
    /**
3935
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   334
     * This is a convenience method that forces the advance width of mark
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   335
     * glyphs to be zero, which is required for proper selection and highlighting.
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   336
     * This method uses the input characters to identify marks. This is required in
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   337
     * cases where the font does not contain enough information to identify them based
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   338
     * on the glyph IDs.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   339
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   340
     * @param chars - the array of input characters
90ce3da70b43 Initial load
duke
parents:
diff changeset
   341
     * @param charCount - the number of input characers
3935
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   342
     * @param glyphStorage - the object containing the per-glyph storage. The positions array will be modified.
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   343
     * @param reverse - <code>TRUE</code> if the glyph array has been reordered
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   344
     * @param markFilter - used to identify mark glyphs
3935
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   345
     * @param success - output parameter set to an error code if the operation fails
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   346
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   347
     * @see LEGlyphFilter
90ce3da70b43 Initial load
duke
parents:
diff changeset
   348
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   349
     * @internal
90ce3da70b43 Initial load
duke
parents:
diff changeset
   350
     */
3935
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   351
    static void adjustMarkGlyphs(const LEUnicode chars[], le_int32 charCount, le_bool reverse, LEGlyphStorage &glyphStorage, LEGlyphFilter *markFilter, LEErrorCode &success);
16889
3df90f344221 8008249: Sync ICU into JDK
prr
parents: 7486
diff changeset
   352
#endif  /* U_HIDE_INTERNAL_API */
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   353
90ce3da70b43 Initial load
duke
parents:
diff changeset
   354
public:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   355
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   356
     * The destructor. It will free any storage allocated for the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   357
     * glyph, character index and position arrays by calling the reset
3935
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   358
     * method. It is declared virtual so that it will be invoked by the
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   359
     * subclass destructors.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   360
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   361
     * @stable ICU 2.8
90ce3da70b43 Initial load
duke
parents:
diff changeset
   362
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   363
    virtual ~LayoutEngine();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   364
90ce3da70b43 Initial load
duke
parents:
diff changeset
   365
    /**
3935
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   366
     * This method will invoke the layout steps in their correct order by calling
7486
6a36b1ebc620 6886358: layout code update
srl
parents: 5506
diff changeset
   367
     * the computeGlyphs, positionGlyphs and adjustGlyphPosition methods. It will
3935
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   368
     * compute the glyph, character index and position arrays.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   369
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   370
     * @param chars - the input character context
90ce3da70b43 Initial load
duke
parents:
diff changeset
   371
     * @param offset - the offset of the first character to process
90ce3da70b43 Initial load
duke
parents:
diff changeset
   372
     * @param count - the number of characters to process
90ce3da70b43 Initial load
duke
parents:
diff changeset
   373
     * @param max - the number of characters in the input context
3935
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   374
     * @param rightToLeft - TRUE if the characers are in a right to left directional run
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   375
     * @param x - the initial X position
90ce3da70b43 Initial load
duke
parents:
diff changeset
   376
     * @param y - the initial Y position
3935
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   377
     * @param success - output parameter set to an error code if the operation fails
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   378
     *
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   379
     * @return the number of glyphs in the glyph array
90ce3da70b43 Initial load
duke
parents:
diff changeset
   380
     *
7486
6a36b1ebc620 6886358: layout code update
srl
parents: 5506
diff changeset
   381
     * Note: The glyph, character index and position array can be accessed
6a36b1ebc620 6886358: layout code update
srl
parents: 5506
diff changeset
   382
     * using the getter methods below.
6a36b1ebc620 6886358: layout code update
srl
parents: 5506
diff changeset
   383
     *
6a36b1ebc620 6886358: layout code update
srl
parents: 5506
diff changeset
   384
     * Note: If you call this method more than once, you must call the reset()
6a36b1ebc620 6886358: layout code update
srl
parents: 5506
diff changeset
   385
     * method first to free the glyph, character index and position arrays
6a36b1ebc620 6886358: layout code update
srl
parents: 5506
diff changeset
   386
     * allocated by the previous call.
3935
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   387
     *
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   388
     * @stable ICU 2.8
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   389
     */
3935
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   390
    virtual le_int32 layoutChars(const LEUnicode chars[], le_int32 offset, le_int32 count, le_int32 max, le_bool rightToLeft, float x, float y, LEErrorCode &success);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   391
90ce3da70b43 Initial load
duke
parents:
diff changeset
   392
    /**
3935
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   393
     * This method returns the number of glyphs in the glyph array. Note
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   394
     * that the number of glyphs will be greater than or equal to the number
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   395
     * of characters used to create the LayoutEngine.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   396
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   397
     * @return the number of glyphs in the glyph array
90ce3da70b43 Initial load
duke
parents:
diff changeset
   398
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   399
     * @stable ICU 2.8
90ce3da70b43 Initial load
duke
parents:
diff changeset
   400
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   401
    le_int32 getGlyphCount() const;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   402
90ce3da70b43 Initial load
duke
parents:
diff changeset
   403
    /**
3935
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   404
     * This method copies the glyph array into a caller supplied array.
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   405
     * The caller must ensure that the array is large enough to hold all
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   406
     * the glyphs.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   407
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   408
     * @param glyphs - the destiniation glyph array
90ce3da70b43 Initial load
duke
parents:
diff changeset
   409
     * @param success - set to an error code if the operation fails
90ce3da70b43 Initial load
duke
parents:
diff changeset
   410
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   411
     * @stable ICU 2.8
90ce3da70b43 Initial load
duke
parents:
diff changeset
   412
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   413
    void getGlyphs(LEGlyphID glyphs[], LEErrorCode &success) const;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   414
90ce3da70b43 Initial load
duke
parents:
diff changeset
   415
    /**
3935
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   416
     * This method copies the glyph array into a caller supplied array,
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   417
     * ORing in extra bits. (This functionality is needed by the JDK,
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   418
     * which uses 32 bits pre glyph idex, with the high 16 bits encoding
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   419
     * the composite font slot number)
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   420
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   421
     * @param glyphs - the destination (32 bit) glyph array
90ce3da70b43 Initial load
duke
parents:
diff changeset
   422
     * @param extraBits - this value will be ORed with each glyph index
90ce3da70b43 Initial load
duke
parents:
diff changeset
   423
     * @param success - set to an error code if the operation fails
90ce3da70b43 Initial load
duke
parents:
diff changeset
   424
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   425
     * @stable ICU 2.8
90ce3da70b43 Initial load
duke
parents:
diff changeset
   426
     */
3935
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   427
    virtual void getGlyphs(le_uint32 glyphs[], le_uint32 extraBits, LEErrorCode &success) const;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   428
90ce3da70b43 Initial load
duke
parents:
diff changeset
   429
    /**
3935
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   430
     * This method copies the character index array into a caller supplied array.
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   431
     * The caller must ensure that the array is large enough to hold a
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   432
     * character index for each glyph.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   433
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   434
     * @param charIndices - the destiniation character index array
90ce3da70b43 Initial load
duke
parents:
diff changeset
   435
     * @param success - set to an error code if the operation fails
90ce3da70b43 Initial load
duke
parents:
diff changeset
   436
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   437
     * @stable ICU 2.8
90ce3da70b43 Initial load
duke
parents:
diff changeset
   438
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   439
    void getCharIndices(le_int32 charIndices[], LEErrorCode &success) const;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   440
90ce3da70b43 Initial load
duke
parents:
diff changeset
   441
    /**
3935
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   442
     * This method copies the character index array into a caller supplied array.
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   443
     * The caller must ensure that the array is large enough to hold a
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   444
     * character index for each glyph.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   445
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   446
     * @param charIndices - the destiniation character index array
90ce3da70b43 Initial load
duke
parents:
diff changeset
   447
     * @param indexBase - an offset which will be added to each index
90ce3da70b43 Initial load
duke
parents:
diff changeset
   448
     * @param success - set to an error code if the operation fails
90ce3da70b43 Initial load
duke
parents:
diff changeset
   449
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   450
     * @stable ICU 2.8
90ce3da70b43 Initial load
duke
parents:
diff changeset
   451
     */
3935
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   452
    void getCharIndices(le_int32 charIndices[], le_int32 indexBase, LEErrorCode &success) const;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   453
90ce3da70b43 Initial load
duke
parents:
diff changeset
   454
    /**
3935
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   455
     * This method copies the position array into a caller supplied array.
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   456
     * The caller must ensure that the array is large enough to hold an
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   457
     * X and Y position for each glyph, plus an extra X and Y for the
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   458
     * advance of the last glyph.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   459
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   460
     * @param positions - the destiniation position array
90ce3da70b43 Initial load
duke
parents:
diff changeset
   461
     * @param success - set to an error code if the operation fails
90ce3da70b43 Initial load
duke
parents:
diff changeset
   462
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   463
     * @stable ICU 2.8
90ce3da70b43 Initial load
duke
parents:
diff changeset
   464
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   465
    void getGlyphPositions(float positions[], LEErrorCode &success) const;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   466
90ce3da70b43 Initial load
duke
parents:
diff changeset
   467
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   468
     * This method returns the X and Y position of the glyph at
90ce3da70b43 Initial load
duke
parents:
diff changeset
   469
     * the given index.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   470
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   471
     * Input parameters:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   472
     * @param glyphIndex - the index of the glyph
90ce3da70b43 Initial load
duke
parents:
diff changeset
   473
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   474
     * Output parameters:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   475
     * @param x - the glyph's X position
90ce3da70b43 Initial load
duke
parents:
diff changeset
   476
     * @param y - the glyph's Y position
90ce3da70b43 Initial load
duke
parents:
diff changeset
   477
     * @param success - set to an error code if the operation fails
90ce3da70b43 Initial load
duke
parents:
diff changeset
   478
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   479
     * @stable ICU 2.8
90ce3da70b43 Initial load
duke
parents:
diff changeset
   480
     */
3935
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   481
    void getGlyphPosition(le_int32 glyphIndex, float &x, float &y, LEErrorCode &success) const;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   482
90ce3da70b43 Initial load
duke
parents:
diff changeset
   483
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   484
     * This method frees the glyph, character index and position arrays
90ce3da70b43 Initial load
duke
parents:
diff changeset
   485
     * so that the LayoutEngine can be reused to layout a different
90ce3da70b43 Initial load
duke
parents:
diff changeset
   486
     * characer array. (This method is also called by the destructor)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   487
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   488
     * @stable ICU 2.8
90ce3da70b43 Initial load
duke
parents:
diff changeset
   489
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   490
    virtual void reset();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   491
90ce3da70b43 Initial load
duke
parents:
diff changeset
   492
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   493
     * This method returns a LayoutEngine capable of laying out text
90ce3da70b43 Initial load
duke
parents:
diff changeset
   494
     * in the given font, script and langauge. Note that the LayoutEngine
90ce3da70b43 Initial load
duke
parents:
diff changeset
   495
     * returned may be a subclass of LayoutEngine.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   496
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   497
     * @param fontInstance - the font of the text
90ce3da70b43 Initial load
duke
parents:
diff changeset
   498
     * @param scriptCode - the script of the text
90ce3da70b43 Initial load
duke
parents:
diff changeset
   499
     * @param languageCode - the language of the text
3935
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   500
     * @param success - output parameter set to an error code if the operation fails
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   501
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   502
     * @return a LayoutEngine which can layout text in the given font.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   503
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   504
     * @see LEFontInstance
90ce3da70b43 Initial load
duke
parents:
diff changeset
   505
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   506
     * @stable ICU 2.8
90ce3da70b43 Initial load
duke
parents:
diff changeset
   507
     */
3935
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   508
    static LayoutEngine *layoutEngineFactory(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode, LEErrorCode &success);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   509
90ce3da70b43 Initial load
duke
parents:
diff changeset
   510
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   511
     * Override of existing call that provides flags to control typography.
7486
6a36b1ebc620 6886358: layout code update
srl
parents: 5506
diff changeset
   512
     * @stable ICU 3.4
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   513
     */
3935
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   514
    static LayoutEngine *layoutEngineFactory(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode, le_int32 typo_flags, LEErrorCode &success);
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   515
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   516
    /**
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   517
     * ICU "poor man's RTTI", returns a UClassID for the actual class.
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   518
     *
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   519
     * @stable ICU 2.8
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   520
     */
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   521
    virtual UClassID getDynamicClassID() const;
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   522
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   523
    /**
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   524
     * ICU "poor man's RTTI", returns a UClassID for this class.
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   525
     *
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   526
     * @stable ICU 2.8
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   527
     */
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   528
    static UClassID getStaticClassID();
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   529
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   530
};
90ce3da70b43 Initial load
duke
parents:
diff changeset
   531
3935
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   532
U_NAMESPACE_END
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   533
#endif
3935
afcdb712a9c5 6501644: sync LayoutEngine *code* structure to match ICU
srl
parents: 2
diff changeset
   534