1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201
|
/*
* @(#)ArabicLayoutEngine.h 1.3 00/03/15
*
* (C) Copyright IBM Corp. 1998, 1999, 2000, 2001 - All Rights Reserved
*
*/
#ifndef __ARABICLAYOUTENGINE_H
#define __ARABICLAYOUTENGINE_H
#include "LETypes.h"
#include "LEFontInstance.h"
#include "LEGlyphFilter.h"
#include "LayoutEngine.h"
#include "OpenTypeLayoutEngine.h"
#include "GlyphSubstitutionTables.h"
#include "GlyphDefinitionTables.h"
#include "GlyphPositioningTables.h"
U_NAMESPACE_BEGIN
/**
* This class implements OpenType layout for Arabic fonts. It overrides
* the characerProcessing method to assign the correct OpenType feature
* tags for the Arabic contextual forms. It also overrides the adjustGlyphPositions
* method to guarantee that all vowel and accent glyphs have zero advance width.
*/
class ArabicOpenTypeLayoutEngine : public OpenTypeLayoutEngine
{
public:
/**
* This is the main constructor. It constructs an instance of ArabicOpenTypeLayoutEngine for
* a particular font, script and language. It takes the GSUB table as a parameter since
* LayoutEngine::layoutEngineFactory has to read the GSUB table to know that it has an
* Indic OpenType font.
*
* @param fontInstance - the font
* @param scriptCode - the script
* @param langaugeCode - the language
* @param gsubTable - the GSUB table
*
* @see LayoutEngine::layoutEngineFactory
* @see OpenTypeLayoutEngine
* @see ScriptAndLangaugeTags.h for script and language codes
*/
ArabicOpenTypeLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode,
const GlyphSubstitutionTableHeader *gsubTable);
/**
* This constructor is used when the font requires a "canned" GSUB table which can't be known
* until after this constructor has been invoked.
*
* @param fontInstance - the font
* @param scriptCode - the script
* @param langaugeCode - the language
*
* @see OpenTypeLayoutEngine
* @see ScriptAndLangaugeTags.h for script and language codes
*/
ArabicOpenTypeLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode);
/**
* The destructor, virtual for correct polymorphic invocation.
*/
virtual ~ArabicOpenTypeLayoutEngine();
protected:
/**
* This method does Arabic OpenType character processing. It assigns the OpenType feature
* tags to the characters to generate the correct contextual forms and ligatures.
*
* Input parameters:
* @param chars - the input character context
* @param offset - the index of the first character to process
* @param count - the number of characters to process
* @param max - the number of characters in the input context
* @param rightToLeft - true if the characters are in a right to left directional run
*
* Output parameters:
* @param outChars - the output character arrayt
* @param charIndices - the output character index array
* @param featureTags - the output feature tag array
* @param success - set to an error code if the operation fails
*
* @return the output character count
*/
virtual le_int32 characterProcessing(const LEUnicode chars[], le_int32 offset, le_int32 count, le_int32 max, le_bool rightToLeft,
LEUnicode *&outChars, le_int32 *&charIndices, const LETag **&featureTags, LEErrorCode &success);
/**
* This method applies the GPOS table if it is present, otherwise it ensures that all vowel
* and accent glyphs have a zero advance width by calling the adjustMarkGlyphs method.
* If the font contains a GDEF table, that is used to identify voewls and accents. Otherwise
* the character codes are used.
*
* @param chars - the input character context
* @param offset - the offset of the first character to process
* @param count - the number of characters to process
* @param reverse - true if the glyphs in the glyph array have been reordered
* @param glyphs - the input glyph array
* @param glyphCount - the number of glyphs
* @param positions - the position array, will be updated as needed
* @param success - output parameter set to an error code if the operation fails
*/
virtual void adjustGlyphPositions(const LEUnicode chars[], le_int32 offset, le_int32 count, le_bool reverse, LEGlyphID glyphs[], le_int32 glyphCount, float positions[], LEErrorCode &success);
};
/**
* The class implements OpenType layout for Arabic fonts which don't
* contain a GSUB table, using a canned GSUB table based on Unicode
* Arabic Presentation Forms. It overrides the mapCharsToGlyphs method
* to use the Presentation Forms as logical glyph indices. It overrides the
* glyphPostProcessing method to convert the Presentation Forms to actual
* glyph indices.
*
* @see ArabicOpenTypeLayoutEngine
*/
class UnicodeArabicOpenTypeLayoutEngine : public ArabicOpenTypeLayoutEngine
{
public:
/**
* This constructs an instance of UnicodeArabicOpenTypeLayoutEngine for a specific font,
* script and language.
*
* @param fontInstance - the font
* @param scriptCode - the script
* @param languageCode - the language
*
* @see LEFontInstance
* @see ScriptAndLanguageTags.h for script and language codes
*/
UnicodeArabicOpenTypeLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode);
/**
* The destructor, virtual for correct polymorphic invocation.
*/
virtual ~UnicodeArabicOpenTypeLayoutEngine();
protected:
/**
* This method converts the Arabic Presentation Forms in the temp glyph array
* into actual glyph indices using ArabicOpenTypeLayoutEngine::mapCharsToGlyps.
*
* Input paramters:
* @param tempGlyphs - the input presentation forms
* @param tempCharIndices - the input character index array
* @param tempGlyphCount - the number of Presentation Froms
*
* Output parameters:
* @param glyphs - the output glyph index array
* @param charIndices - the output character index array
* @param success - set to an error code if the operation fails
*
* @return the number of glyph indices in the output glyph index array
*/
virtual le_int32 glyphPostProcessing(LEGlyphID tempGlyphs[], le_int32 tempCharIndices[], le_int32 tempGlyphCount,
LEGlyphID *&glyphs, le_int32 *&charIndices, LEErrorCode &success);
/**
* This method copies the input characters into the output glyph index array,
* for use by the canned GSUB table. It also generates the character index array.
*
* Input parameters:
* @param chars - the input character context
* @param offset - the offset of the first character to be mapped
* @param count - the number of characters to be mapped
* @param reverse - if true, the output will be in reverse order
* @param mirror - if true, do character mirroring
*
* Output parameters:
* @param glyphs - the glyph array
* @param charIndices - the character index array
* @param success - set to an error code if the operation fails
*/
virtual void mapCharsToGlyphs(const LEUnicode chars[], le_int32 offset, le_int32 count, le_bool reverse, le_bool mirror,
LEGlyphID *&glyphs, le_int32 *&charIndices, LEErrorCode &success);
/**
* This method ensures that all vowel and accent glyphs have a zero advance width by calling
* the adjustMarkGlyphs method. The character codes are used to identify the vowel and mark
* glyphs.
*
* @param chars - the input character context
* @param offset - the offset of the first character to process
* @param count - the number of characters to process
* @param reverse - true if the glyphs in the glyph array have been reordered
* @param glyphs - the input glyph array
* @param glyphCount - the number of glyphs
* @param positions - the position array, will be updated as needed
* @param success - output parameter set to an error code if the operation fails
*/
virtual void adjustGlyphPositions(const LEUnicode chars[], le_int32 offset, le_int32 count, le_bool reverse, LEGlyphID glyphs[], le_int32 glyphCount, float positions[], LEErrorCode &success);
};
U_NAMESPACE_END
#endif
|