/*
- * @(#)IndicLayoutEngine.cpp 1.3 00/03/15
*
- * (C) Copyright IBM Corp. 1998-2003 - All Rights Reserved
+ * (C) Copyright IBM Corp. 1998-2005 - All Rights Reserved
*
*/
#include "GlyphPositioningTables.h"
#include "GDEFMarkFilter.h"
+#include "LEGlyphStorage.h"
#include "IndicReordering.h"
U_NAMESPACE_BEGIN
-const char IndicOpenTypeLayoutEngine::fgClassID=0;
+UOBJECT_DEFINE_RTTI_IMPLEMENTATION(IndicOpenTypeLayoutEngine)
IndicOpenTypeLayoutEngine::IndicOpenTypeLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode,
- const GlyphSubstitutionTableHeader *gsubTable)
- : OpenTypeLayoutEngine(fontInstance, scriptCode, languageCode, gsubTable), fMPreFixups(NULL)
+ le_int32 typoFlags, const GlyphSubstitutionTableHeader *gsubTable)
+ : OpenTypeLayoutEngine(fontInstance, scriptCode, languageCode, typoFlags, gsubTable), fMPreFixups(NULL)
{
- fFeatureOrder = IndicReordering::getFeatureOrder();
+ fFeatureMap = IndicReordering::getFeatureMap(fFeatureMapCount);
+ fFeatureOrder = TRUE;
+
+ fFilterZeroWidth = IndicReordering::getFilterZeroWidth(fScriptCode);
}
-IndicOpenTypeLayoutEngine::IndicOpenTypeLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode)
- : OpenTypeLayoutEngine(fontInstance, scriptCode, languageCode), fMPreFixups(NULL)
+IndicOpenTypeLayoutEngine::IndicOpenTypeLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode, le_int32 typoFlags)
+ : OpenTypeLayoutEngine(fontInstance, scriptCode, languageCode, typoFlags), fMPreFixups(NULL)
{
- fFeatureOrder = IndicReordering::getFeatureOrder();
+ fFeatureMap = IndicReordering::getFeatureMap(fFeatureMapCount);
+ fFeatureOrder = TRUE;
}
IndicOpenTypeLayoutEngine::~IndicOpenTypeLayoutEngine()
// Input: characters, tags
// Output: glyphs, char indices
-le_int32 IndicOpenTypeLayoutEngine::glyphProcessing(const LEUnicode chars[], le_int32 offset, le_int32 count, le_int32 max, le_bool rightToLeft, const LETag **featureTags,
- LEGlyphID *&glyphs, le_int32 *&charIndices, LEErrorCode &success)
+le_int32 IndicOpenTypeLayoutEngine::glyphProcessing(const LEUnicode chars[], le_int32 offset, le_int32 count, le_int32 max, le_bool rightToLeft,
+ LEGlyphStorage &glyphStorage, LEErrorCode &success)
{
if (LE_FAILURE(success)) {
return 0;
return 0;
}
- le_int32 retCount = OpenTypeLayoutEngine::glyphProcessing(chars, offset, count, max, rightToLeft, featureTags, glyphs, charIndices, success);
+ le_int32 retCount = OpenTypeLayoutEngine::glyphProcessing(chars, offset, count, max, rightToLeft, glyphStorage, success);
if (LE_FAILURE(success)) {
return 0;
}
- IndicReordering::adjustMPres(fMPreFixups, glyphs, charIndices);
+ IndicReordering::adjustMPres(fMPreFixups, glyphStorage);
return retCount;
}
// Input: characters
// Output: characters, char indices, tags
// Returns: output character count
-le_int32 IndicOpenTypeLayoutEngine::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)
+le_int32 IndicOpenTypeLayoutEngine::characterProcessing(const LEUnicode chars[], le_int32 offset, le_int32 count, le_int32 max, le_bool rightToLeft,
+ LEUnicode *&outChars, LEGlyphStorage &glyphStorage, LEErrorCode &success)
{
if (LE_FAILURE(success)) {
return 0;
return 0;
}
- charIndices = LE_NEW_ARRAY(le_int32, worstCase);
- if (charIndices == NULL) {
- LE_DELETE_ARRAY(outChars);
- success = LE_MEMORY_ALLOCATION_ERROR;
- return 0;
- }
+ glyphStorage.allocateGlyphArray(worstCase, rightToLeft, success);
+ glyphStorage.allocateAuxData(success);
- featureTags = LE_NEW_ARRAY(const LETag *, worstCase);
-
- if (featureTags == NULL) {
- LE_DELETE_ARRAY(charIndices);
+ if (LE_FAILURE(success)) {
LE_DELETE_ARRAY(outChars);
- success = LE_MEMORY_ALLOCATION_ERROR;
return 0;
}
// NOTE: assumes this allocates featureTags...
// (probably better than doing the worst case stuff here...)
- return IndicReordering::reorder(&chars[offset], count, fScriptCode, outChars, charIndices, featureTags, &fMPreFixups);
+ le_int32 outCharCount = IndicReordering::reorder(&chars[offset], count, fScriptCode, outChars, glyphStorage, &fMPreFixups);
+
+ glyphStorage.adoptGlyphCount(outCharCount);
+ return outCharCount;
}
U_NAMESPACE_END