Bug with fonts containing spaces in family name
Bug with fonts containing spaces in family name
When a JFreeChart ist converted to SVG with JFreeSVG, the Font is not found when the resulting document is rendered. When using Batik to create the SVG file from the same JFreeChart object, the font is found. Reason: Batik encloses the font-family name in quotes and JFreeSVG does not. Font family names with spaces will result in font not found with JFreeSVG.
Java 11, JFreeChart 1.0.15, JFreeSVG 4.0
-
- JFreeChart Project Leader
- Posts: 11734
- Joined: Fri Mar 14, 2003 10:29 am
- antibot: No, of course not.
- Contact:
Re: Bug with fonts containing spaces in family name
David Gilbert
JFreeChart Project Leader
Read my blog
Support JFree via the Github sponsorship program
JFreeChart Project Leader


-
- JFreeChart Project Leader
- Posts: 11734
- Joined: Fri Mar 14, 2003 10:29 am
- antibot: No, of course not.
- Contact:
Re: Bug with fonts containing spaces in family name
I was just trying this out, and I don't get any issue in Chrome, Safari or Firefox on a Mac. Which browser gives you the font not found error? Or is it some other SVG viewer?
David Gilbert
JFreeChart Project Leader
Read my blog
Support JFree via the Github sponsorship program
JFreeChart Project Leader


Re: Bug with fonts containing spaces in family name
It is generating a PDF with Apache FOP. We usually generate the SVgs (that are referenced in the XSLs) with Batik. Batik generates code like this:
and JFreeSVG generates:
The problem is the font name "78bcfc3c15c0b3bc - subset of LuminSans Std Reg" that contains spaces. This leads to "font not found error" when Apache FOP generates the final PDF from the XSl/XML/SVG As you can see: Batik (above) encloses the font name in quotes, JFreeSVG does not. The problem only occurs with fonts that have such names with spaces and special characters.
Code: Select all
<g style="font-size:6px; fill:rgb(0,224,163); text-rendering:geometricPrecision; font-family:'78bcfc3c15c0b3bc - subset of LuminSans Std Reg'; stroke-linejoin:bevel; shape-rendering:crispEdges; stroke:rgb(0,224,163);">
Code: Select all
<g ><text x="134.04" y="173.46" style="fill: rgb(0,0,0); fill-opacity: 1.0; font-family: 78bcfc3c15c0b3bc - subset of LuminSans Std Reg; font-size: 6px;" clip-path="url(#_2993957146285518clip-0)">
Java 11, JFreeChart 1.0.15, JFreeSVG 4.0