[sword-cvs] icu-sword/source/layoutex/layout ParagraphLayout.h,1.1,1.2 RunArrays.h,1.1,1.2

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


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

Modified Files:
	ParagraphLayout.h RunArrays.h 
Log Message:
ICU 2.8 sync

Index: ParagraphLayout.h
===================================================================
RCS file: /cvs/core/icu-sword/source/layoutex/layout/ParagraphLayout.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- ParagraphLayout.h	10 Sep 2003 02:42:27 -0000	1.1
+++ ParagraphLayout.h	6 Apr 2004 10:09:08 -0000	1.2
@@ -103,6 +103,17 @@
          * @draft ICU 2.6
          */
         le_int32 getLeading() const;
+
+		/**
+		 * Get the width of the line. This is a convenience method
+		 * which returns the last X position of the last visual run
+		 * in the line.
+		 *
+		 * @return the width of the line.
+		 *
+		 * @draft ICU 2.8
+		 */
+		le_int32 getWidth() const;
     
         /**
          * Get a <code>ParagraphLayout::VisualRun</code> object for a given
@@ -335,6 +346,9 @@
      *
      * Clients can optionally specify directional runs and / or script runs. If these aren't specified
      * they will be computed.
+	 *
+	 * If any errors are encountered during construction, <code>status</code> will be set, and the object
+	 * will be set to be empty.
      *
      * @param chars is an array of the characters in the paragraph
      *
@@ -356,21 +370,24 @@
      *
      * @param paragraphLevel is the directionality of the paragraph, as in the UBiDi object.
      *
-     * @param vertical is <code>true</code> if the paragraph should be set vertically.
+     * @param vertical is <code>TRUE</code> if the paragraph should be set vertically.
+     *
+	 * @param status will be set to any error code encountered during construction.
      *
      * @see ubidi.h
      * @see LEFontInstance.h
      * @see LayoutEngine.h
      * @see RunArrays.h
      *
-     * @draft ICU 2.6
+     * @draft ICU 2.8
      */
     ParagraphLayout(const LEUnicode chars[], le_int32 count,
                     const FontRuns *fontRuns,
                     const ValueRuns *levelRuns,
                     const ValueRuns *scriptRuns,
                     const LocaleRuns *localeRuns,
-                    UBiDiLevel paragraphLevel, le_bool vertical);
+                    UBiDiLevel paragraphLevel, le_bool vertical,
+					LEErrorCode &status);
 
     /**
      * The destructor. Virtual so that it works correctly with
@@ -395,7 +412,7 @@
      *
      * @param fontRuns is a pointer to a <code>FontRuns</code> object representing the font runs.
      *
-     * @return <code>true</code> if the paragraph contains complex text.
+     * @return <code>TRUE</code> if the paragraph contains complex text.
      *
      * @draft ICU 2.6
      */
@@ -409,7 +426,7 @@
      *
      * @param count is the number of characters in the paragraph.
      *
-     * @return <code>true</code> if any of the text requires complex processing.
+     * @return <code>TRUE</code> if any of the text requires complex processing.
      *
      * @draft ICU 2.6
      */
@@ -547,7 +564,7 @@
 
     void computeLocales();
 
-    void computeSubFonts(const FontRuns *fontRuns);
+    void computeSubFonts(const FontRuns *fontRuns, LEErrorCode &status);
 
     void computeMetrics();
 
@@ -580,7 +597,8 @@
           le_int32 fLeading;
 
           le_int32 *fGlyphToCharMap;
-          le_int32 *fCharToGlyphMap;
+          le_int32 *fCharToMinGlyphMap;
+		  le_int32 *fCharToMaxGlyphMap;
           float    *fGlyphWidths;
           le_int32  fGlyphCount;
 
@@ -697,13 +715,6 @@
       fGlyphs(glyphs), fPositions(positions), fGlyphToCharMap(glyphToCharMap)
 {
     // nothing else needs to be done!
-}
-
-inline ParagraphLayout::VisualRun::~VisualRun()
-{
-    LE_DELETE_ARRAY(fGlyphToCharMap);
-    LE_DELETE_ARRAY(fPositions);
-    LE_DELETE_ARRAY(fGlyphs);
 }
 
 U_NAMESPACE_END

Index: RunArrays.h
===================================================================
RCS file: /cvs/core/icu-sword/source/layoutex/layout/RunArrays.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- RunArrays.h	10 Sep 2003 02:42:27 -0000	1.1
+++ RunArrays.h	6 Apr 2004 10:09:08 -0000	1.2
@@ -47,7 +47,8 @@
      * Construct a <code>RunArray</code> object from a pre-existing
      * array of limit indices.
      *
-     * @param limits is an array of limit indices.
+     * @param limits is an array of limit indices. This array must remain
+	 *               valid until the <code>RunArray</code> object is destroyed.
      *
      * @param count is the number of entries in the limit array.
      *
@@ -204,39 +205,23 @@
 };
 
 inline RunArray::RunArray()
-	: UObject(), fClientArrays(false), fLimits(NULL), fCount(0), fCapacity(0)
+	: UObject(), fClientArrays(FALSE), fLimits(NULL), fCount(0), fCapacity(0)
 {
 	// nothing else to do...
 }
 
 inline RunArray::RunArray(const RunArray & /*other*/)
-	: UObject(), fClientArrays(false), fLimits(NULL), fCount(0), fCapacity(0)
+	: UObject(), fClientArrays(FALSE), fLimits(NULL), fCount(0), fCapacity(0)
 {
 	// nothing else to do...
 }
 
 inline RunArray::RunArray(const le_int32 *limits, le_int32 count)
