# FontRuns Class Reference

The `FontRuns` class associates pointers to `LEFontInstance` objects with runs of text. More...

`#include <RunArrays.h>`

Inheritance diagram for FontRuns:

## Public Member Functions
| FontRuns (const LEFontInstance **fonts, const le_int32 *limits, le_int32 count)
| Construct a `FontRuns` object from pre-existing arrays of fonts and limit indices.
| FontRuns (le_int32 initialCapacity)
| Construct an empty `FontRuns` object.
virtual | ~FontRuns ()
| The destructor; virtual so that subclass destructors are invoked as well.
const LEFontInstance * | getFont (le_int32 run) const
| Get the `LEFontInstance` object assoicated with the given run of text.
le_int32 | add (const LEFontInstance *font, le_int32 limit)
| Add an `LEFontInstance` and limit index pair to the data arrays and return the run index where the data was stored.
virtual UClassID | getDynamicClassID () const
| ICU "poor man's RTTI", returns a UClassID for the actual class.
## Static Public Member Functions
static UClassID | getStaticClassID ()
| ICU "poor man's RTTI", returns a UClassID for this class.
## Protected Member Functions
virtual void | init (le_int32 capacity)
| Create a data array with the given initial size.
virtual void | grow (le_int32 capacity)
| Grow a data array to the given initial size.

## Detailed Description

The `FontRuns` class associates pointers to `LEFontInstance` objects with runs of text.

Stable:
  ICU 3.2

Definition at line 270 of file RunArrays.h.

## Constructor & Destructor Documentation

FontRuns::FontRuns | ( | const LEFontInstance ** | fonts,
|  | const le_int32 * | limits,
|  | le_int32 | count |
| ) |  |  | `[inline]`

Construct a `FontRuns` object from pre-existing arrays of fonts and limit indices.

Parameters:

  | fonts | is the address of an array of pointers to `LEFontInstance` objects. This array, and the `LEFontInstance` objects to which it points must remain valid until the `FontRuns` object is destroyed.
  | limits | is the address of an array of limit indices. This array must remain valid until the `FontRuns` object is destroyed.
  | count | is the number of entries in the two arrays.

Stable:
  ICU 3.2

Definition at line 395 of file RunArrays.h.

References FontRuns().

Referenced by FontRuns().

FontRuns::FontRuns | ( | le_int32 | initialCapacity | ) |

Construct an empty `FontRuns` object.

Clients can add font and limit indices arrays using the `add` method.

Parameters:

  | initialCapacity | is the initial size of the font and limit indices arrays. If this value is zero, no arrays will be allocated.

See also:
  add

Stable:
  ICU 3.2

virtual FontRuns::~FontRuns | ( |  | ) | `[virtual]`

The destructor; virtual so that subclass destructors are invoked as well.

Stable:
  ICU 3.2

## Member Function Documentation

le_int32 FontRuns::add | ( | const LEFontInstance * | font,
|  | le_int32 | limit |
| ) |  |  |

Add an `LEFontInstance` and limit index pair to the data arrays and return the run index where the data was stored.

This method calls `RunArray::add(limit)` which will create or grow the arrays as needed.

If the `FontRuns` object was created with a client-supplied font and limit indices arrays, this method will return a run index of -1.

Subclasses should not override this method. Rather they should provide a new `add` method which takes a font and a limit index along with whatever other data they implement. The new `add` 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.

Parameters:

  | font | is the address of the `LEFontInstance` to add. This object must remain valid until the `FontRuns` object is destroyed.
  | limit | is the limit index to add

Returns:
  the run index where the font and limit index were stored, or -1 if the data cannot be stored.

Stable:
  ICU 3.2

virtual UClassID FontRuns::getDynamicClassID | ( | void |  | ) | const`[inline, virtual]`

ICU "poor man's RTTI", returns a UClassID for the actual class.

Stable:
  ICU 3.2

Reimplemented from RunArray.

Definition at line 362 of file RunArrays.h.

References RunArray::getStaticClassID().

const LEFontInstance* FontRuns::getFont | ( | le_int32 | run | ) | const

Get the `LEFontInstance` object assoicated with the given run of text.

Use `RunArray::getLimit(run)` to get the corresponding limit index.

Parameters:

  | run | is the index into the font and limit indices arrays.

Returns:
  the `LEFontInstance` associated with the given text run.

See also:
  RunArray::getLimit

Stable:
  ICU 3.2

static UClassID FontRuns::getStaticClassID | ( | void |  | ) | `[inline, static]`

ICU "poor man's RTTI", returns a UClassID for this class.

Stable:
  ICU 3.2

Reimplemented from RunArray.

Definition at line 355 of file RunArrays.h.

virtual void FontRuns::grow | ( | le_int32 | capacity | ) | `[protected, virtual]`

Grow a data array to the given initial size.

This method will be called by the `add` method if the limit indices array is full. Subclasses which override this method must also call it from the overriding method to grow the limit indices array.

Parameters:

  | capacity | is the initial size of the data array.

See also:
  add

Stable:
  ICU 3.2

Reimplemented from RunArray.

virtual void FontRuns::init | ( | le_int32 | capacity | ) | `[protected, virtual]`

Create a data array with the given initial size.

This method will be called by the `add` method if there is no limit indices array. Subclasses which override this method must also call it from the overriding method to create the limit indices array.

Parameters:

  | capacity | is the initial size of the data array.

See also:
  add

Stable:
  ICU 3.2

Reimplemented from RunArray.

The documentation for this class was generated from the following file:

- RunArrays.h

All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Defines