| Code with Finding: |
class BidiLine {
public boolean getParagraph(int runDirection) {
this.runDirection = runDirection;
currentChar = 0;
totalTextLength = 0;
boolean hasText = false;
char c;
char uniC;
BaseFont bf;
for (; indexChunk < chunks.size(); ++indexChunk) {
PdfChunk ck = chunks.get(indexChunk);
bf = ck.font().getFont();
String s = ck.toString();
int len = s.length();
for (; indexChunkChar < len; ++indexChunkChar) {
c = s.charAt(indexChunkChar);
uniC = (char)bf.getUnicodeEquivalent(c);
if (uniC == '\r' || uniC == '\n') {
// next condition is never true for CID
if (uniC == '\r' && indexChunkChar + 1 < len && s.charAt(indexChunkChar + 1) == '\n')
++indexChunkChar;
++indexChunkChar;
if (indexChunkChar >= len) {
indexChunkChar = 0;
++indexChunk;
}
hasText = true;
if (totalTextLength == 0)
detailChunks[0] = ck;
break;
}
addPiece(c, ck);
}
if (hasText)
break;
indexChunkChar = 0;
}
if (totalTextLength == 0)
return hasText;
// remove trailing WS
totalTextLength = trimRight(0, totalTextLength - 1) + 1;
if (totalTextLength == 0) {
return true;
}
if (runDirection == PdfWriter.RUN_DIRECTION_LTR || runDirection == PdfWriter.RUN_DIRECTION_RTL) {
if (orderLevels.length < totalTextLength) {
orderLevels = new byte[pieceSize];
indexChars = new int[pieceSize];
}
ArabicLigaturizer.processNumbers(text, 0, totalTextLength, arabicOptions);
BidiOrder order = new BidiOrder(text, 0, totalTextLength, (byte)(runDirection == PdfWriter.RUN_DIRECTION_RTL ? 1 : 0));
byte od[] = order.getLevels();
for (int k = 0; k < totalTextLength; ++k) {
orderLevels[k] = od[k];
indexChars[k] = k;
}
doArabicShapping();
mirrorGlyphs();
}
totalTextLength = trimRightEx(0, totalTextLength - 1) + 1;
return true;
}
}
|