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

Embedded SVG fonts don't seem to register correctly #20

Open
arlith opened this issue May 19, 2017 · 2 comments
Open

Embedded SVG fonts don't seem to register correctly #20

arlith opened this issue May 19, 2017 · 2 comments

Comments

@arlith
Copy link
Contributor

arlith commented May 19, 2017

Font.loaderEndElement calls Universe.registerFont. Universe keeps a map of font face names that map to Font instances. However, at the time Font.loader.EndElement is called, FontFace.build has not been called, which means that FontFace.fontFamily will be null. This means that any <font> tags in the SVG will get registered in the Universe with a key value of null.

As far as I can tell, this makes it so no <font> tags will ever get used properly.

@mgiorgino
Copy link

Same problem for me. Did you find a workaround ?

@arlith
Copy link
Contributor Author

arlith commented Jun 15, 2017

I did not find a way to get embedded SVG fonts to work (the <font> tag). I ended up using SVGSalamander's FontSystem class. If you look at line 283 of Text.java, if the Universe doesn't know about the requested font-family, it will call FontSystem.createFont(4). Ultimately, this can end up using a java.awt.Font that the JVM knows about.

However, I did find that SVGSalamander uses ints in the MissingGlyph class to store the bounding volume of the glyph for an individual character. Depending on the font you use, this can cause kerning issues. I created a PR to fix this issue (#21).

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

2 participants