-    : UObject(), fClientArrays(true), fLimits(limits), fCount(count), fCapacity(count)
+    : UObject(), fClientArrays(TRUE), fLimits(limits), fCount(count), fCapacity(count)
 {
     // nothing else to do...
 }
 
-inline RunArray::RunArray(le_int32 initialCapacity)
-    : fClientArrays(false), fLimits(NULL), fCount(0), fCapacity(initialCapacity)
-{
-    if (initialCapacity > 0) {
-        fLimits = LE_NEW_ARRAY(le_int32, fCapacity);
-    }
-}
-
-inline RunArray::~RunArray()
-{
-    if (! fClientArrays) {
-        LE_DELETE_ARRAY(fLimits);
-        fLimits = NULL;
-    }
-}
-
 inline le_int32 RunArray::getCount() const
 {
     return fCount;
@@ -269,9 +254,12 @@
      * Construct a <code>FontRuns</code> object from pre-existing arrays of fonts
      * and limit indices.
      *
-     * @param fonts is the address of an array of pointers to <code>LEFontInstance</code> objects.
+     * @param fonts is the address of an array of pointers to <code>LEFontInstance</code> objects. This
+	 *              array, and the <code>LEFontInstance</code> objects to which it points must remain
+	 *              valid until the <code>FontRuns</code> object is destroyed.
      *
-     * @param limits is the address of an array of limit indices.
+     * @param limits is the address of an array of limit indices. This array must remain valid until
+	 *               the <code>FontRuns</code> object is destroyed.
      *
      * @param count is the number of entries in the two arrays.
      *
@@ -328,7 +316,8 @@
      * The new <code>add</code> method should first call this method to grow the font and limit indices
      * arrays, and use the returned run index to store data their own arrays.
      *
-     * @param font is the address of the <code>LEFontInstance</code> to add
+     * @param font is the address of the <code>LEFontInstance</code> to add. This object must
+	 *             remain valid until the <code>FontRuns</code> object is destroyed.
      *
      * @param limit is the limit index to add
      *
@@ -389,22 +378,6 @@
     // nothing else to do...
 }
 
-inline FontRuns::FontRuns(le_int32 initialCapacity)
-    : RunArray(initialCapacity), fFonts(NULL)
-{
-    if (initialCapacity > 0) {
-        fFonts = LE_NEW_ARRAY(const LEFontInstance *, initialCapacity);
-    }
-}
-
-inline FontRuns::~FontRuns()
-{
-    if (! fClientArrays) {
-        LE_DELETE_ARRAY(fFonts);
-        fFonts = NULL;
-    }
-}
-
 /**
  * The <code>LocaleRuns</code> class associates pointers to <code>Locale</code>
  * objects with runs of text.
@@ -418,9 +391,12 @@
      * Construct a <code>LocaleRuns</code> object from pre-existing arrays of locales
      * and limit indices.
      *
-     * @param locales is the address of an array of pointers to <code>Locale</code> objects.
+     * @param locales is the address of an array of pointers to <code>Locale</code> objects. This array,
+	 *                and the <code>Locale</code> objects to which it points, must remain valid until
+	 *                the <code>LocaleRuns</code> object is destroyed.
      *
-     * @param limits is the address of an array of limit indices.
+     * @param limits is the address of an array of limit indices. This array must remain valid until the
+	 *               <code>LocaleRuns</code> object is destroyed.
      *
      * @param count is the number of entries in the two arrays.
      *
@@ -477,7 +453,8 @@
      * The new <code>add</code> method should first call this method to grow the font and limit indices
      * arrays, and use the returned run index to store data their own arrays.
      *
-     * @param locale is the address of the <code>Locale</code> to add
+     * @param locale is the address of the <code>Locale</code> to add. This object must remain valid
+	 *               until the <code>LocaleRuns</code> object is destroyed.
      *
      * @param limit is the limit index to add
      *
@@ -538,22 +515,6 @@
     // nothing else to do...
 }
 
-inline LocaleRuns::LocaleRuns(le_int32 initialCapacity)
-    : RunArray(initialCapacity), fLocales(NULL)
-{
-    if (initialCapacity > 0) {
-        fLocales = LE_NEW_ARRAY(const Locale *, initialCapacity);
-    }
-}
-
-inline LocaleRuns::~LocaleRuns()
-{
-    if (! fClientArrays) {
-        LE_DELETE_ARRAY(fLocales);
-        fLocales = NULL;
-    }
-}
-
 /**
  * The <code>ValueRuns</code> class associates integer values with runs of text.
  *
@@ -566,9 +527,11 @@
      * Construct a <code>ValueRuns</code> object from pre-existing arrays of values
      * and limit indices.
      *
-     * @param values is the address of an array of integer.
+     * @param values is the address of an array of integer. This array must remain valid until
+	 *               the <code>ValueRuns</code> object is destroyed.
      *
-     * @param limits is the address of an array of limit indices.
+     * @param limits is the address of an array of limit indices. This array must remain valid until
+	 *               the <code>ValueRuns</code> object is destroyed.
      *
      * @param count is the number of entries in the two arrays.
      *
@@ -684,22 +647,6 @@
     : RunArray(limits, count), fValues(values)
 {
     // nothing else to do...
-}
-
-inline ValueRuns::ValueRuns(le_int32 initialCapacity)
-    : RunArray(initialCapacity), fValues(NULL)
-{
-    if (initialCapacity > 0) {
-        fValues = LE_NEW_ARRAY(le_int32, initialCapacity);
-    }
-}
-
-inline ValueRuns::~ValueRuns()
-{
-    if (! fClientArrays) {
-        LE_DELETE_ARRAY(fValues);
-        fValues = NULL;
-    }
 }
 
 U_NAMESPACE_END