diff --git a/icu4c/source/layout/LEFontInstance.cpp b/icu4c/source/layout/LEFontInstance.cpp
index c522274bd4..31641718f1 100644
--- a/icu4c/source/layout/LEFontInstance.cpp
+++ b/icu4c/source/layout/LEFontInstance.cpp
@@ -19,19 +19,19 @@ U_NAMESPACE_BEGIN
const char LEFontInstance::fgClassID=0;
-const LEFontInstance *LEFontInstance::getSubFont(const LEUnicode chars[], le_int32 *start, le_int32 limit,
+const LEFontInstance *LEFontInstance::getSubFont(const LEUnicode chars[], le_int32 *offset, le_int32 limit,
le_int32 script, LEErrorCode &success) const
{
- if (LE_FAILURE(success)) {
- return NULL;
- }
+ if (LE_FAILURE(success)) {
+ return NULL;
+ }
- if (chars == NULL || *start < 0 || limit < 0 || *start >= limit || script < 0 || script >= scriptCodeCount) {
- success = LE_ILLEGAL_ARGUMENT_ERROR;
- return NULL;
- }
+ if (chars == NULL || *offset < 0 || limit < 0 || *offset >= limit || script < 0 || script >= scriptCodeCount) {
+ success = LE_ILLEGAL_ARGUMENT_ERROR;
+ return NULL;
+ }
- *start = limit;
+ *offset = limit;
return this;
}
diff --git a/icu4c/source/layout/LEFontInstance.h b/icu4c/source/layout/LEFontInstance.h
index 90c71d99fd..53c71cd5a8 100644
--- a/icu4c/source/layout/LEFontInstance.h
+++ b/icu4c/source/layout/LEFontInstance.h
@@ -1,6 +1,6 @@
/*
- * @(#)LEFontInstance.h 1.3 00/03/15
+ * @(#)LEFontInstance.h 1.3 00/03/15
*
* (C) Copyright IBM Corp. 1998, 1999, 2000, 2001, 2002 - All Rights Reserved
*
@@ -44,7 +44,7 @@ public:
};
/**
- * This is a virtual base class that servers as the interface between a LayoutEngine
+ * This is a virtual base class that serves as the interface between a LayoutEngine
* and the platform font environment. It allows a LayoutEngine to access font tables, do
* character to glyph mapping, and obtain metrics information without knowing any platform
* specific details. There are also a few utility methods for converting between points,
@@ -61,7 +61,7 @@ public:
* an LEGlyphID
, an LEUnicode
or an LEUnicode32
* as one of the arguments because these can be used to select a particular subfont.
*
- * Subclasses which implement composite fonts should supply an impelmentation of these
+ * Subclasses which implement composite fonts should supply an implementation of these
* methods with some default behavior such as returning constant values, or using the
* values from the first subfont.
*
@@ -81,46 +81,56 @@ public:
/**
* Get a physical font which can render the given text. For composite fonts,
- * if there is no single physical font which can render all of the text,
- * return a physical font which can render an initial substring of the text,
- * along with the limit offset of that substring.
- *
- * Internally, the LayoutEngine works with runs of text all in the same
- * font and script, so it is best to call this method with text which is
- * in a single script, passing the script code in as a hint. If you don't
- * know the script of the text, you can pass zyyyScriptCode
,
- * which is the script code for characters used in more than one script.
- *
- * The default implementation of this method is intended for instances of
- * LEFontInstance
which represent a physical font. It returns
- * this
and indicates that the entire string can be rendered.
- *
- * Sublcasses which implement composite fonts must override this method.
- * Where it makes sense, they should use the script code as a hint to render
- * characters from the COMMON script in the font which is used for the given
- * script. For example, if the input text is a series of Arabic words separated
- * by spaces, and the script code passed in is arabScriptCode
you
- * should return the font used for Arabic characters for all of the text.
+ * if there is no single physical font which can render all of the text,
+ * return a physical font which can render an initial substring of the text,
+ * and set the offset
parameter to the end of that substring.
+ *
+ * Internally, the LayoutEngine works with runs of text all in the same
+ * font and script, so it is best to call this method with text which is
+ * in a single script, passing the script code in as a hint. If you don't
+ * know the script of the text, you can use zero, which is the script code
+ * for characters used in more than one script.
+ *
+ * The default implementation of this method is intended for instances of
+ * LEFontInstance
which represent a physical font. It returns
+ * this
and indicates that the entire string can be rendered.
+ *
+ * This method will return a valid LEFontInstance
unless you
+ * have passed illegal parameters, or an internal error has been encountered.
+ * For composite fonts, it may return the warning LE_NO_SUBFONT_WARNING
+ * to indicate that the returned font may not be able to render all of
+ * the text. Whenever a valid font is returned, the offset
parameter
+ * will be advanced by at least one.
+ *
+ * Subclasses which implement composite fonts must override this method.
+ * Where it makes sense, they should use the script code as a hint to render
+ * characters from the COMMON script in the font which is used for the given
+ * script. For example, if the input text is a series of Arabic words separated
+ * by spaces, and the script code passed in is arabScriptCode
you
+ * should return the font used for Arabic characters for all of the input text,
+ * including the spaces. If, on the other hand, the input text contains characters
+ * which cannot be rendered by the font used for Arabic characters, but which can
+ * be rendered by another font, you should return that font for those characters.
*
* @param chars - the array of Unicode characters.
- * @param start - a pointer to the starting offset in the text. On exit this
- * will be set the the limit offset of the text which can be
- * rendered using the returned font.
+ * @param offset - a pointer to the starting offset in the text. On exit this
+ * will be set the the limit offset of the text which can be
+ * rendered using the returned font.
* @param limit - the limit offset for the input text.
* @param script - the script hint.
* @param success - set to an error code if the arguments are illegal, or no font
* can be returned for some reason. May also be set to
- * LE_NO_SUBFONT_WARNING
if there is no subfont which
- * can render the text.
+ * LE_NO_SUBFONT_WARNING
if the subfont which
+ * was returned cannot render all of the text.
*
* @return an LEFontInstance
for the sub font which can render the characters, or
* NULL
if there is an error.
*
- * @see LEScripts.h
- *
+ * @see LEScripts.h
+ *
* @draft ICU 2.6
*/
- virtual const LEFontInstance *getSubFont(const LEUnicode chars[], le_int32 *start, le_int32 limit, le_int32 script, LEErrorCode &success) const;
+ virtual const LEFontInstance *getSubFont(const LEUnicode chars[], le_int32 *offset, le_int32 limit, le_int32 script, LEErrorCode &success) const;
//
// Font file access
@@ -133,7 +143,7 @@ public:
* getSubFont()
. This is because each subfont in a composite font
* will have different tables, and there's no way to know which subfont to access.
*
- * Sublcasses which represent composite fonts should always return NULL
.
+ * Subclasses which represent composite fonts should always return NULL
.
*
* @param tableTag - the four byte table tag. (e.g. 'cmap')
*
@@ -150,6 +160,10 @@ public:
* by looking the character up in the font's character
* to glyph mapping.
*
+ * The default implementation of this method will return
+ * true
if mapCharToGlyph(ch)
+ * returns a non-zero value.
+ *
* @param ch - the character to be tested
*
* @return true if the font can render ch.
@@ -421,7 +435,8 @@ public:
/**
* Get the font's ascent.
*
- * @return the font's ascent, in points.
+ * @return the font's ascent, in points. This value
+ * will always be positive.
*
* @draft ICU 2.6
*/
@@ -430,7 +445,8 @@ public:
/**
* Get the font's descent.
*
- * @return the font's descent, in points.
+ * @return the font's descent, in points. This value
+ * will always be positive.
*
* @draft ICU 2.6
*/
@@ -439,7 +455,8 @@ public:
/**
* Get the font's leading.
*
- * @return the font's leading, in points.
+ * @return the font's leading, in points. This value
+ * will always be positive.
*
* @draft ICU 2.6
*/
@@ -447,10 +464,11 @@ public:
/**
* Get the line height required to display text in
- * this font. The value returned is just the sum of
- * the ascent, descent, and leading.
+ * this font. The default implementation of this method
+ * returns the sum of the ascent, descent, and leading.
*
- * @return the line height, in points
+ * @return the line height, in points. This vaule will
+ * always be positive.
*
* @draft ICU 2.6
*/
@@ -459,14 +477,14 @@ public:
/**
* ICU "poor man's RTTI", returns a UClassID for the actual class.
*
- * @draft ICU 2.2
+ * @draft ICU 2.6
*/
virtual inline UClassID getDynamicClassID() const { return getStaticClassID(); }
/**
* ICU "poor man's RTTI", returns a UClassID for this class.
*
- * @draft ICU 2.2
+ * @draft ICU 2.6
*/
static inline UClassID getStaticClassID() { return (UClassID)&fgClassID; }
diff --git a/icu4c/source/samples/layout/ScriptCompositeFontInstance.cpp b/icu4c/source/samples/layout/ScriptCompositeFontInstance.cpp
index fe4a51e76c..889711a633 100644
--- a/icu4c/source/samples/layout/ScriptCompositeFontInstance.cpp
+++ b/icu4c/source/samples/layout/ScriptCompositeFontInstance.cpp
@@ -60,13 +60,13 @@ le_bool ScriptCompositeFontInstance::getGlyphPoint(LEGlyphID glyph, le_int32 poi
return false;
}
-const LEFontInstance *ScriptCompositeFontInstance::getSubFont(const LEUnicode chars[], le_int32 *start, le_int32 limit, le_int32 script, LEErrorCode &success) const
+const LEFontInstance *ScriptCompositeFontInstance::getSubFont(const LEUnicode chars[], le_int32 *offset, le_int32 limit, le_int32 script, LEErrorCode &success) const
{
if (LE_FAILURE(success)) {
return NULL;
}
- if (chars == NULL || *start < 0 || limit < 0 || *start >= limit || script < 0 || script >= scriptCodeCount) {
+ if (chars == NULL || *offset < 0 || limit < 0 || *offset >= limit || script < 0 || script >= scriptCodeCount) {
success = LE_ILLEGAL_ARGUMENT_ERROR;
return NULL;
}
@@ -77,7 +77,7 @@ const LEFontInstance *ScriptCompositeFontInstance::getSubFont(const LEUnicode ch
return NULL;
}
- *start = limit;
+ *offset = limit;
return result;
}
diff --git a/icu4c/source/samples/layout/ScriptCompositeFontInstance.h b/icu4c/source/samples/layout/ScriptCompositeFontInstance.h
index b22130e1fe..94e29a222a 100644
--- a/icu4c/source/samples/layout/ScriptCompositeFontInstance.h
+++ b/icu4c/source/samples/layout/ScriptCompositeFontInstance.h
@@ -23,48 +23,58 @@ public:
virtual ~ScriptCompositeFontInstance();
- /**
+ /**
* Get a physical font which can render the given text. For composite fonts,
- * if there is no single physical font which can render all of the text,
- * return a physical font which can render an initial substring of the text,
- * along with the limit offset of that substring.
- *
- * Internally, the LayoutEngine works with runs of text all in the same
- * font and script, so it is best to call this method with text which is
- * in a single script, passing the script code in as a hint. If you don't
- * know the script of the text, you can pass zyyyScriptCode
,
- * which is the script code for characters used in more than one script.
- *
- * The default implementation of this method is intended for instances of
- * LEFontInstance
which represent a physical font. It returns
- * this
and indicates that the entire string can be rendered.
- *
- * Sublcasses which implement composite fonts must override this method.
- * Where it makes sense, they should use the script code as a hint to render
- * characters from the COMMON script in the font which is used for the given
- * script. For example, if the input text is a series of Arabic words separated
- * by spaces, and the script code passed in is arabScriptCode
you
- * should return the font used for Arabic characters for all of the text.
+ * if there is no single physical font which can render all of the text,
+ * return a physical font which can render an initial substring of the text,
+ * and set the offset
parameter to the end of that substring.
+ *
+ * Internally, the LayoutEngine works with runs of text all in the same
+ * font and script, so it is best to call this method with text which is
+ * in a single script, passing the script code in as a hint. If you don't
+ * know the script of the text, you can use zero, which is the script code
+ * for characters used in more than one script.
+ *
+ * The default implementation of this method is intended for instances of
+ * LEFontInstance
which represent a physical font. It returns
+ * this
and indicates that the entire string can be rendered.
+ *
+ * This method will return a valid LEFontInstance
unless you
+ * have passed illegal parameters, or an internal error has been encountered.
+ * For composite fonts, it may return the warning LE_NO_SUBFONT_WARNING
+ * to indicate that the returned font may not be able to render all of
+ * the text. Whenever a valid font is returned, the offset
parameter
+ * will be advanced by at least one.
+ *
+ * Subclasses which implement composite fonts must override this method.
+ * Where it makes sense, they should use the script code as a hint to render
+ * characters from the COMMON script in the font which is used for the given
+ * script. For example, if the input text is a series of Arabic words separated
+ * by spaces, and the script code passed in is arabScriptCode
you
+ * should return the font used for Arabic characters for all of the input text,
+ * including the spaces. If, on the other hand, the input text contains characters
+ * which cannot be rendered by the font used for Arabic characters, but which can
+ * be rendered by another font, you should return that font for those characters.
*
* @param chars - the array of Unicode characters.
- * @param start - a pointer to the starting offset in the text. On exit this
- * will be set the the limit offset of the text which can be
- * rendered using the returned font.
+ * @param offset - a pointer to the starting offset in the text. On exit this
+ * will be set the the limit offset of the text which can be
+ * rendered using the returned font.
* @param limit - the limit offset for the input text.
* @param script - the script hint.
* @param success - set to an error code if the arguments are illegal, or no font
* can be returned for some reason. May also be set to
- * LE_NO_SUBFONT_WARNING
if there is no subfont which
- * can render the text.
+ * LE_NO_SUBFONT_WARNING
if the subfont which
+ * was returned cannot render all of the text.
*
* @return an LEFontInstance
for the sub font which can render the characters, or
* NULL
if there is an error.
*
- * @see LEScripts.h
- *
+ * @see LEScripts.h
+ *
* @draft ICU 2.6
*/
- virtual const LEFontInstance *getSubFont(const LEUnicode chars[], le_int32 *start, le_int32 limit, le_int32 script, LEErrorCode &success) const;
+ virtual const LEFontInstance *getSubFont(const LEUnicode chars[], le_int32 *offset, le_int32 limit, le_int32 script, LEErrorCode &success) const;
/**
* This method maps a single character to a glyph index, using the