/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*
*/
/*
**********************************************************************
* Copyright (C) 1998-2009, International Business Machines
* Corporation and others. All Rights Reserved.
**********************************************************************
*/
#include "LETypes.h"
#include "LEInsertionList.h"
#include "LEGlyphStorage.h"
{
// nothing to do...
}
{
// nothing else to do!
}
{
reset();
}
{
fGlyphCount = 0;
if (fPositions != NULL) {
fPositions = NULL;
}
}
if (fInsertionList != NULL) {
delete fInsertionList;
}
if (fCharIndices != NULL) {
fCharIndices = NULL;
}
}
}
// FIXME: This might get called more than once, for various reasons. Is
// testing for pre-existing glyph and charIndices arrays good enough?
void LEGlyphStorage::allocateGlyphArray(le_int32 initialGlyphCount, le_bool rightToLeft, LEErrorCode &success)
{
if (LE_FAILURE(success)) {
return;
}
if (initialGlyphCount <= 0) {
return;
}
return;
}
}
if (fCharIndices == NULL) {
if (fCharIndices == NULL) {
return;
}
// Initialize the charIndices array
if (rightToLeft) {
dir = -1;
}
fCharIndices[out] = i;
}
}
if (fInsertionList == NULL) {
// FIXME: check this for failure?
if (fInsertionList == NULL) {
fCharIndices = NULL;
return;
}
}
}
// FIXME: do we want to initialize the positions to [0, 0]?
{
if (LE_FAILURE(success)) {
return -1;
}
if (fPositions != NULL) {
return -1;
}
if (fPositions == NULL) {
return -1;
}
return fGlyphCount;
}
// FIXME: do we want to initialize the aux data to NULL?
{
if (LE_FAILURE(success)) {
return -1;
}
return -1;
}
return -1;
}
return fGlyphCount;
}
void LEGlyphStorage::getCharIndices(le_int32 charIndices[], le_int32 indexBase, LEErrorCode &success) const
{
le_int32 i;
if (LE_FAILURE(success)) {
return;
}
if (charIndices == NULL) {
return;
}
if (fCharIndices == NULL) {
return;
}
for (i = 0; i < fGlyphCount; i += 1) {
}
}
{
if (LE_FAILURE(success)) {
return;
}
if (charIndices == NULL) {
return;
}
if (fCharIndices == NULL) {
return;
}
}
// Copy the glyphs into caller's (32-bit) glyph array, OR in extraBits
{
le_int32 i;
if (LE_FAILURE(success)) {
return;
}
return;
}
return;
}
for (i = 0; i < fGlyphCount; i += 1) {
}
}
{
if (LE_FAILURE(success)) {
return;
}
return;
}
return;
}
}
{
if (LE_FAILURE(success)) {
return 0xFFFF;
}
return 0xFFFF;
}
return 0xFFFF;
}
return fGlyphs[glyphIndex];
}
{
if (LE_FAILURE(success)) {
return;
}
return;
}
return;
}
}
{
if (LE_FAILURE(success)) {
return -1;
}
if (fCharIndices == NULL) {
return -1;
}
return -1;
}
return fCharIndices[glyphIndex];
}
{
if (LE_FAILURE(success)) {
return;
}
if (fCharIndices == NULL) {
return;
}
return;
}
}
{
if (LE_FAILURE(success)) {
return;
}
return;
}
return;
}
}
{
if (LE_FAILURE(success)) {
return 0;
}
return 0;
}
return 0;
}
return fAuxData[glyphIndex];
}
{
if (LE_FAILURE(success)) {
return;
}
return;
}
return;
}
}
{
if (LE_FAILURE(success)) {
return;
}
return;
}
if (fPositions == NULL) {
return;
}
}
void LEGlyphStorage::getGlyphPosition(le_int32 glyphIndex, float &x, float &y, LEErrorCode &success) const
{
if (LE_FAILURE(success)) {
return;
}
return;
}
if (fPositions == NULL) {
return;
}
}
{
if (LE_FAILURE(success)) {
return;
}
return;
}
}
void LEGlyphStorage::adjustPosition(le_int32 glyphIndex, float xAdjust, float yAdjust, LEErrorCode &success)
{
if (LE_FAILURE(success)) {
return;
}
return;
}
}
{
}
if (fInsertionList != NULL) {
delete fInsertionList;
}
}
{
if (fCharIndices != NULL) {
}
}
{
if (fPositions != NULL) {
}
}
{
}
}
{
}
{
}
// Move a glyph to a different position in the LEGlyphStorage ( used for Indic v2 processing )
{
if ( fromPosition < toPosition ) {
}
} else {
}
}
}
// Glue code for existing stable API
{
}
// FIXME: add error checking?
LEGlyphID *LEGlyphStorage::insertGlyphs(le_int32 atIndex, le_int32 insertCount, LEErrorCode& success)
{
}
{
if (growAmount <= 0) {
return fGlyphCount;
}
// Could not grow the glyph array
return fGlyphCount;
}
if (newCharIndices == NULL) {
// Could not grow the glyph array
return fGlyphCount;
}
if (newAuxData == NULL) {
// could not grow the aux data array
return fGlyphCount;
}
}
if (fGlyphCount > 0) {
}
#if 0
// If the current position is at the end of the array
// update it to point to the end of the new array. The
// insertion callback will handle all other cases.
// FIXME: this is left over from GlyphIterator, but there's no easy
// way to implement this here... it seems that GlyphIterator doesn't
// really need it 'cause the insertions don't get applied until after a
// complete pass over the glyphs, after which the iterator gets reset anyhow...
// probably better to just document that for LEGlyphStorage and GlyphIterator...
if (position == glyphCount) {
}
#endif
fInsertionList->applyInsertions(this);
fInsertionList->reset();
return fGlyphCount = newGlyphCount;
}
{
#if 0
// if the current position is within the block we're shifting
// it needs to be updated to the current glyph's
// new location.
// FIXME: this is left over from GlyphIterator, but there's no easy
// way to implement this here... it seems that GlyphIterator doesn't
// really need it 'cause the insertions don't get applied until after a
// complete pass over the glyphs, after which the iterator gets reset anyhow...
// probably better to just document that for LEGlyphStorage and GlyphIterator...
}
#endif
return FALSE;
}
while (src > atPosition) {
}
}
}
fDestIndex -= 1;
fSrcIndex -= 1;
}
fDestIndex -= 1;
}
// the source glyph we're pointing at
// just got replaced by the insertion
fSrcIndex -= 1;
return FALSE;
}