Package org.faceless.publisher.output
Class Kashida
java.lang.Object
org.faceless.publisher.output.Kashida
- All Implemented Interfaces:
Comparable<Kashida>
Represents a means of Kashida justification that is completely independent
from the way the underlying text is stored. The process works like so:
1. Call "find" on each String on the line
2. Sort the list populated by find
3. Apply the List in order until the available difference has gone.
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic String
Apply the list of Kashidas to the specified String by inserting Tatweels (U+0640) at appropriate points and returning the modified String.int
static boolean
Search the specified text for possible Kashida insertion points and add them to the list.
-
Field Details
-
text
-
wordStart
public final int wordStart -
wordEnd
public final int wordEnd -
wordCount
public final int wordCount -
rule
public final int rule -
index
public final int index -
pos
public final int pos -
min
public final int min
-
-
Method Details
-
compareTo
- Specified by:
compareTo
in interfaceComparable<Kashida>
-
find
Search the specified text for possible Kashida insertion points and add them to the list. The index represents the position in display order of the text on the line, 0 for left-most.- Returns:
- true if any kashida points were found
-
apply
public static String apply(String text, int index, float kashidaWidth, float difference, List<Kashida> list) Apply the list of Kashidas to the specified String by inserting Tatweels (U+0640) at appropriate points and returning the modified String.- Parameters:
text
- the original textindex
- the original index, which must be the same as passed intofind(java.lang.String, int, java.util.List<org.faceless.publisher.output.Kashida>)
kashidaWidth
- the width of the U+0640 character in the font used for this textdifference
- the amount of space we are trying to fill with kashidas.ilst
- the sorted list of Kashida opportunities, which may not all apply to this text.- Returns:
- the modified text. The difference can then be adjusted by
kashidaWidth * (text.length()-oldtext.length())
-