diff --git a/icu4c/source/layout/GXLayoutEngine.cpp b/icu4c/source/layout/GXLayoutEngine.cpp
index 8d176b5efff..920c93636d7 100644
--- a/icu4c/source/layout/GXLayoutEngine.cpp
+++ b/icu4c/source/layout/GXLayoutEngine.cpp
@@ -51,13 +51,14 @@ le_int32 GXLayoutEngine::computeGlyphs(const LEUnicode chars[], le_int32 offset,
}
// apply positional tables
-void GXLayoutEngine::adjustGlyphPositions(const LEUnicode chars[], le_int32 offset, le_int32 count, le_bool /*reverse*/, LEGlyphID glyphs[], le_int32 glyphCount, float positions[], LEErrorCode &success)
+void GXLayoutEngine::adjustGlyphPositions(const LEUnicode chars[], le_int32 offset, le_int32 count, le_bool /*reverse*/,
+ LEGlyphStorage &glyphStorage, LEErrorCode &success)
{
if (LE_FAILURE(success)) {
return;
}
- if (chars == NULL || glyphs == NULL || positions == NULL || offset < 0 || count < 0 || glyphCount < 0) {
+ if (chars == NULL || offset < 0 || count < 0) {
success = LE_ILLEGAL_ARGUMENT_ERROR;
return;
}
diff --git a/icu4c/source/layout/GXLayoutEngine.h b/icu4c/source/layout/GXLayoutEngine.h
index 58614e83dea..153ab37a3f5 100644
--- a/icu4c/source/layout/GXLayoutEngine.h
+++ b/icu4c/source/layout/GXLayoutEngine.h
@@ -90,11 +90,10 @@ protected:
* @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 text is in a right to left directional run
+ * @param rightToLeft - TRUE
if the text is in a right to left directional run
+ * @param glyphStorage - the glyph storage object. The glyph and char index arrays will be set.
*
* Output parameters:
- * @param glyphs - the glyph index array
- * @param charIndices - the character index array
* @param success - set to an error code if the operation fails
*
* @return the number of glyphs in the glyph index array
@@ -109,19 +108,15 @@ protected:
* 'kern', 'trak', 'bsln', 'opbd' and 'just' tables.
*
* Input parameters:
- * @param glyphs - the input glyph array
- * @param glyphCount - the number of glyphs in the glyph array
- * @param x - the starting X position
- * @param y - the starting Y position
+ * @param glyphStorage - the object holding the glyph storage. The positions will be updated as needed.
*
* Output parameters:
- * @param positions - the output X and Y positions (two entries per glyph)
* @param success - set to an error code if the operation fails
*
* @internal
*/
- virtual void adjustGlyphPositions(const LEUnicode chars[], le_int32 offset, le_int32 count, le_bool reverse, LEGlyphID glyphs[],
- le_int32 glyphCount, float positions[], LEErrorCode &success);
+ virtual void adjustGlyphPositions(const LEUnicode chars[], le_int32 offset, le_int32 count, le_bool reverse,
+ LEGlyphStorage &glyphStorage, LEErrorCode &success);
private:
diff --git a/icu4c/source/layout/HanLayoutEngine.cpp b/icu4c/source/layout/HanLayoutEngine.cpp
index 3619712f7f1..9076442a765 100644
--- a/icu4c/source/layout/HanLayoutEngine.cpp
+++ b/icu4c/source/layout/HanLayoutEngine.cpp
@@ -12,6 +12,7 @@
#include "OpenTypeLayoutEngine.h"
#include "HanLayoutEngine.h"
#include "ScriptAndLanguageTags.h"
+#include "LEGlyphStorage.h"
U_NAMESPACE_BEGIN
@@ -38,7 +39,7 @@ const LETag tradFeatureTag = LE_TRAD_FEATURE_TAG;
const LETag features[] = {loclFeatureTag, emptyTag};
le_int32 HanOpenTypeLayoutEngine::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)
+ LEUnicode *&/*outChars*/, LEGlyphStorage &glyphStorage, LEErrorCode &success)
{
if (LE_FAILURE(success)) {
return 0;
@@ -49,10 +50,10 @@ le_int32 HanOpenTypeLayoutEngine::characterProcessing(const LEUnicode chars[], l
return 0;
}
- featureTags = LE_NEW_ARRAY(const LETag *, count);
+ glyphStorage.allocateGlyphArray(count, FALSE, success);
+ glyphStorage.allocateAuxData(success);
- if (featureTags == NULL) {
- success = LE_MEMORY_ALLOCATION_ERROR;
+ if (LE_FAILURE(success)) {
return 0;
}
@@ -61,7 +62,7 @@ le_int32 HanOpenTypeLayoutEngine::characterProcessing(const LEUnicode chars[], l
// flag from the language tag lookups, so we can use these features
// with the default LangSys...
for (le_int32 i = 0; i < count; i += 1) {
- featureTags[i] = features;
+ glyphStorage.setAuxData(i, (void *) features, success);
}
return count;
diff --git a/icu4c/source/layout/HanLayoutEngine.h b/icu4c/source/layout/HanLayoutEngine.h
index f832e560e0b..525920bdd16 100644
--- a/icu4c/source/layout/HanLayoutEngine.h
+++ b/icu4c/source/layout/HanLayoutEngine.h
@@ -2,7 +2,7 @@
/*
* HanLayoutEngine.h: OpenType processing for Han fonts.
*
- * (C) Copyright IBM Corp. 1998-2003 - All Rights Reserved.
+ * (C) Copyright IBM Corp. 1998-2004 - All Rights Reserved.
*/
#ifndef __HANLAYOUTENGINE_H
@@ -17,6 +17,8 @@
U_NAMESPACE_BEGIN
+class LEGlyphStorage;
+
/**
* This class implements OpenType layout for Han fonts. It overrides
* the characerProcessing method to assign the correct OpenType feature
@@ -80,7 +82,8 @@ protected:
* @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
+ * @param rightToLeft - TRUE
if the characters are in a right to left directional run
+ * @param glyphStorage - the object holding the glyph storage. The char index and auxillary data arrays will be set.
*
* Output parameters:
* @param outChars - the output character arrayt
@@ -93,7 +96,7 @@ protected:
* @internal
*/
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);
+ LEUnicode *&outChars, LEGlyphStorage &glyphStorage, LEErrorCode &success);
private: