A discussion forum for JFreeSVG (a fast, lightweight, SVG generator for the Java platform).
-
remiohead
- Posts: 201
- Joined: Fri Oct 02, 2009 3:53 pm
- antibot: No, of course not.
Post
by remiohead » Thu Jul 31, 2014 9:46 pm
Running JFreeSVG on AWS/OpenJDK 1.7.0_51 and the text measuring appears to be off quite a bit (see the left chart in the image above). The chart on the right was generated on my Windows development machine running identical code.
My first thought was the font (Arial) was not installed on the AWS instance. This turned out to be the case so I installed the MS Core Fonts and verified that Java can see them. It did not fix the measuring problem, however.
Any ideas what might be wrong here?
-
david.gilbert
- JFreeChart Project Leader
- Posts: 11734
- Joined: Fri Mar 14, 2003 10:29 am
- antibot: No, of course not.
-
Contact:
Post
by david.gilbert » Thu Jul 31, 2014 10:14 pm
It certainly looks like it is measuring with a different font. One thing to try would be to set this rendering hint (new in version 2.0):
Code: Select all
g2.setRenderingHint(SVGHints.KEY_DRAW_STRING_TYPE, SVGHints.VALUE_DRAW_STRING_TYPE_VECTOR);
It will take the font that is available on the server and, instead of writing text as characters it will fill the outlines of the individual glyphs. This will result in a large(r) SVG file, but it should make it easy to see if the wrong font is being picked up on the server.
-
remiohead
- Posts: 201
- Joined: Fri Oct 02, 2009 3:53 pm
- antibot: No, of course not.
Post
by remiohead » Fri Aug 01, 2014 7:46 pm
JFreeSVG 2.0 is a big improvement. The vector option did confirm the correct font is being used but we can't use that as the text needs to be selectable for copy/paste.
I'll update the thread if I figure out a solution.