Package com.itextpdf.text.pdf
Class BidiLine
- java.lang.Object
-
- com.itextpdf.text.pdf.BidiLine
-
public class BidiLine extends java.lang.ObjectDoes all the line bidirectional processing with PdfChunk assembly.
-
-
Field Summary
Fields Modifier and Type Field Description protected intarabicOptionsprotected java.util.ArrayList<PdfChunk>chunksprotected intcurrentCharprotected PdfChunk[]detailChunksprotected int[]indexCharsprotected intindexChunkprotected intindexChunkCharprotected booleanisWordSplitprotected static IntHashtablemirrorCharsprotected byte[]orderLevelsprotected intpieceSizeprotected intrunDirectionprotected booleanshortStoreprotected intstoredCurrentCharprotected PdfChunk[]storedDetailChunksprotected int[]storedIndexCharsprotected intstoredIndexChunkprotected intstoredIndexChunkCharprotected byte[]storedOrderLevelsprotected intstoredRunDirectionprotected char[]storedTextprotected intstoredTotalTextLengthprotected char[]textprotected inttotalTextLength
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddChunk(PdfChunk chunk)voidaddChunks(java.util.ArrayList<PdfChunk> chunks)voidaddPiece(char c, PdfChunk chunk)voidclearChunks()java.util.ArrayList<PdfChunk>createArrayOfPdfChunks(int startIdx, int endIdx)java.util.ArrayList<PdfChunk>createArrayOfPdfChunks(int startIdx, int endIdx, PdfChunk extraPdfChunk)voiddoArabicShapping()voidflip(int start, int end)booleangetParagraph(int runDirection)floatgetWidth(int startIdx, int lastIdx)Gets the width of a range of characters.floatgetWidth(int startIdx, int lastIdx, float originalWidth)Gets the width of a range of characters.int[]getWord(int startIdx, int idx)booleanisEmpty()booleanisWordSplit()Call this after processLine() to know if any word was split into several lines.static booleanisWS(char c)voidmirrorGlyphs()PdfLineprocessLine(float leftX, float width, int alignment, int runDirection, int arabicOptions, float minY, float yLine, float descender)static java.lang.StringprocessLTR(java.lang.String s, int runDirection, int arabicOptions)Method that changes a String with Arabic characters into a String in which the ligatures are made.private floatprocessTabStop(TabStop tabStop, float tabPosition, float originalWidth, float width, float tabStopAnchorPosition, boolean isRTL, java.util.List<TabStop> rtlTabsToBeAligned)voidreorder(int start, int end)voidrestore()voidsave()inttrimLeft(int startIdx, int endIdx)inttrimLeftEx(int startIdx, int endIdx)inttrimRight(int startIdx, int endIdx)inttrimRightEx(int startIdx, int endIdx)
-
-
-
Field Detail
-
runDirection
protected int runDirection
-
pieceSize
protected int pieceSize
-
text
protected char[] text
-
detailChunks
protected PdfChunk[] detailChunks
-
totalTextLength
protected int totalTextLength
-
orderLevels
protected byte[] orderLevels
-
indexChars
protected int[] indexChars
-
chunks
protected java.util.ArrayList<PdfChunk> chunks
-
indexChunk
protected int indexChunk
-
indexChunkChar
protected int indexChunkChar
-
currentChar
protected int currentChar
-
storedRunDirection
protected int storedRunDirection
-
storedText
protected char[] storedText
-
storedDetailChunks
protected PdfChunk[] storedDetailChunks
-
storedTotalTextLength
protected int storedTotalTextLength
-
storedOrderLevels
protected byte[] storedOrderLevels
-
storedIndexChars
protected int[] storedIndexChars
-
storedIndexChunk
protected int storedIndexChunk
-
storedIndexChunkChar
protected int storedIndexChunkChar
-
storedCurrentChar
protected int storedCurrentChar
-
isWordSplit
protected boolean isWordSplit
-
shortStore
protected boolean shortStore
-
mirrorChars
protected static final IntHashtable mirrorChars
-
arabicOptions
protected int arabicOptions
-
-
Constructor Detail
-
BidiLine
public BidiLine()
Creates new BidiLine
-
BidiLine
public BidiLine(BidiLine org)
-
-
Method Detail
-
isEmpty
public boolean isEmpty()
-
clearChunks
public void clearChunks()
-
getParagraph
public boolean getParagraph(int runDirection)
-
addChunk
public void addChunk(PdfChunk chunk)
-
addChunks
public void addChunks(java.util.ArrayList<PdfChunk> chunks)
-
addPiece
public void addPiece(char c, PdfChunk chunk)
-
save
public void save()
-
restore
public void restore()
-
mirrorGlyphs
public void mirrorGlyphs()
-
doArabicShapping
public void doArabicShapping()
-
processLine
public PdfLine processLine(float leftX, float width, int alignment, int runDirection, int arabicOptions, float minY, float yLine, float descender)
-
processTabStop
private float processTabStop(TabStop tabStop, float tabPosition, float originalWidth, float width, float tabStopAnchorPosition, boolean isRTL, java.util.List<TabStop> rtlTabsToBeAligned)
-
isWordSplit
public boolean isWordSplit()
Call this after processLine() to know if any word was split into several lines.- Returns:
-
getWidth
public float getWidth(int startIdx, int lastIdx)Gets the width of a range of characters.- Parameters:
startIdx- the first index to calculatelastIdx- the last inclusive index to calculate- Returns:
- the sum of all widths
-
getWidth
public float getWidth(int startIdx, int lastIdx, float originalWidth)Gets the width of a range of characters.- Parameters:
startIdx- the first index to calculatelastIdx- the last inclusive index to calculateoriginalWidth- the full width of the line. It is used in case of RTL and tab stops- Returns:
- the sum of all widths
-
createArrayOfPdfChunks
public java.util.ArrayList<PdfChunk> createArrayOfPdfChunks(int startIdx, int endIdx)
-
createArrayOfPdfChunks
public java.util.ArrayList<PdfChunk> createArrayOfPdfChunks(int startIdx, int endIdx, PdfChunk extraPdfChunk)
-
getWord
public int[] getWord(int startIdx, int idx)
-
trimRight
public int trimRight(int startIdx, int endIdx)
-
trimLeft
public int trimLeft(int startIdx, int endIdx)
-
trimRightEx
public int trimRightEx(int startIdx, int endIdx)
-
trimLeftEx
public int trimLeftEx(int startIdx, int endIdx)
-
reorder
public void reorder(int start, int end)
-
flip
public void flip(int start, int end)
-
isWS
public static boolean isWS(char c)
-
processLTR
public static java.lang.String processLTR(java.lang.String s, int runDirection, int arabicOptions)Method that changes a String with Arabic characters into a String in which the ligatures are made.- Parameters:
s- the original StringrunDirection-arabicOptions-- Returns:
- the String with the ligatures
-
-