One more followup: the words with 0 kerning that needed space had 'Td' or
new line commands before them that were not working properly. I found
another approach to fix those cases that doesn't introduce space in places
where there is legitimately 0 kerning. The new patch follows. Once again,
I don't know if this is an ideal or even appropriate patch, not knowing the
code deeply, but works in the cases I am testing.
PdfContentStreamProcessor.java
...
public void displayPdfString(PdfString string, float tj){
String unicode = decode(string);
float width = getStringWidth(unicode, tj); // this is width in
unscaled units - we have to normalize by the Tm scaling
+ if(tj < -200){
+ unicode = " ".concat(unicode);
+ }
Matrix nextTextMatrix = new Matrix(width, 0).multiply(textMatrix);
displayText(unicode, nextTextMatrix);
textMatrix = nextTextMatrix;
}
....
private static class TextMoveStartNextLine implements ContentOperator{
public void invoke(PdfContentStreamProcessor processor, PdfLiteral
operator, ArrayList operands) {
float tx = ((PdfNumber)operands.get(0)).floatValue();
float ty = ((PdfNumber)operands.get(1)).floatValue();
Matrix translationMatrix = new Matrix(tx, ty);
+ Matrix oldTest = processor.textMatrix ;
processor.textMatrix =
translationMatrix.multiply(processor.textLineMatrix);
+ processor.textLineMatrix = oldTest;
- processor.textLineMatrix = processor.textMatrix;
}
}
------------------------------------------------------------------------------
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://www.1t3xt.com/docs/book.php
Check the site with examples before you ask questions:
http://www.1t3xt.info/examples/
You can also search the keywords list: http://1t3xt.info/tutorials/keywords/