PdfBox-Android icon indicating copy to clipboard operation
PdfBox-Android copied to clipboard

I think I fixed a text rendering bug.

Open nojinadev opened this issue 1 year ago • 2 comments

in PageDrawer.java --------------------------------------------------------------------

private void drawGlyph2D(Glyph2D glyph2D, PDFont font, int code, Vector displacement, AffineTransform at) throws IOException { PDGraphicsState state = getGraphicsState(); RenderingMode renderingMode = state.getTextState().getRenderingMode();

// Path path = glyph2D.getPathForCharacterCode(code); // -------> this may problem Path path = new Path(glyph2D.getPathForCharacterCode(code)); //-------> fix like this. or better way.


I think

'path.transform(at.toMatrix());' transforms the path within the cache.

As a result, while the first character is rendered correctly, subsequent cached paths are transformed incorrectly, leading to issues.

nojinadev avatar Aug 27 '23 14:08 nojinadev

Please include the affected file.

THausherr avatar Oct 11 '23 11:10 THausherr

Yes, I also found this issue and submitted the pr, but it has not been merged yet

Tlanglord avatar Feb 08 '24 04:02 Tlanglord