-
Notifications
You must be signed in to change notification settings - Fork 36
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Fonts flipped upside down when embedded in the PDF #48
Comments
I've not come across that one. It does remind me a bit about this fix (which has never made it into the official version IIRC) - worth trying! |
Thank you for your suggestion. I already came across that patch when looking for solutions, and applied it, but unfortunately it didn't fix the issue. |
We use a fork of http://java.freehep.org/svn/repos/freehep/list/freehep/branches/vectorgraphics-emfplus/?revision=HEAD with a few patches applied. It's available here: https://github.com/geogebra/geogebra/tree/master/desktop/src/main/java/org/freehep and it works well for use so worth a try maybe? Also worth adding in the ticket which exact font(s) you have the problem with - maybe there's something unusual about them |
The issue has arisen first when using a "3 of 9 Barcode" font. The font is vertically symmetrical, so it was not easy to spot the problem, but it was printing in the wrong location (as it was flipped). I tried other TTFs, such as Consolas, and it also printed mirrored I've downloaded your fork, will give it a go and get back to you with feedback. |
When embedding fonts in the PDF, setting PDFGraphics2D.EMBED_FONTS to true, they get flipped upside down. After testing (I'm not competent in Java Graphics), I found the protected void writeString(String str, double x, double y) method in the PDFGraphics2D.java source in the freehep-graphicsio-pdf project to be the cause.
The line
// mirror the matrix
at.scale(1, -1);
seems to do the flipping, which works fine for non-ebedded fonts, but scales embedded fonts upside down.
I've modified that line that nows is:
// mirror the matrix
if (PDFFontIncluder.isStandardFont(getFont()))
at.scale(1, -1);
and from initial testing it seems to be working.
Has anybody experienced the issue, and has any clue as to how to effectively solve it correctly?
The text was updated successfully, but these errors were encountered: