[jira] [Commented] (FOP-3314) SVGUtil#formatMptArrayToPt doesn't actually convert milli-point to point
"Jonas Morrissey (Jira)" <[email protected]> Thu, 14 May 2026 16:12:00 +0000 (UTC)
| Newsgroups | gmane.text.xml.fop.devel |
|---|---|
| Message-ID | <[email protected]> |
[ https://issues.apache.org/jira/browse/FOP-3314?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18080935#comment-18080935 ]
Jonas Morrissey commented on FOP-3314:
--------------------------------------
Hi [~ssteiner] , I added a reproducing example. In fact, any text with a font using kerning should make the problem obvious.
But in trying to reproduce it outside of our own application, I noticed that by default the SVGDocumentHandler loads all fonts *_without_* kerning infos. So the issue won't ever occur.
I only noticed the bug because we use the SVGDocumentHandler with a "custom" configurator. Actually just the default configurator:
{code:java}
public class SVGDocumentHandlerWithConfigurator extends SVGDocumentHandler {
private final IFDocumentHandlerConfigurator configurator;
public SVGDocumentHandlerWithConfigurator(IFContext context, RendererConfig.RendererConfigParser rendererConfigParser) { super(requireNonNull(context));
this.configurator = new DefaultRendererConfigurator(requireNonNull(context.getUserAgent()), requireNonNull(rendererConfigParser)); }
}
{code}
But if a user doesn't set a configurator, then In IFUtil#setupFonts we will run into documentHandler.setDefaultFontInfo(fontInfo), which delegates to AbstractSVGDocumentHandler#setDefaultFontInfo which builds a FontInfo object calling
{code:java}
FontInfo fi = Java2DUtil.buildDefaultJava2DBasedFontInfo(fontInfo, getUserAgent());{code}
And for the return value of this call, fi.getFonts().entrySet().stream().filter(it -> it.getValue().hasKerningInfo()).collect(Collectors.toList()) will always be empty.
I'm not sure if this is intended behaviour.
> SVGUtil#formatMptArrayToPt doesn't actually convert milli-point to point
> ------------------------------------------------------------------------
>
> Key: FOP-3314
> URL: https://issues.apache.org/jira/browse/FOP-3314
> Project: FOP
> Issue Type: Bug
> Components: renderer/svg
> Affects Versions: 2.11
> Reporter: Jonas Morrissey
> Priority: Minor
> Attachments: reproRed.fo
>
>
> SVGUtil#formatMptArrayToPt(int[]) is documented as formatting lengths in millipoints as point values, but the current implementation simply converts an int[] into a String[]:
> {code:java}
> public static String formatMptArrayToPt(int[] lengths) {
> return IFUtil.toString(lengths);
> } {code}
> without also dividing each entry by 1000.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)