[sword-cvs] icu-sword/source/layoutex Makefile.in,1.1,1.2 ParagraphLayout.cpp,1.1,1.2 RunArrays.cpp,1.1,1.2 layoutex.dsp,1.1,1.2 layoutex.rc,1.1,1.2 layoutex.vcproj,1.1,1.2 Utilities.cpp,1.1,NONE Utilities.h,1.1,NONE

sword@www.crosswire.org sword@www.crosswire.org
Tue, 6 Apr 2004 03:10:52 -0700


Update of /cvs/core/icu-sword/source/layoutex
In directory www:/tmp/cvs-serv8911/source/layoutex

Modified Files:
	Makefile.in ParagraphLayout.cpp RunArrays.cpp layoutex.dsp 
	layoutex.rc layoutex.vcproj 
Removed Files:
	Utilities.cpp Utilities.h 
Log Message:
ICU 2.8 sync

Index: Makefile.in
===================================================================
RCS file: /cvs/core/icu-sword/source/layoutex/Makefile.in,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- Makefile.in	10 Sep 2003 02:42:26 -0000	1.1
+++ Makefile.in	6 Apr 2004 10:09:07 -0000	1.2
@@ -2,9 +2,6 @@
 ## others. All Rights Reserved.
 ## Makefile.in for ICU - layout
 
-SO_TARGET_VERSION = @LIB_VERSION@
-SO_TARGET_VERSION_MAJOR = @LIB_VERSION_MAJOR@
-
 ## Install directory information
 srcdir = @srcdir@
 top_srcdir = @top_srcdir@
@@ -24,15 +21,25 @@
 TARGET_STUBNAME=lx
 
 ifneq ($(ENABLE_STATIC),)
-TARGET = $(LIBICU)$(TARGET_STUBNAME)$(ICULIBSUFFIX).a
+TARGET = $(LIBSICU)$(TARGET_STUBNAME)$(ICULIBSUFFIX).$(A)
 endif
 
 ifneq ($(ENABLE_SHARED),)
 SO_TARGET = $(LIBICU)$(TARGET_STUBNAME)$(ICULIBSUFFIX).$(SO)
 ALL_SO_TARGETS = $(SO_TARGET) $(MIDDLE_SO_TARGET) $(FINAL_SO_TARGET)
+
+ifeq ($(ENABLE_SO_VERSION_DATA),1)
+SO_VERSION_DATA = layoutex.res
 endif
 
-ALL_TARGETS = $(TARGET) $(ALL_SO_TARGETS)
+ifeq ($(OS390BATCH),1)
+BATCH_TARGET = $(BATCH_LAYOUTEX_TARGET)
+BATCH_LIBS = $(BATCH_LIBICUUC) $(BATCH_LIBICULE) -lm
+endif   # OS390BATCH
+
+endif   # ENABLE_SHARED
+
+ALL_TARGETS = $(TARGET) $(ALL_SO_TARGETS) $(BATCH_TARGET)
 
 DYNAMICCPPFLAGS = $(SHAREDLIBCPPFLAGS)
 DYNAMICCFLAGS = $(SHAREDLIBCFLAGS)
@@ -107,8 +114,7 @@
 
 clean-local:
 	test -z "$(CLEANFILES)" || $(RMV) $(CLEANFILES)
-	$(RMV) $(OBJECTS) $(ALL_TARGETS)
-#	$(RMV) $(OBJECTS) $(STATIC_OBJECTS) $(ALL_TARGETS)
+	$(RMV) $(OBJECTS) $(ALL_TARGETS) $(SO_VERSION_DATA)
 
 distclean-local: clean-local
 	$(RMV) Makefile
@@ -125,8 +131,14 @@
 endif
 
 ifneq ($(ENABLE_SHARED),)
-$(FINAL_SO_TARGET): $(OBJECTS)
+$(FINAL_SO_TARGET): $(OBJECTS) $(SO_VERSION_DATA)
 	$(SHLIB.cc) $(LD_SONAME) $(OUTOPT)$@ $^ $(LIBS)
+
+ifeq ($(OS390BATCH),1)
+$(BATCH_TARGET): $(OBJECTS)
+	$(SHLIB.cc) $(LD_SONAME) $(OUTOPT)$@ $^ $(BATCH_LIBS)
+endif   # OS390BATCH
+
 endif
 
 ifeq (,$(MAKECMDGOALS))

Index: ParagraphLayout.cpp
===================================================================
RCS file: /cvs/core/icu-sword/source/layoutex/ParagraphLayout.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- ParagraphLayout.cpp	10 Sep 2003 02:42:26 -0000	1.1
+++ ParagraphLayout.cpp	6 Apr 2004 10:09:07 -0000	1.2
@@ -126,66 +126,66 @@
 }
 
 /*
- * NOTE: This table only has "true" values for
+ * NOTE: This table only has "TRUE" values for
  * those scripts which the LayoutEngine can currently
  * process, rather for all scripts which require
  * complex processing for correct rendering.
  */
 static const le_bool complexTable[] = {
-    false , /* Zyyy */
-    false,  /* Qaai */
-    true,   /* Arab */
-    false,  /* Armn */
-    true,   /* Beng */
-    false,  /* Bopo */
-    false,  /* Cher */
-    false,  /* Qaac */
-    false,  /* Cyrl */
-    false,  /* Dsrt */
-    true,   /* Deva */
-    false,  /* Ethi */
-    false,  /* Geor */
-    false,  /* Goth */
-    false,  /* Grek */
-    true,   /* Gujr */
-    true,   /* Guru */
-    false,  /* Hani */
-    false,  /* Hang */
-    true,   /* Hebr */
-    false,  /* Hira */
-    true,   /* Knda */
-    false,  /* Kana */
-    false,  /* Khmr */
-    false,  /* Laoo */
-    false,  /* Latn */
-    true,   /* Mlym */
-    false,  /* Mong */
-    false,  /* Mymr */
-    false,  /* Ogam */
-    false,  /* Ital */
-    true,   /* Orya */
-    false,  /* Runr */
-    false,  /* Sinh */
-    false,  /* Syrc */
-    true,   /* Taml */
-    true,   /* Telu */
-    false,  /* Thaa */
-    true,   /* Thai */
-    false,  /* Tibt */
-    false,  /* Cans */
-    false,  /* Yiii */
-    false,  /* Tglg */
-    false,  /* Hano */
-    false,  /* Buhd */
-    false,  /* Tagb */
-    false,  /* Brai */
-    false,  /* Cprt */
-    false,  /* Limb */
-    false,  /* Linb */
-    false,  /* Osma */
-    false,  /* Shaw */
-    false,  /* Tale */
-    false   /* Ugar */
+    FALSE , /* Zyyy */
+    FALSE,  /* Qaai */
+    TRUE,   /* Arab */
+    FALSE,  /* Armn */
+    TRUE,   /* Beng */
+    FALSE,  /* Bopo */
+    FALSE,  /* Cher */
+    FALSE,  /* Qaac */
+    FALSE,  /* Cyrl */
+    FALSE,  /* Dsrt */
+    TRUE,   /* Deva */
+    FALSE,  /* Ethi */
+    FALSE,  /* Geor */
+    FALSE,  /* Goth */
+    FALSE,  /* Grek */
+    TRUE,   /* Gujr */
+    TRUE,   /* Guru */
+    FALSE,  /* Hani */
+    FALSE,  /* Hang */
+    TRUE,   /* Hebr */
+    FALSE,  /* Hira */
+    TRUE,   /* Knda */
+    FALSE,  /* Kana */
+    FALSE,  /* Khmr */
+    FALSE,  /* Laoo */
+    FALSE,  /* Latn */
+    TRUE,   /* Mlym */
+    FALSE,  /* Mong */
+    FALSE,  /* Mymr */
+    FALSE,  /* Ogam */
+    FALSE,  /* Ital */
+    TRUE,   /* Orya */
+    FALSE,  /* Runr */
+    FALSE,  /* Sinh */
+    FALSE,  /* Syrc */
+    TRUE,   /* Taml */
+    TRUE,   /* Telu */
+    FALSE,  /* Thaa */
+    TRUE,   /* Thai */
+    FALSE,  /* Tibt */
+    FALSE,  /* Cans */
+    FALSE,  /* Yiii */
+    FALSE,  /* Tglg */
+    FALSE,  /* Hano */
+    FALSE,  /* Buhd */
+    FALSE,  /* Tagb */
+    FALSE,  /* Brai */
+    FALSE,  /* Cprt */
+    FALSE,  /* Limb */
+    FALSE,  /* Linb */
+    FALSE,  /* Osma */
+    FALSE,  /* Shaw */
+    FALSE,  /* Tale */
+    FALSE   /* Ugar */
 };
 
 
@@ -216,18 +216,25 @@
                                  const ValueRuns  *levelRuns,
                                  const ValueRuns  *scriptRuns,
                                  const LocaleRuns *localeRuns,
-                                 UBiDiLevel paragraphLevel, le_bool vertical)
+                                 UBiDiLevel paragraphLevel, le_bool vertical,
+								 LEErrorCode &status)
                                  : fChars(chars), fCharCount(count),
                                    fFontRuns(NULL), fLevelRuns(levelRuns), fScriptRuns(scriptRuns), fLocaleRuns(localeRuns),
-                                   fVertical(vertical), fClientLevels(true), fClientScripts(true), fClientLocales(true), fEmbeddingLevels(NULL),
+                                   fVertical(vertical), fClientLevels(TRUE), fClientScripts(TRUE), fClientLocales(TRUE), fEmbeddingLevels(NULL),
                                    fAscent(0), fDescent(0), fLeading(0),
-                                   fGlyphToCharMap(NULL), fCharToGlyphMap(NULL), fGlyphWidths(NULL), fGlyphCount(0),
+                                   fGlyphToCharMap(NULL), fCharToMinGlyphMap(NULL), fCharToMaxGlyphMap(NULL), fGlyphWidths(NULL), fGlyphCount(0),
                                    fParaBidi(NULL), fLineBidi(NULL),
                                    fStyleRunLimits(NULL), fStyleIndices(NULL), fStyleRunCount(0),
                                    fBreakIterator(NULL), fLineStart(-1), fLineEnd(0),
                                  /*fVisualRuns(NULL), fStyleRunInfo(NULL), fVisualRunCount(-1),
                                    fFirstVisualRun(-1), fLastVisualRun(-1),*/ fVisualRunLastX(0), fVisualRunLastY(0)
 {
+
+	if (LE_FAILURE(status)) {
+		fCharCount = -1;
+		return;
+	}
+
     // FIXME: should check the limit arrays for consistency...
 
     computeLevels(paragraphLevel);
@@ -240,7 +247,13 @@
         computeLocales();
     }
 
-    computeSubFonts(fontRuns);
+    computeSubFonts(fontRuns, status);
+
+	if (LE_FAILURE(status)) {
+		//other stuff?
+		fCharCount = -1;
+		return;
+	}
 
     // now intersect the font, direction and script runs...
     const RunArray *styleRunArrays[] = {fFontRuns, fLevelRuns, fScriptRuns, fLocaleRuns};
@@ -287,17 +300,19 @@
     //
     // For each layout get the positions and convert them into glyph widths, in
     // logical order. Get the glyph-to-char mapping, offset by starting index in the
-    // width array, and swap it into logical order. Then fill in the char-to-glyph map
-    // from this. (charToGlyph[glyphToChar[i]] = i)
-    fGlyphWidths    = LE_NEW_ARRAY(float, fGlyphCount);
-    fGlyphToCharMap = LE_NEW_ARRAY(le_int32, fGlyphCount + 1);
-    fCharToGlyphMap = LE_NEW_ARRAY(le_int32, fCharCount + 1);
+    // character array. Swap the glyph width and glyph-to-char arrays into logical order.
+	// Finally, fill in the char-to-glyph mappings.
+    fGlyphWidths       = LE_NEW_ARRAY(float, fGlyphCount);
+    fGlyphToCharMap    = LE_NEW_ARRAY(le_int32, fGlyphCount + 1);
+    fCharToMinGlyphMap = LE_NEW_ARRAY(le_int32, fCharCount + 1);
+	fCharToMaxGlyphMap = LE_NEW_ARRAY(le_int32, fCharCount + 1);
+
+	le_int32 glyph;
 
     for (runStart = 0, run = 0; run < fStyleRunCount; run += 1) {
         LayoutEngine *engine = fStyleRunInfo[run].engine;
         le_int32 glyphCount  = fStyleRunInfo[run].glyphCount;
         le_int32 glyphBase   = fStyleRunInfo[run].glyphBase;
-        le_int32 glyph;
 
         fStyleRunInfo[run].glyphs = LE_NEW_ARRAY(LEGlyphID, glyphCount);
         fStyleRunInfo[run].positions = LE_NEW_ARRAY(float, glyphCount * 2 + 2);
@@ -308,23 +323,11 @@
 
         for (glyph = 0; glyph < glyphCount; glyph += 1) {
             fGlyphWidths[glyphBase + glyph] = fStyleRunInfo[run].positions[glyph * 2 + 2] - fStyleRunInfo[run].positions[glyph * 2];
-            fCharToGlyphMap[fGlyphToCharMap[glyphBase + glyph]] = glyphBase + glyph;
         }
 
         if ((fStyleRunInfo[run].level & 1) != 0) {
             LXUtilities::reverse(&fGlyphWidths[glyphBase], glyphCount);
             LXUtilities::reverse(&fGlyphToCharMap[glyphBase], glyphCount);
-
-            // LXUtilities::reverse(&fCharToGlyphMap[runStart], fStyleRunLimits[run] - runStart);
-            // convert from visual to logical glyph indices
-            for (glyph = glyphBase; glyph < glyphBase + glyphCount; glyph += 1) {
-                le_int32 ch = fGlyphToCharMap[glyph];
-                le_int32 lastGlyph = glyphBase + glyphCount - 1;
-
-                // both lastGlyph and fCharToGlyphMap[ch] are biased by
-                // glyphBase, so subtracting them will remove the bias.
-                fCharToGlyphMap[ch] = lastGlyph - fCharToGlyphMap[ch] + glyphBase;
-            }
         }
 
         runStart = fStyleRunLimits[run];
@@ -333,8 +336,23 @@
         fStyleRunInfo[run].engine = NULL;
     }
 
-    fCharToGlyphMap[fCharCount]  = fGlyphCount;
     fGlyphToCharMap[fGlyphCount] = fCharCount;
+
+	for (glyph = fGlyphCount - 1; glyph >= 0; glyph -= 1) {
+		le_int32 ch = fGlyphToCharMap[glyph];
+
+		fCharToMinGlyphMap[ch] = glyph;
+	}
+
+    fCharToMinGlyphMap[fCharCount] = fGlyphCount;
+
+	for (glyph = 0; glyph < fGlyphCount; glyph += 1) {
+		le_int32 ch = fGlyphToCharMap[glyph];
+
+		fCharToMaxGlyphMap[ch] = glyph;
+	}
+
+	fCharToMaxGlyphMap[fCharCount] = fGlyphCount;
 }
 
 ParagraphLayout::~ParagraphLayout()
@@ -345,21 +363,21 @@
         delete (ValueRuns *) fLevelRuns;
         fLevelRuns = NULL;
 
-        fClientLevels = true;
+        fClientLevels = TRUE;
     }
 
     if (! fClientScripts) {
         delete (ValueRuns *) fScriptRuns;
         fScriptRuns = NULL;
 
-        fClientScripts = true;
+        fClientScripts = TRUE;
     }
 
     if (! fClientLocales) {
         delete (LocaleRuns *) fLocaleRuns;
         fLocaleRuns = NULL;
 
-        fClientLocales = true;
+        fClientLocales = TRUE;
     }
 
     if (fEmbeddingLevels != NULL) {
@@ -372,11 +390,16 @@
         fGlyphToCharMap = NULL;
     }
 
