Allow add fonts as files instead of input streams #613
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
#612 #608 #405
This is to workaround a createFont JDK bug. This bug has been recently fixed but many users will not be using the latest JDK.
The problem is that
Font.createFont
with an input stream creates a temporary file which is not deleted promptly after use. This PR means that users can now supply fonts to SVG and MathML implementations as files to workaround this bug.This PR is an alternative to #612. That PR worked around the issue by trying to convert the input stream into a temp file and managing it ourselves rather than the JDK. I was a little scared of that solution given security issues with the temp directory (see this bug for example) and some possibility of files not being deleted correctly.
Recommendations (after 1.0.5 is released, very soon):
@font-face
rules as these use an input stream behind the scenes.builder.useFont
methods to add fonts.Font.createFont
is not used.File
variants ofbuilder.useFont
.