/*
* 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.
*
*/
/*
*
* (C) Copyright IBM Corp. 1998-2005 - All Rights Reserved
*
*/
#include "LETypes.h"
#include "OpenTypeTables.h"
#include "GlyphDefinitionTables.h"
#include "GlyphPositionAdjustments.h"
#include "GlyphIterator.h"
#include "LEGlyphStorage.h"
#include "Lookups.h"
#include "LESwaps.h"
GlyphIterator::GlyphIterator(LEGlyphStorage &theGlyphStorage, GlyphPositionAdjustments *theGlyphPositionAdjustments, le_bool rightToLeft, le_uint16 theLookupFlags,
FeatureMask theFeatureMask, const LEReferenceTo<GlyphDefinitionTableHeader> &theGlyphDefinitionTableHeader)
srcIndex(-1), destIndex(-1), lookupFlags(theLookupFlags), featureMask(theFeatureMask), glyphGroup(0),
{
if (theGlyphDefinitionTableHeader.isValid()) {
}
if (rightToLeft) {
direction = -1;
nextLimit = -1;
}
}
{
}
{
glyphGroup = 0;
}
{
}
{
// nothing to do, right?
}
{
glyphGroup = 0;
}
{
}
{
if (direction < 0) {
} else {
}
return newGlyphCount;
}
{
return position;
}
{
return direction < 0;
}
{
return (lookupFlags & lfIgnoreMarks) != 0;
}
{
return (lookupFlags & lfBaselineIsLogicalEnd) != 0;
}
{
if (direction < 0) {
return 0xFFFF;
}
} else {
return 0xFFFF;
}
}
return glyphStorage[position];
}
{
if (direction < 0) {
return;
}
} else {
return;
}
}
}
{
if (direction < 0) {
return;
}
} else {
return;
}
}
}
{
}
{
if (direction < 0) {
if (newPosition >= prevLimit) {
return;
}
if (newPosition <= nextLimit) {
return;
}
} else {
if (newPosition <= prevLimit) {
return;
}
if (newPosition >= nextLimit) {
return;
}
}
next();
}
{
if (direction < 0) {
return;
}
} else {
return;
}
}
}
void GlyphIterator::adjustCurrGlyphPositionAdjustment(float xPlacementAdjust, float yPlacementAdjust,
float xAdvanceAdjust, float yAdvanceAdjust)
{
if (direction < 0) {
return;
}
} else {
return;
}
}
}
float xAdvanceAdjust, float yAdvanceAdjust)
{
if (direction < 0) {
return;
}
} else {
return;
}
}
}
{
if (direction < 0) {
return;
}
} else {
return;
}
}
}
{
if (direction < 0) {
return;
}
} else {
return;
}
}
}
{
if (direction < 0) {
return;
}
} else {
return;
}
}
}
{
if (direction < 0) {
return;
}
} else {
return;
}
}
}
{
if (direction < 0) {
return;
}
} else {
return;
}
}
}
{
return TRUE;
}
if (glyphClassDefinitionTable.isValid()) {
}
switch (glyphClass)
{
case gcdNoGlyphClass:
return FALSE;
case gcdSimpleGlyph:
return (lookupFlags & lfIgnoreBaseGlyphs) != 0;
case gcdLigatureGlyph:
return (lookupFlags & lfIgnoreLigatures) != 0;
case gcdMarkGlyph:
{
if ((lookupFlags & lfIgnoreMarks) != 0) {
return TRUE;
}
}
return FALSE;
}
case gcdComponentGlyph:
return (lookupFlags & lfIgnoreBaseGlyphs) != 0;
default:
return FALSE;
}
}
{
if (featureMask == 0) {
return TRUE;
}
return ((fm & featureMask) == featureMask) && (!matchGroup || (le_int32)(fm & LE_GLYPH_GROUP_MASK) == glyphGroup);
}
{
//glyphGroup = 0;
while (nextInternal()) {
if (hasFeatureTag(FALSE)) {
return TRUE;
}
}
return FALSE;
}
{
do {
newPosition += direction;
//fprintf(stderr,"%s:%d:%s: newPosition = %d, delta = %d\n", __FILE__, __LINE__, __FUNCTION__, newPosition, delta);
delta -= 1;
}
//fprintf(stderr,"%s:%d:%s: exit position = %d, delta = %d\n", __FILE__, __LINE__, __FUNCTION__, position, delta);
}
{
}
{
do {
newPosition -= direction;
//fprintf(stderr,"%s:%d:%s: newPosition = %d, delta = %d\n", __FILE__, __LINE__, __FUNCTION__, newPosition, delta);
delta -= 1;
}
//fprintf(stderr,"%s:%d:%s: exit position = %d, delta = %d\n", __FILE__, __LINE__, __FUNCTION__, position, delta);
}
{
}
{
component += 1;
}
}
return component;
}
// This is basically prevInternal except that it
// doesn't take a delta argument, and it doesn't
// filter out 0xFFFE glyphs.
{
do {
newPosition -= direction;
} while (newPosition != prevLimit && glyphStorage[newPosition] != 0xFFFE && filterGlyph(newPosition));
}