Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

svg font size units #3

Open
miminno opened this issue Jul 7, 2016 · 6 comments
Open

svg font size units #3

miminno opened this issue Jul 7, 2016 · 6 comments

Comments

@miminno
Copy link

miminno commented Jul 7, 2016

Shouldn't the font size for text elements be in points rather than pixels? getSVGFontStyle() prints 'px' for the 'font-size' attribute.

@sladkoff
Copy link

sladkoff commented Jul 25, 2016

I don't think that it should.

It states here that the value of font-size can actually be any of the following:
<absolute-size> | <relative-size> | <length> | <percentage> | inherit

If anything, the font-size unit could be made configurable, I guess.

EDIT: Actually, ignore that. The library is using css styles for the font-size, not the svg attribute. The same applies though, IMO.

EDIT 2: Ha, no, actually, you're right, I didn't know that the size in java.awt.Font is in points.

@miminno
Copy link
Author

miminno commented Jul 29, 2016

Yes, exactly, java.awt.Font is in points and the svg font size should be the same. I should've mentioned that in the original post.

@miminno
Copy link
Author

miminno commented Aug 19, 2016

Bump. Any thoughts on this? Thanks.

@jfree
Copy link
Owner

jfree commented Aug 20, 2016

I think you are correct. I'll do some investigation and change it.

@jfree
Copy link
Owner

jfree commented Aug 20, 2016

In fact, 'px' is working better that 'pt' at the moment because the other dimensions in the SVG are defaulting to 'px' (so everything is consistent, even it not matching the Java2D standard unit size). I'll continue analysing this alongside the viewBox request that is also outstanding.

@miminno
Copy link
Author

miminno commented Nov 4, 2016

For me this causes big issues when exporting the same JFreeChart chart to PDF and SVG. Fonts are different and as a result the whole chart looks different. I'm attaching the sample for comparison here.
I realize that switching from px to pt is not that easy due to all internal calculations that take place, but I hope that perhaps there is some reasonable solution to this.

svgvspdf

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants