danfickle / danfickle/openhtmltopdf

SVGs do not use custom fonts included with `useFont(FSSupplier<InputStream> supplier, ...)`

Open
#937 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
2.2k
Forks
423
PR merge metrics
No merged PRs in 30d

Description

The issue seems to be the `font.fontFile != null` check at [in PdfRendererBuilder](https://github.com/danfickle/openhtmltopdf/blob/780ba564839f1ad5abfa5df12e4aebb9dd6782d2/openhtmltopdf-pdfbox/src/main/java/com/openhtmltopdf/pdfboxout/PdfRendererBuilder.java#L79):
```
if (state._svgImpl != null &&
font.fontFile != null &&
font.usedFor.contains(FSFontUseCase.SVG)) {
try {
state._svgImpl.addFontFile(font.fontFile, font.family, font.weight, font.style);
} catch (IOException | FontFormatException e) {
XRLog.log(Level.WARNING, LogMessageId.LogMessageId1Param.INIT_FONT_COULD_NOT_BE_LOADED, font.fontFile.getPath(), e);
}
}
```

I'd like for fonts to be usable in SVGs even if they are supplied via input stream (rather than by file).

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.