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

Java2D - Ability to add fonts via code and manual test harness. #450

Merged
merged 5 commits into from
Mar 4, 2020

Conversation

danfickle
Copy link
Owner

@danfickle danfickle commented Mar 2, 2020

The manual tests can be run from:
openhtmltopdf-examples\src\main\java\com\openhtmltopdf\testcases\j2d\Java2DVisualTest.java

These tests are manual because Java2D rendering is not pixel identical across JREs, OSs, etc.

IF a test fails it will output an actual image, expected image and diff image at:
working-directory\target\test\visual-tests\test-output\j2d. The working directory will usually be the openhtmltopdf-examples module directory. If not there, check the parent directory as well.

From the diff image you will be able to work out if there is a bug in this library, or just a minor rendering difference by the JRE.

NOTE: Change to default behavior: Java2D will no longer pull in local machine fonts by default. To return to the previous behavior:

builder.useEnvironmentFonts(true);

Otherwise, you should provide at least one font and use it on the body tag.

This change is to avoid differing behavior on development machine vs server.

With some refactoring of PDF test harness to share code.
Also reduced anti-alias threshold from 25 to 7. This makes text readable.

With test.
Environment fonts were disabled by default in the last commit to avoid variable results among different machines. They can be re-enabled with:

builder.useEnvironmentFonts(true);
@ieugen
Copy link
Contributor

ieugen commented Mar 2, 2020

I think this is a good move. Will make things reproducible and less dependent on environment. Looking forward to it.

I should know by now not to resolve conflicts with the web interface.
@danfickle danfickle merged commit 9fa3322 into open-dev-v1 Mar 4, 2020
@danfickle danfickle deleted the better_java2d branch March 4, 2020 05:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants