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/*
0N/A *
0N/A * (C) Copyright IBM Corp. 1998-2005 - All Rights Reserved
0N/A *
0N/A */
0N/A
0N/A#ifndef __ARABICLAYOUTENGINE_H
0N/A#define __ARABICLAYOUTENGINE_H
0N/A
0N/A#include "LETypes.h"
0N/A#include "LEFontInstance.h"
0N/A#include "LEGlyphFilter.h"
0N/A#include "LayoutEngine.h"
0N/A#include "OpenTypeLayoutEngine.h"
0N/A
0N/A#include "GlyphSubstitutionTables.h"
0N/A#include "GlyphDefinitionTables.h"
0N/A#include "GlyphPositioningTables.h"
0N/A
1693N/AU_NAMESPACE_BEGIN
1693N/A
0N/A/**
0N/A * This class implements OpenType layout for Arabic fonts. It overrides
0N/A * the characerProcessing method to assign the correct OpenType feature
0N/A * tags for the Arabic contextual forms. It also overrides the adjustGlyphPositions
0N/A * method to guarantee that all vowel and accent glyphs have zero advance width.
0N/A *
0N/A * @internal
0N/A */
0N/Aclass ArabicOpenTypeLayoutEngine : public OpenTypeLayoutEngine
0N/A{
0N/Apublic:
0N/A /**
0N/A * This is the main constructor. It constructs an instance of ArabicOpenTypeLayoutEngine for
0N/A * a particular font, script and language. It takes the GSUB table as a parameter since
0N/A * LayoutEngine::layoutEngineFactory has to read the GSUB table to know that it has an
0N/A * Indic OpenType font.
0N/A *
0N/A * @param fontInstance - the font
0N/A * @param scriptCode - the script
0N/A * @param langaugeCode - the language
0N/A * @param gsubTable - the GSUB table
3171N/A * @param success - set to an error code if the operation fails
0N/A *
0N/A * @see LayoutEngine::layoutEngineFactory
0N/A * @see OpenTypeLayoutEngine
0N/A * @see ScriptAndLanguageTags.h for script and language codes
0N/A *
0N/A * @internal
0N/A */
1693N/A ArabicOpenTypeLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode,
5980N/A le_int32 typoFlags, const LEReferenceTo<GlyphSubstitutionTableHeader> &gsubTable, LEErrorCode &success);
0N/A
0N/A /**
0N/A * This constructor is used when the font requires a "canned" GSUB table which can't be known
0N/A * until after this constructor has been invoked.
0N/A *
0N/A * @param fontInstance - the font
0N/A * @param scriptCode - the script
0N/A * @param langaugeCode - the language
3171N/A * @param success - set to an error code if the operation fails
0N/A *
0N/A * @see OpenTypeLayoutEngine
0N/A * @see ScriptAndLanguageTags.h for script and language codes
0N/A *
0N/A * @internal
0N/A */
1693N/A ArabicOpenTypeLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode,
3171N/A le_int32 typoFlags, LEErrorCode &success);
0N/A
0N/A /**
0N/A * The destructor, virtual for correct polymorphic invocation.
0N/A *
0N/A * @internal
0N/A */
0N/A virtual ~ArabicOpenTypeLayoutEngine();
0N/A
1693N/A /**
1693N/A * ICU "poor man's RTTI", returns a UClassID for the actual class.
1693N/A *
1693N/A * @stable ICU 2.8
1693N/A */
1693N/A virtual UClassID getDynamicClassID() const;
1693N/A
1693N/A /**
1693N/A * ICU "poor man's RTTI", returns a UClassID for this class.
1693N/A *
1693N/A * @stable ICU 2.8
1693N/A */
1693N/A static UClassID getStaticClassID();
1693N/A
0N/Aprotected:
0N/A
0N/A /**
0N/A * This method does Arabic OpenType character processing. It assigns the OpenType feature
0N/A * tags to the characters to generate the correct contextual forms and ligatures.
0N/A *
0N/A * Input parameters:
0N/A * @param chars - the input character context
0N/A * @param offset - the index of the first character to process
0N/A * @param count - the number of characters to process
0N/A * @param max - the number of characters in the input context
1693N/A * @param rightToLeft - <code>TRUE</code> if the characters are in a right to left directional run
0N/A *
0N/A * Output parameters:
0N/A * @param outChars - the output character arrayt
0N/A * @param charIndices - the output character index array
0N/A * @param featureTags - the output feature tag array
0N/A * @param success - set to an error code if the operation fails
0N/A *
0N/A * @return the output character count
0N/A *
0N/A * @internal
0N/A */
1693N/A virtual le_int32 characterProcessing(const LEUnicode chars[], le_int32 offset, le_int32 count, le_int32 max, le_bool rightToLeft,
1693N/A LEUnicode *&outChars, LEGlyphStorage &glyphStorage, LEErrorCode &success);
0N/A
0N/A /**
0N/A * This method applies the GPOS table if it is present, otherwise it ensures that all vowel
0N/A * and accent glyphs have a zero advance width by calling the adjustMarkGlyphs method.
0N/A * If the font contains a GDEF table, that is used to identify voewls and accents. Otherwise
0N/A * the character codes are used.
0N/A *
0N/A * @param chars - the input character context
0N/A * @param offset - the offset of the first character to process
0N/A * @param count - the number of characters to process
0N/A * @param reverse - <code>TRUE</code> if the glyphs in the glyph array have been reordered
0N/A * @param glyphs - the input glyph array
0N/A * @param glyphCount - the number of glyphs
0N/A * @param positions - the position array, will be updated as needed
0N/A * @param success - output parameter set to an error code if the operation fails
0N/A *
0N/A * @internal
0N/A */
1693N/A virtual void adjustGlyphPositions(const LEUnicode chars[], le_int32 offset, le_int32 count, le_bool reverse, LEGlyphStorage &glyphStorage, LEErrorCode &success);
0N/A
1693N/A // static void adjustMarkGlyphs(const LEUnicode chars[], le_int32 offset, le_int32 count, le_bool rightToLeft, LEGlyphStorage &glyphStorage, LEErrorCode &success);
0N/A
0N/A};
0N/A
0N/A/**
0N/A * The class implements OpenType layout for Arabic fonts which don't
0N/A * contain a GSUB table, using a canned GSUB table based on Unicode
0N/A * Arabic Presentation Forms. It overrides the mapCharsToGlyphs method
0N/A * to use the Presentation Forms as logical glyph indices. It overrides the
0N/A * glyphPostProcessing method to convert the Presentation Forms to actual
0N/A * glyph indices.
0N/A *
0N/A * @see ArabicOpenTypeLayoutEngine
0N/A *
0N/A * @internal
0N/A */
0N/Aclass UnicodeArabicOpenTypeLayoutEngine : public ArabicOpenTypeLayoutEngine
0N/A{
0N/Apublic:
0N/A /**
0N/A * This constructs an instance of UnicodeArabicOpenTypeLayoutEngine for a specific font,
0N/A * script and language.
0N/A *
0N/A * @param fontInstance - the font
0N/A * @param scriptCode - the script
0N/A * @param languageCode - the language
3171N/A * @param success - set to an error code if the operation fails
0N/A *
0N/A * @see LEFontInstance
0N/A * @see ScriptAndLanguageTags.h for script and language codes
0N/A *
0N/A * @internal
0N/A */
1693N/A UnicodeArabicOpenTypeLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode,
3171N/A le_int32 typoFlags, LEErrorCode &success);
0N/A
0N/A /**
0N/A * The destructor, virtual for correct polymorphic invocation.
0N/A *
0N/A * @internal
0N/A */
0N/A virtual ~UnicodeArabicOpenTypeLayoutEngine();
0N/A
0N/Aprotected:
0N/A
0N/A /**
0N/A * This method converts the Arabic Presentation Forms in the temp glyph array
0N/A * into actual glyph indices using ArabicOpenTypeLayoutEngine::mapCharsToGlyps.
0N/A *
0N/A * Input paramters:
0N/A * @param tempGlyphs - the input presentation forms
0N/A * @param tempCharIndices - the input character index array
0N/A * @param tempGlyphCount - the number of Presentation Froms
0N/A *
0N/A * Output parameters:
0N/A * @param glyphs - the output glyph index array
0N/A * @param charIndices - the output character index array
0N/A * @param success - set to an error code if the operation fails
0N/A *
0N/A * @return the number of glyph indices in the output glyph index array
0N/A *
0N/A * @internal
0N/A */
1693N/A virtual le_int32 glyphPostProcessing(LEGlyphStorage &tempGlyphStorage, LEGlyphStorage &glyphStorage, LEErrorCode &success);
0N/A
0N/A /**
0N/A * This method copies the input characters into the output glyph index array,
0N/A * for use by the canned GSUB table. It also generates the character index array.
0N/A *
0N/A * Input parameters:
0N/A * @param chars - the input character context
0N/A * @param offset - the offset of the first character to be mapped
0N/A * @param count - the number of characters to be mapped
0N/A * @param reverse - if <code>TRUE</code>, the output will be in reverse order
0N/A * @param mirror - if <code>TRUE</code>, do character mirroring
0N/A * @param glyphStorage - the glyph storage object. Glyph and char index arrays will be updated.
0N/A *
0N/A * @param success - set to an error code if the operation fails
0N/A *
0N/A * @internal
0N/A */
1693N/A virtual void mapCharsToGlyphs(const LEUnicode chars[], le_int32 offset, le_int32 count, le_bool reverse, le_bool mirror,
0N/A LEGlyphStorage &glyphStorage, LEErrorCode &success);
0N/A
0N/A /**
0N/A * This method ensures that all vowel and accent glyphs have a zero advance width by calling
0N/A * the adjustMarkGlyphs method. The character codes are used to identify the vowel and mark
0N/A * glyphs.
0N/A *
0N/A * @param chars - the input character context
0N/A * @param offset - the offset of the first character to process
0N/A * @param count - the number of characters to process
0N/A * @param reverse - <code>TRUE</code> if the glyphs in the glyph array have been reordered
0N/A * @param glyphStorage - the glyph storage object. The glyph positions will be updated as needed.
0N/A * @param success - output parameter set to an error code if the operation fails
0N/A *
0N/A * @internal
0N/A */
1693N/A virtual void adjustGlyphPositions(const LEUnicode chars[], le_int32 offset, le_int32 count, le_bool reverse, LEGlyphStorage &glyphStorage, LEErrorCode &success);
0N/A};
0N/A
1693N/AU_NAMESPACE_END
0N/A#endif
1693N/A