0N/A/*
0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
0N/A *
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
2362N/A * published by the Free Software Foundation. Oracle designates this
0N/A * particular file as subject to the "Classpath" exception as provided
2362N/A * by Oracle in the LICENSE file that accompanied this code.
0N/A *
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 *
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 *
2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2362N/A * or visit www.oracle.com if you need additional information or have any
2362N/A * questions.
0N/A *
0N/A */
0N/A
0N/A/*
0N/A * (C) Copyright IBM Corp. 1998 - 2005 - All Rights Reserved
0N/A *
0N/A */
0N/A
0N/A#include "LETypes.h"
0N/A#include "LEFontInstance.h"
0N/A#include "OpenTypeTables.h"
3171N/A#include "ICUFeatures.h"
0N/A#include "Lookups.h"
0N/A#include "ScriptAndLanguage.h"
0N/A#include "GlyphDefinitionTables.h"
0N/A#include "GlyphPositioningTables.h"
0N/A#include "SinglePositioningSubtables.h"
0N/A#include "PairPositioningSubtables.h"
0N/A#include "CursiveAttachmentSubtables.h"
0N/A#include "MarkToBasePosnSubtables.h"
0N/A#include "MarkToLigaturePosnSubtables.h"
0N/A#include "MarkToMarkPosnSubtables.h"
0N/A//#include "ContextualPositioningSubtables.h"
0N/A#include "ContextualSubstSubtables.h"
0N/A#include "ExtensionSubtables.h"
0N/A#include "LookupProcessor.h"
0N/A#include "GlyphPosnLookupProc.h"
0N/A#include "LESwaps.h"
0N/A
1693N/AU_NAMESPACE_BEGIN
1693N/A
0N/A// Aside from the names, the contextual positioning subtables are
0N/A// the same as the contextual substitution subtables.
0N/Atypedef ContextualSubstitutionSubtable ContextualPositioningSubtable;
0N/Atypedef ChainingContextualSubstitutionSubtable ChainingContextualPositioningSubtable;
0N/A
0N/AGlyphPositioningLookupProcessor::GlyphPositioningLookupProcessor(
5980N/A const LEReferenceTo<GlyphPositioningTableHeader> &glyphPositioningTableHeader,
3171N/A LETag scriptTag,
3171N/A LETag languageTag,
3171N/A const FeatureMap *featureMap,
3171N/A le_int32 featureMapCount,
3171N/A le_bool featureOrder,
3171N/A LEErrorCode& success)
0N/A : LookupProcessor(
5980N/A glyphPositioningTableHeader,
0N/A SWAPW(glyphPositioningTableHeader->scriptListOffset),
0N/A SWAPW(glyphPositioningTableHeader->featureListOffset),
0N/A SWAPW(glyphPositioningTableHeader->lookupListOffset),
3171N/A scriptTag,
3171N/A languageTag,
3171N/A featureMap,
3171N/A featureMapCount,
3171N/A featureOrder,
3171N/A success
3171N/A )
0N/A{
0N/A // anything?
0N/A}
0N/A
0N/AGlyphPositioningLookupProcessor::GlyphPositioningLookupProcessor()
0N/A{
0N/A}
0N/A
5980N/Ale_uint32 GlyphPositioningLookupProcessor::applySubtable(const LEReferenceTo<LookupSubtable> &lookupSubtable, le_uint16 lookupType,
0N/A GlyphIterator *glyphIterator,
3171N/A const LEFontInstance *fontInstance,
3171N/A LEErrorCode& success) const
0N/A{
3171N/A if (LE_FAILURE(success)) {
3171N/A return 0;
3171N/A }
3171N/A
0N/A le_uint32 delta = 0;
0N/A
0N/A switch(lookupType)
0N/A {
0N/A case 0:
0N/A break;
0N/A
0N/A case gpstSingle:
0N/A {
5980N/A LEReferenceTo<SinglePositioningSubtable> subtable(lookupSubtable, success);
0N/A
5980N/A delta = subtable->process(subtable, glyphIterator, fontInstance, success);
0N/A break;
0N/A }
0N/A
0N/A case gpstPair:
0N/A {
5980N/A LEReferenceTo<PairPositioningSubtable> subtable(lookupSubtable, success);
0N/A
5980N/A delta = subtable->process(subtable, glyphIterator, fontInstance, success);
0N/A break;
0N/A }
0N/A
0N/A case gpstCursive:
0N/A {
5980N/A LEReferenceTo<CursiveAttachmentSubtable> subtable(lookupSubtable, success);
0N/A
5980N/A delta = subtable->process(subtable, glyphIterator, fontInstance, success);
0N/A break;
0N/A }
0N/A
0N/A case gpstMarkToBase:
0N/A {
5980N/A LEReferenceTo<MarkToBasePositioningSubtable> subtable(lookupSubtable, success);
0N/A
5980N/A delta = subtable->process(subtable, glyphIterator, fontInstance, success);
0N/A break;
0N/A }
0N/A
0N/A case gpstMarkToLigature:
0N/A {
5980N/A LEReferenceTo<MarkToLigaturePositioningSubtable> subtable(lookupSubtable, success);
0N/A
5980N/A delta = subtable->process(subtable, glyphIterator, fontInstance, success);
0N/A break;
0N/A }
0N/A
0N/A case gpstMarkToMark:
0N/A {
5980N/A LEReferenceTo<MarkToMarkPositioningSubtable> subtable(lookupSubtable, success);
0N/A
5980N/A delta = subtable->process(subtable, glyphIterator, fontInstance, success);
0N/A break;
0N/A }
0N/A
0N/A case gpstContext:
0N/A {
5980N/A LEReferenceTo<ContextualPositioningSubtable> subtable(lookupSubtable, success);
0N/A
3171N/A delta = subtable->process(this, glyphIterator, fontInstance, success);
0N/A break;
0N/A }
0N/A
0N/A case gpstChainedContext:
0N/A {
5980N/A LEReferenceTo<ChainingContextualPositioningSubtable> subtable(lookupSubtable, success);
0N/A
3171N/A delta = subtable->process(this, glyphIterator, fontInstance, success);
0N/A break;
0N/A }
0N/A
0N/A case gpstExtension:
0N/A {
5980N/A LEReferenceTo<ExtensionSubtable> subtable(lookupSubtable, success);
0N/A
6371N/A delta = subtable->process(subtable, this, lookupType, glyphIterator, fontInstance, success);
0N/A break;
0N/A }
0N/A
0N/A default:
0N/A break;
0N/A }
0N/A
0N/A return delta;
0N/A}
0N/A
0N/AGlyphPositioningLookupProcessor::~GlyphPositioningLookupProcessor()
0N/A{
0N/A}
1693N/A
1693N/AU_NAMESPACE_END