2362N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 0N/A * This code is free software; you can redistribute it and/or modify it 0N/A * under the terms of the GNU General Public License version 2 only, as 0N/A * published by the Free Software Foundation. Oracle designates this 2362N/A * particular file as subject to the "Classpath" exception as provided 0N/A * by Oracle in the LICENSE file that accompanied this code. 0N/A * This code is distributed in the hope that it will be useful, but WITHOUT 0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 0N/A * version 2 for more details (a copy is included in the LICENSE file that 0N/A * accompanied this code). 0N/A * You should have received a copy of the GNU General Public License version 0N/A * 2 along with this work; if not, write to the Free Software Foundation, 0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 0N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 0N/A ********************************************************************** 0N/A * Copyright (C) 1998-2010, International Business Machines 0N/A * Corporation and others. All Rights Reserved. 0N/A ********************************************************************** 0N/A * \brief C++ API: This class encapsulates the per-glyph storage used by the ICU LayoutEngine. * This class encapsulates the per-glyph storage used by the ICU LayoutEngine. * For each glyph it holds the glyph ID, the index of the backing store character * which produced the glyph, the X and Y position of the glyph and an auxillary data * The storage is growable using the <code>LEInsertionList</code> class. * The number of entries in the per-glyph arrays. * The char indices array. * The glyph positions array. * The auxillary data array. * The insertion list, used to grow the above arrays. * The source index while growing the data arrays. * The destination index used while growing the data arrays. * This implements <code>LEInsertionCallback</code>. The <code>LEInsertionList</code> * will call this method once for each insertion. * @param atPosition the position of the insertion * @param count the number of glyphs being inserted * @param newGlyphs the address of the new glyph IDs * @return <code>true</code> if <code>LEInsertionList</code> should stop * processing the insertion list after this insertion. * Allocates an empty <code>LEGlyphStorage</code> object. You must call * <code>allocateGlyphArray, allocatePositions and allocateAuxData</code> * The destructor. This will deallocate all of the arrays. * This method returns the number of glyphs in the glyph array. * @return the number of glyphs in the glyph array * This method copies the glyph array into a caller supplied array. * The caller must ensure that the array is large enough to hold all * @param glyphs - the destiniation glyph array * @param success - set to an error code if the operation fails * This method copies the glyph array into a caller supplied array, * ORing in extra bits. (This functionality is needed by the JDK, * which uses 32 bits pre glyph idex, with the high 16 bits encoding * the composite font slot number) * @param glyphs - the destination (32 bit) glyph array * @param extraBits - this value will be ORed with each glyph index * @param success - set to an error code if the operation fails * This method copies the character index array into a caller supplied array. * The caller must ensure that the array is large enough to hold a * character index for each glyph. * @param charIndices - the destiniation character index array * @param success - set to an error code if the operation fails * This method copies the character index array into a caller supplied array. * The caller must ensure that the array is large enough to hold a * character index for each glyph. * @param charIndices - the destiniation character index array * @param indexBase - an offset which will be added to each index * @param success - set to an error code if the operation fails * This method copies the position array into a caller supplied array. * The caller must ensure that the array is large enough to hold an * X and Y position for each glyph, plus an extra X and Y for the * advance of the last glyph. * @param positions - the destiniation position array * @param success - set to an error code if the operation fails * This method returns the X and Y position of the glyph at * @param glyphIndex - the index of the glyph * @param x - the glyph's X position * @param y - the glyph's Y position * @param success - set to an error code if the operation fails * This method allocates the glyph array, the char indices array and the insertion list. You * must call this method before using the object. This method also initializes the char indices * @param initialGlyphCount the initial size of the glyph and char indices arrays. * @param rightToLeft <code>true</code> if the original input text is right to left. * @param success set to an error code if the storage cannot be allocated of if the initial * glyph count is not positive. * This method allocates the storage for the glyph positions. It allocates one extra X, Y * position pair for the position just after the last glyph. * @param success set to an error code if the positions array cannot be allocated. * @return the number of X, Y position pairs allocated. * This method allocates the storage for the auxillary glyph data. * @param success set to an error code if the aulillary data array cannot be allocated. * @return the size of the auxillary data array. * Copy the entire auxillary data array. * @param auxData the auxillary data array will be copied to this address * @param success set to an error code if the data cannot be copied * Get the glyph ID for a particular glyph. * @param glyphIndex the index into the glyph array * @param success set to an error code if the glyph ID cannot be retrieved. * Get the char index for a particular glyph. * @param glyphIndex the index into the glyph array * @param success set to an error code if the char index cannot be retrieved. * @return the character index * Get the auxillary data for a particular glyph. * @param glyphIndex the index into the glyph array * @param success set to an error code if the auxillary data cannot be retrieved. * @return the auxillary data * This operator allows direct access to the glyph array * using the index operator. * @param glyphIndex the index into the glyph array * @return a reference to the given location in the glyph array * Call this method to replace a single glyph in the glyph array * with multiple glyphs. This method uses the <code>LEInsertionList</code> * to do the insertion. It returns the address of storage where the new * glyph IDs can be stored. They will not actually be inserted into the * glyph array until <code>applyInsertions</code> is called. * @param atIndex the index of the glyph to be replaced * @param insertCount the number of glyphs to replace it with * @param success set to an error code if the auxillary data cannot be retrieved. * @return the address at which to store the replacement glyphs. * Call this method to replace a single glyph in the glyph array * with multiple glyphs. This method uses the <code>LEInsertionList</code> * to do the insertion. It returns the address of storage where the new * glyph IDs can be stored. They will not actually be inserted into the * glyph array until <code>applyInsertions</code> is called. * Note: Don't use this version, use the other version of this function which has an error code. * @param atIndex the index of the glyph to be replaced * @param insertCount the number of glyphs to replace it with * @return the address at which to store the replacement glyphs. * This method is used to reposition glyphs during Indic v2 processing. It moves * all of the relevant glyph information ( glyph, indices, positions, and auxData ), * from the source position to the target position, and also allows for a marker bit * to be set in the target glyph's auxData so that it won't be reprocessed later in the * @param fromPosition - position of the glyph to be moved * @param toPosition - target position of the glyph * @param marker marker bit * This method causes all of the glyph insertions recorded by * <code>insertGlyphs</code> to be applied to the glyph array. The * new slots in the char indices and the auxillary data arrays * will be filled in with the values for the glyph being replaced. * @return the new size of the glyph array * Set the glyph ID for a particular glyph. * @param glyphIndex the index of the glyph * @param glyphID the new glyph ID * @param success will be set to an error code if the glyph ID cannot be set. * Set the char index for a particular glyph. * @param glyphIndex the index of the glyph * @param charIndex the new char index * @param success will be set to an error code if the char index cannot be set. * Set the X, Y position for a particular glyph. * @param glyphIndex the index of the glyph * @param x the new X position * @param y the new Y position * @param success will be set to an error code if the position cannot be set. * Adjust the X, Y position for a particular glyph. * @param glyphIndex the index of the glyph * @param xAdjust the adjustment to the glyph's X position * @param yAdjust the adjustment to the glyph's Y position * @param success will be set to an error code if the glyph's position cannot be adjusted. * Set the auxillary data for a particular glyph. * @param glyphIndex the index of the glyph * @param auxData the new auxillary data * @param success will be set to an error code if the auxillary data cannot be set. * Delete the glyph array and replace it with the one * in <code>from</code>. Set the glyph array pointer * in <code>from</code> to <code>NULL</code>. * @param from the <code>LEGlyphStorage</code> object from which * to get the new glyph array. * Delete the char indices array and replace it with the one * in <code>from</code>. Set the char indices array pointer * in <code>from</code> to <code>NULL</code>. * @param from the <code>LEGlyphStorage</code> object from which * to get the new char indices array. * Delete the position array and replace it with the one * in <code>from</code>. Set the position array pointer * in <code>from</code> to <code>NULL</code>. * @param from the <code>LEGlyphStorage</code> object from which * to get the new position array. * Delete the auxillary data array and replace it with the one * in <code>from</code>. Set the auxillary data array pointer * in <code>from</code> to <code>NULL</code>. * @param from the <code>LEGlyphStorage</code> object from which * to get the new auxillary data array. * Change the glyph count of this object to be the same * as the one in <code>from</code>. * @param from the <code>LEGlyphStorage</code> object from which * to get the new glyph count. * Change the glyph count of this object to the given value. * @param newGlyphCount the new glyph count. * This method frees the glyph, character index, position and * auxillary data arrays so that the LayoutEngine can be reused * to layout a different characer array. (This method is also called * ICU "poor man's RTTI", returns a UClassID for the actual class. * ICU "poor man's RTTI", returns a UClassID for this class.