Unified Typesetting API M1-20040817

de.inghuimische.uta
Interface Item

All Known Implementing Classes:
AbstractItem

public interface Item

An item is the unit a linebreak algorithm has to deal with. A linebreak algorithm does not look inside an item. Linebreaks are allowed behind every item.

An item can occur in four different places in a line

  1. standalone in a line without any neighbour item
  2. at the start of a line, followed by another item
  3. within a line, prefixed and followed by another item
  4. at the end of a line, prefixed by another item.
The width of an item may vary depending on its position.

Until the final line break takes place an item has the four different states mentioned above. After the linebreaks are calculated the setPosition(int) method is called which returns the Justifiables contained within the item. Those Justifiables get justified. An item keeps track which of the Boxes it represents are already processed. A box is processed if the next following justifiable is processed or if there are now further boxes to process. In the latter case the item is fully processed. Processed boxes are forwarded to the item listener.

The width of an item may be negative, also there is no need for it, therefore negative values are deprecated. If negative values seem to be neccessary think if the script used can use those values within an item (e.g. negative values may be useful with kerning and ligatures).

Author:
Christian Ziesemer

Field Summary
static boolean DENSITY_END
          Used when the density of the trailing character is requested.
static boolean DENSITY_START
          Used when the density of the leading character is requested.
static int POSTBREAK
          Used when an item appears after a line break or at the end of a paragraph.
static int PREBREAK
          Used when an item appears before a line break or at the start of a paragraph.
static int STANDALONE
          Used when an item appears alone in a line.
static int SURROUNDED
          Used when an item appears between two other items.
 
Method Summary
 List getBoxes()
          Returns a list of boxes contained in this item.
 double getBreakPenalty()
          Specifies the penalty for breaking after this item.
 List getInnerEmbeddingLevels()
          Returns the embedding levels contained within or an empty list if there are none.
 double getOpticalDensity(boolean startOrEnd, int itemPosition)
          Returns the optical density of the item which is either the density of the leading or trailing character.
 int getPosition()
          Returns the position of the item within the line.
 Width getWidth(int itemPos)
          Returns the width of the item for the given position.
 List setPosition(int finalPosition)
          Sets the final position of the item and returns a list of Justifiables contained in this item.
 

Field Detail

SURROUNDED

public static final int SURROUNDED
Used when an item appears between two other items.

See Also:
Constant Field Values

PREBREAK

public static final int PREBREAK
Used when an item appears before a line break or at the start of a paragraph.

See Also:
Constant Field Values

POSTBREAK

public static final int POSTBREAK
Used when an item appears after a line break or at the end of a paragraph.

See Also:
Constant Field Values

STANDALONE

public static final int STANDALONE
Used when an item appears alone in a line. Equal to PREBREAK | POSTBREAK.

See Also:
Constant Field Values

DENSITY_START

public static final boolean DENSITY_START
Used when the density of the leading character is requested.

See Also:
Constant Field Values

DENSITY_END

public static final boolean DENSITY_END
Used when the density of the trailing character is requested.

See Also:
Constant Field Values
Method Detail

getWidth

public Width getWidth(int itemPos)
Returns the width of the item for the given position.

See Also:
STANDALONE, PREBREAK, POSTBREAK, SURROUNDED

getBreakPenalty

public double getBreakPenalty()
Specifies the penalty for breaking after this item.


getOpticalDensity

public double getOpticalDensity(boolean startOrEnd,
                                int itemPosition)
Returns the optical density of the item which is either the density of the leading or trailing character. This value can be seen as a medium grey value of the character.

Most implementations will return a negative value here until they want to with optical justification. Currently UTA provides no method, not even a definition for the optical density of a glyph. Of course, a hyphen is expected to have a lower density than an 'a'.

Parameters:
startOrEnd - Specifies whether the leading or trailing character of the item is of interest.
itemPosition - The position within the line.
Returns:
A value specifing the medium grey value of the requested character or -1 if the feature is not supported.

setPosition

public List setPosition(int finalPosition)
Sets the final position of the item and returns a list of Justifiables contained in this item. This method has to be called after the optimal line breaks are calculated and when justification has to take place.

Returns:
A list of Justifiables contained in this item.

getPosition

public int getPosition()
Returns the position of the item within the line.

Returns:
The position of the item within the line.

getBoxes

public List getBoxes()
Returns a list of boxes contained in this item.

Returns:
A list of boxes contained in this item.

getInnerEmbeddingLevels

public List getInnerEmbeddingLevels()
Returns the embedding levels contained within or an empty list if there are none.

Returns:
The embedding levels contained within or an empty list if there are none.

Unified Typesetting API M1-20040817


An inghuimische.de project.
Copyright (C) 2004 Christian Ziesemer; See the Mozilla Public License for more details.