-    if (fCharToGlyphMap != NULL) {
-        LE_DELETE_ARRAY(fCharToGlyphMap);
-        fCharToGlyphMap = NULL;
+    if (fCharToMinGlyphMap != NULL) {
+        LE_DELETE_ARRAY(fCharToMinGlyphMap);
+        fCharToMinGlyphMap = NULL;
     }
 
+	if (fCharToMaxGlyphMap != NULL) {
+		LE_DELETE_ARRAY(fCharToMaxGlyphMap);
+		fCharToMaxGlyphMap = NULL;
+	}
+
     if (fGlyphWidths != NULL) {
         LE_DELETE_ARRAY(fGlyphWidths);
         fGlyphWidths = NULL;
@@ -429,16 +452,16 @@
 
     while (uscript_nextRun(sr, NULL, NULL, &scriptCode)) {
         if (isComplex(scriptCode)) {
-            return true;
+            return TRUE;
         }
     }
 
-    return false;
+    return FALSE;
 }
 
 le_int32 ParagraphLayout::getAscent() const
 {
-    if (fAscent <= 0) {
+    if (fAscent <= 0 && fCharCount > 0) {
         ((ParagraphLayout *) this)->computeMetrics();
     }
 
@@ -447,7 +470,7 @@
 
 le_int32 ParagraphLayout::getDescent() const
 {
-    if (fAscent <= 0) {
+    if (fAscent <= 0 && fCharCount > 0) {
         ((ParagraphLayout *) this)->computeMetrics();
     }
 
@@ -456,7 +479,7 @@
 
 le_int32 ParagraphLayout::getLeading() const
 {
-    if (fAscent <= 0) {
+    if (fAscent <= 0 && fCharCount > 0) {
         ((ParagraphLayout *) this)->computeMetrics();
     }
 
@@ -472,7 +495,7 @@
     fLineStart = fLineEnd;
 
     if (width > 0) {
-        le_int32 glyph    = fCharToGlyphMap[fLineStart];
+        le_int32 glyph    = fCharToMinGlyphMap[fLineStart];
         float widthSoFar  = 0;
 
         while (glyph < fGlyphCount && widthSoFar + fGlyphWidths[glyph] <= width) {
@@ -492,11 +515,12 @@
 
         fLineEnd = previousBreak(fGlyphToCharMap[glyph]);
 
-        // If there's no real break, break at the
-        // glyph that didn't fit.
-        if (fLineEnd <= fLineStart) {
-            fLineEnd = fGlyphToCharMap[glyph];
-        }
+        // If this break is at or before the last one,
+		// find a glyph, starting at the one which didn't
+		// fit, that produces a break after the last one.
+		while (fLineEnd <= fLineStart) {
+			fLineEnd = fGlyphToCharMap[glyph++];
+		}
     } else {
         fLineEnd = fCharCount;
     }
@@ -543,7 +567,7 @@
         }
 
         fLevelRuns    = levelRuns;
-        fClientLevels = false;
+        fClientLevels = FALSE;
     }
 }
 
@@ -562,7 +586,7 @@
     uscript_closeRun(sr);
 
     fScriptRuns    = scriptRuns;
-    fClientScripts = false;
+    fClientScripts = FALSE;
 }
 
 void ParagraphLayout::computeLocales()
@@ -573,11 +597,15 @@
     localeRuns->add(defaultLocale, fCharCount);
 
     fLocaleRuns    = localeRuns;
-    fClientLocales = false;
+    fClientLocales = FALSE;
 }
 
-void ParagraphLayout::computeSubFonts(const FontRuns *fontRuns)
+void ParagraphLayout::computeSubFonts(const FontRuns *fontRuns, LEErrorCode &status)
 {
+	if (LE_FAILURE(status)) {
+		return;
+	}
+
     const RunArray *styleRunArrays[] = {fontRuns, fScriptRuns};
     le_int32 styleCount = sizeof styleRunArrays / sizeof styleRunArrays[0];
     StyleRuns styleRuns(styleRunArrays, styleCount);
@@ -595,10 +623,14 @@
     for (run = 0; run < styleRunCount; run += 1) {
         const LEFontInstance *runFont = fontRuns->getFont(si[0]);
         le_int32 script = fScriptRuns->getValue(si[1]);
-        LEErrorCode success = LE_NO_ERROR;
 
         while (offset < styleRunLimits[run]) {
-            const LEFontInstance *subFont = runFont->getSubFont(fChars, &offset, styleRunLimits[run], script, success);
+            const LEFontInstance *subFont = runFont->getSubFont(fChars, &offset, styleRunLimits[run], script, status);
+
+			if (LE_FAILURE(status)) {
+				delete subFontRuns;
+				goto cleanUp;
+			}
 
             subFontRuns->add(subFont, offset);
         }
@@ -608,6 +640,7 @@
 
     fFontRuns = subFontRuns;
 
+cleanUp:
     LE_DELETE_ARRAY(styleIndices);
     LE_DELETE_ARRAY(styleRunLimits);
 }
@@ -723,7 +756,7 @@
 le_bool ParagraphLayout::isComplex(UScriptCode script)
 {
     if (script < 0 || script >= USCRIPT_CODE_LIMIT) {
-        return false;
+        return FALSE;
     }
 
     return complexTable[script];
@@ -810,14 +843,15 @@
     le_int32 ch;
 
     for (ch = firstChar; ch <= lastChar; ch += 1) {
-        le_int32 glyph = fCharToGlyphMap[ch];
+        le_int32 minGlyph = fCharToMinGlyphMap[ch];
+		le_int32 maxGlyph = fCharToMaxGlyphMap[ch];
 
-        if (glyph < leftGlyph) {
-            leftGlyph = glyph;
+        if (minGlyph < leftGlyph) {
+            leftGlyph = minGlyph;
         }
 
-        if (glyph > rightGlyph) {
-            rightGlyph = glyph;
+        if (maxGlyph > rightGlyph) {
+            rightGlyph = maxGlyph;
         }
     }
 
@@ -838,12 +872,8 @@
     // from the middle of a layout. If we've got a right-to-left run, we
     // want the left-most glyph to start at the final x position of the
     // previous run, even though this glyph may be in the middle of the
-    // layout.
-    if (run == fFirstVisualRun) {
-        fVisualRunLastX = - fStyleRunInfo[run].positions[leftGlyph * 2];
-    } else if ((fStyleRunInfo[run].level & 1) != 0) {
-        fVisualRunLastX -= fStyleRunInfo[run].positions[leftGlyph * 2];
-    }
+    // run.
+	fVisualRunLastX -= fStyleRunInfo[run].positions[leftGlyph * 2];
  
     // Make rightGlyph be the glyph just to the right of
     // the run's glyphs
@@ -943,6 +973,15 @@
     return fLeading;
 }
 
+le_int32 ParagraphLayout::Line::getWidth() const
+{
+	const VisualRun *lastRun = getVisualRun(fRunCount - 1);
+	le_int32 glyphCount = lastRun->getGlyphCount();
+	const float *positions = lastRun->getPositions();
+	
+	return (le_int32) positions[glyphCount * 2];
+}
+
 const ParagraphLayout::VisualRun *ParagraphLayout::Line::getVisualRun(le_int32 runIndex) const
 {
     if (runIndex < 0 || runIndex >= fRunCount) {
@@ -999,6 +1038,13 @@
 }
 
 const char ParagraphLayout::VisualRun::fgClassID = 0;
+
+ParagraphLayout::VisualRun::~VisualRun()
+{
+    LE_DELETE_ARRAY(fGlyphToCharMap);
+    LE_DELETE_ARRAY(fPositions);
+    LE_DELETE_ARRAY(fGlyphs);
+}
 
 U_NAMESPACE_END
 

Index: RunArrays.cpp
===================================================================
RCS file: /cvs/core/icu-sword/source/layoutex/RunArrays.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- RunArrays.cpp	10 Sep 2003 02:42:26 -0000	1.1
+++ RunArrays.cpp	6 Apr 2004 10:09:07 -0000	1.2
@@ -16,6 +16,22 @@
 
 const char RunArray::fgClassID = 0;
 
+RunArray::RunArray(le_int32 initialCapacity)
+    : fClientArrays(FALSE), fLimits(NULL), fCount(0), fCapacity(initialCapacity)
+{
+    if (initialCapacity > 0) {
+        fLimits = LE_NEW_ARRAY(le_int32, fCapacity);
+    }
+}
+
+RunArray::~RunArray()
+{
+    if (! fClientArrays) {
+        LE_DELETE_ARRAY(fLimits);
+        fLimits = NULL;
+    }
+}
+
 le_int32 RunArray::ensureCapacity()
 {
     if (fCount >= fCapacity) {
@@ -57,6 +73,22 @@
 
 const char FontRuns::fgClassID = 0;
 
+FontRuns::FontRuns(le_int32 initialCapacity)
+    : RunArray(initialCapacity), fFonts(NULL)
+{
+    if (initialCapacity > 0) {
+        fFonts = LE_NEW_ARRAY(const LEFontInstance *, initialCapacity);
+    }
+}
+
+FontRuns::~FontRuns()
+{
+    if (! fClientArrays) {
+        LE_DELETE_ARRAY(fFonts);
+        fFonts = NULL;
+    }
+}
+
 void FontRuns::init(le_int32 capacity)
 {
     RunArray::init(capacity);
@@ -93,6 +125,22 @@
 
 const char LocaleRuns::fgClassID = 0;
 
+LocaleRuns::LocaleRuns(le_int32 initialCapacity)
+    : RunArray(initialCapacity), fLocales(NULL)
+{
+    if (initialCapacity > 0) {
+        fLocales = LE_NEW_ARRAY(const Locale *, initialCapacity);
+    }
+}
+
+LocaleRuns::~LocaleRuns()
+{
+    if (! fClientArrays) {
+        LE_DELETE_ARRAY(fLocales);
+        fLocales = NULL;
+    }
+}
+
 void LocaleRuns::init(le_int32 capacity)
 {
     RunArray::init(capacity);
@@ -128,6 +176,22 @@
 }
 
 const char ValueRuns::fgClassID = 0;
+
+ValueRuns::ValueRuns(le_int32 initialCapacity)
+    : RunArray(initialCapacity), fValues(NULL)
+{
+    if (initialCapacity > 0) {
+        fValues = LE_NEW_ARRAY(le_int32, initialCapacity);
+    }
+}
+
+ValueRuns::~ValueRuns()
+{
+    if (! fClientArrays) {
+        LE_DELETE_ARRAY(fValues);
+        fValues = NULL;
+    }
+}
 
 void ValueRuns::init(le_int32 capacity)
 {

Index: layoutex.dsp
===================================================================
RCS file: /cvs/core/icu-sword/source/layoutex/layoutex.dsp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- layoutex.dsp	10 Sep 2003 02:42:27 -0000	1.1
+++ layoutex.dsp	6 Apr 2004 10:09:07 -0000	1.2
@@ -55,7 +55,7 @@
 # ADD BSC32 /nologo
 LINK32=link.exe
 # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 ..\..\lib\icuuc.lib ..\..\lib\icule.lib /nologo /dll /machine:I386 /out:"..\..\bin\iculx26.dll" /implib:"..\..\lib\iculx.lib"
+# ADD LINK32 ..\..\lib\icuuc.lib ..\..\lib\icule.lib /nologo /dll /machine:I386 /out:"..\..\bin\iculx28.dll" /implib:"..\..\lib\iculx.lib"
 # SUBTRACT LINK32 /pdb:none
 
 !ELSEIF  "$(CFG)" == "layoutex - Win32 Debug"
@@ -82,7 +82,7 @@
 # ADD BSC32 /nologo
 LINK32=link.exe
 # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 ..\..\lib\icuucd.lib ..\..\lib\iculed.lib /nologo /dll /debug /machine:I386 /out:"..\..\bin\iculx26d.dll" /implib:"..\..\lib\iculxd.lib" /pdbtype:sept
+# ADD LINK32 ..\..\lib\icuucd.lib ..\..\lib\iculed.lib /nologo /dll /debug /machine:I386 /out:"..\..\bin\iculx28d.dll" /implib:"..\..\lib\iculxd.lib" /pdbtype:sept
 # SUBTRACT LINK32 /pdb:none
 
 !ELSEIF  "$(CFG)" == "layoutex - Win64 Release"
@@ -109,7 +109,7 @@
 # ADD BSC32 /nologo
 LINK32=link.exe
 # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:IX86 /machine:IA64
-# ADD LINK32 ..\..\lib\icuuc.lib ..\..\lib\icule.lib /nologo /dll /machine:IX86 /out:"..\..\bin\iculx26.dll" /implib:"..\..\lib\iculx.lib" /machine:IA64
+# ADD LINK32 ..\..\lib\icuuc.lib ..\..\lib\icule.lib /nologo /dll /machine:IX86 /out:"..\..\bin\iculx28.dll" /implib:"..\..\lib\iculx.lib" /machine:IA64
 
 !ELSEIF  "$(CFG)" == "layoutex - Win64 Debug"
 
@@ -135,7 +135,7 @@
 # ADD BSC32 /nologo
 LINK32=link.exe
 # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:IX86 /pdbtype:sept /machine:IA64
-# ADD LINK32 ..\..\lib\icuucd.lib ..\..\lib\iculed.lib /nologo /dll /incremental:no /debug /machine:IX86 /out:"..\..\bin\iculx26d.dll" /implib:"..\..\lib\iculxd.lib" /pdbtype:sept /machine:IA64
+# ADD LINK32 ..\..\lib\icuucd.lib ..\..\lib\iculed.lib /nologo /dll /incremental:no /debug /machine:IX86 /out:"..\..\bin\iculx28d.dll" /implib:"..\..\lib\iculxd.lib" /pdbtype:sept /machine:IA64
 
 !ENDIF 
 

Index: layoutex.rc
===================================================================
RCS file: /cvs/core/icu-sword/source/layoutex/layoutex.rc,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- layoutex.rc	10 Sep 2003 02:42:27 -0000	1.1
+++ layoutex.rc	6 Apr 2004 10:09:08 -0000	1.2
@@ -1,25 +1,50 @@
-//Do not edit with Microsoft Developer Studio because it will modify this
-//script in the wrong way.
+// Do not edit with Microsoft Developer Studio Resource Editor.
+//   It will permanently substitute version numbers that are intended to be
+//   picked up by the pre-processor during each build.
 // Copyright (c) 2001-2003 International Business Machines
 // Corporation and others. All Rights Reserved.
 //
+#include "../common/msvcres.h"
+
 #define APSTUDIO_READONLY_SYMBOLS
 /////////////////////////////////////////////////////////////////////////////
 //
 // Generated from the TEXTINCLUDE 2 resource.
 //
-#include "winresrc.h"
-
+#include <winresrc.h>
 /////////////////////////////////////////////////////////////////////////////
 #undef APSTUDIO_READONLY_SYMBOLS
 
 /////////////////////////////////////////////////////////////////////////////
-//
+// 
 
 LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
 #pragma code_page(1252)
 
-#include "unicode\uversion.h"
+#ifdef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// TEXTINCLUDE
+//
+
+1 TEXTINCLUDE 
+BEGIN
+    "../common/msvcres.h\0"
+END
+
+2 TEXTINCLUDE 
+BEGIN
+    "#include <winresrc.h>\0"
+END
+
+3 TEXTINCLUDE 
+BEGIN
+    "\r\n"
+    "\0"
+END
+
+#endif    // APSTUDIO_INVOKED
+
 
 /////////////////////////////////////////////////////////////////////////////
 //
@@ -55,7 +80,6 @@
 #else
             VALUE "OriginalFilename", "iculx" U_ICU_VERSION_SHORT ".dll\0")
 #endif
-
             VALUE "PrivateBuild", "\0"
             VALUE "ProductName", "International Components for Unicode\0"
             VALUE "ProductVersion", CommaVersionString(U_ICU_VERSION_MAJOR_NUM, U_ICU_VERSION_MINOR_NUM, U_ICU_VERSION_PATCHLEVEL_NUM, 0)
@@ -69,4 +93,16 @@
 END
 
 /////////////////////////////////////////////////////////////////////////////
+
+
+
+#ifndef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 3 resource.
+//
+
+
+/////////////////////////////////////////////////////////////////////////////
+#endif    // not APSTUDIO_INVOKED
 

Index: layoutex.vcproj
===================================================================
RCS file: /cvs/core/icu-sword/source/layoutex/layoutex.vcproj,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- layoutex.vcproj	10 Sep 2003 02:42:27 -0000	1.1
+++ layoutex.vcproj	6 Apr 2004 10:09:08 -0000	1.2
@@ -1,7 +1,7 @@
-<?xml version="1.0" encoding = "Windows-1252"?>
+<?xml version="1.0" encoding="Windows-1252"?>
 <VisualStudioProject
 	ProjectType="Visual C++"
-	Version="7.00"
+	Version="7.10"
 	Name="layoutex"
 	SccProjectName=""
 	SccLocalPath="">
@@ -40,10 +40,10 @@
 				Name="VCLinkerTool"
 				AdditionalOptions="/MACHINE:I386"
 				AdditionalDependencies="..\..\lib\icuuc.lib ..\..\lib\icule.lib"
-				OutputFile="..\..\bin\iculx26.dll"
+				OutputFile="..\..\bin\iculx28.dll"
 				LinkIncremental="1"
 				SuppressStartupBanner="TRUE"
-				ProgramDatabaseFile=".\..\..\lib/iculx26.pdb"
+				ProgramDatabaseFile=".\..\..\lib/iculx28.pdb"
 				ImportLibrary="..\..\lib\iculx.lib"/>
 			<Tool
 				Name="VCMIDLTool"
@@ -65,7 +65,13 @@
 			<Tool
 				Name="VCWebServiceProxyGeneratorTool"/>
 			<Tool
+				Name="VCXMLDataGeneratorTool"/>
+			<Tool
 				Name="VCWebDeploymentTool"/>
+			<Tool
+				Name="VCManagedWrapperGeneratorTool"/>
+			<Tool
+				Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
 		</Configuration>
 		<Configuration
 			Name="Debug|Win32"
@@ -97,11 +103,11 @@
 				Name="VCLinkerTool"
 				AdditionalOptions="/MACHINE:I386"
 				AdditionalDependencies="..\..\lib\icuucd.lib ..\..\lib\iculed.lib"
-				OutputFile="..\..\bin\iculx26d.dll"
+				OutputFile="..\..\bin\iculx28d.dll"
 				LinkIncremental="2"
 				SuppressStartupBanner="TRUE"
 				GenerateDebugInformation="TRUE"
-				ProgramDatabaseFile=".\..\..\lib/iculx26d.pdb"
+				ProgramDatabaseFile=".\..\..\lib/iculx28d.pdb"
 				ImportLibrary="..\..\lib\iculxd.lib"/>
 			<Tool
 				Name="VCMIDLTool"
@@ -123,9 +129,17 @@
 			<Tool
 				Name="VCWebServiceProxyGeneratorTool"/>
 			<Tool
+				Name="VCXMLDataGeneratorTool"/>
+			<Tool
 				Name="VCWebDeploymentTool"/>
+			<Tool
+				Name="VCManagedWrapperGeneratorTool"/>
+			<Tool
+				Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
 		</Configuration>
 	</Configurations>
+	<References>
+	</References>
 	<Files>
 		<Filter
 			Name="Source Files"
@@ -152,17 +166,17 @@
 					Name="Release|Win32">
 					<Tool
 						Name="VCCustomBuildTool"
-						CommandLine="copy  $(InputPath)  ..\..\include\layout
+						CommandLine="copy &quot;$(InputPath)&quot; ..\..\include\layout
 "
-						Outputs="..\..\include\layout\ParagraphLayout.h"/>
+						Outputs="..\..\include\layout\$(InputFileName)"/>
 				</FileConfiguration>
 				<FileConfiguration
 					Name="Debug|Win32">
 					<Tool
 						Name="VCCustomBuildTool"
-						CommandLine="copy  $(InputPath)  ..\..\include\layout
+						CommandLine="copy &quot;$(InputPath)&quot; ..\..\include\layout
 "
-						Outputs="..\..\include\layout\ParagraphLayout.h"/>
+						Outputs="..\..\include\layout\$(InputFileName)"/>
 				</FileConfiguration>
 			</File>
 			<File
@@ -171,17 +185,17 @@
 					Name="Release|Win32">
 					<Tool
 						Name="VCCustomBuildTool"
-						CommandLine="copy  $(InputPath)  ..\..\include\layout
+						CommandLine="copy &quot;$(InputPath)&quot; ..\..\include\layout
 "
-						Outputs="..\..\include\layout\RunArrays.h"/>
+						Outputs="..\..\include\layout\$(InputFileName)"/>
 				</FileConfiguration>
 				<FileConfiguration
 					Name="Debug|Win32">
 					<Tool
 						Name="VCCustomBuildTool"
-						CommandLine="copy  $(InputPath)  ..\..\include\layout
+						CommandLine="copy &quot;$(InputPath)&quot; ..\..\include\layout
 "
-						Outputs="..\..\include\layout\RunArrays.h"/>
+						Outputs="..\..\include\layout\$(InputFileName)"/>
 				</FileConfiguration>
 			</File>
 		</Filter>

--- Utilities.cpp DELETED ---

--- Utilities.h DELETED ---