Class Kashida

All Implemented Interfaces:

public class Kashida extends Object implements 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 Details

    • text

      public final String 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

      public int compareTo(Kashida o)
      Specified by:
      compareTo in interface Comparable<Kashida>
    • find

      public static boolean find(String text, int index, List<Kashida> list)
      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.
      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.
      text - the original text
      index - the original index, which must be the same as passed into find(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 text
      difference - 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.
      the modified text. The difference can then be adjusted by kashidaWidth * (text.length()-oldtext.length())