Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I think I fixed a text rendering bug. #526

Open
nojinadev opened this issue Aug 27, 2023 · 2 comments
Open

I think I fixed a text rendering bug. #526

nojinadev opened this issue Aug 27, 2023 · 2 comments
Labels
type: bug Existing feature doesn't work correctly

Comments

@nojinadev
Copy link

nojinadev commented Aug 27, 2023

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 nojinadev added the type: bug Existing feature doesn't work correctly label Aug 27, 2023
@nojinadev nojinadev changed the title I think I fix a text rendering bug. I think I fixed a text rendering bug. Aug 27, 2023
@THausherr
Copy link

Please include the affected file.

@Tlanglord
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug Existing feature doesn't work correctly
Projects
None yet
Development

No branches or pull requests

3 participants