Can I use sfntly to draw strings in Graphics2D?

77 views
Skip to first unread message

Kiko Aumond

unread,
Mar 16, 2012, 7:22:02 PM3/16/12
to sfntly-users
Hi

I am extremely new to sfntly. I would like to know if it is possible
to use sfntly to load a Google Web Font and use it to draw a string in
a Graphics2D context. A code snippet would be great. For instance,
I would like to download the Google Web Font Michroma and overlay a
string using the font on a jpeg image. This would be done in a Jetty
web server application.

Thank you in advance
Kiko

Stuart Gill

unread,
Mar 19, 2012, 7:09:19 PM3/19/12
to sfntly...@googlegroups.com
Kiko,

sfntly has no text layout or glyph rendering capabilities. It doesn't do any of the web based font access. It's a library for reading the font file and manipulating the font. So, it won't be able to do what you are asking. There are no plans to ever add these features to sfntly.

Could you use the Google Web Fonts team's API and get the @font-face rule for the font you want, parse that to get the url for the font and the type of the font, stream the font data in, provide that font data to the java.awt.Font class, and then use that Font object in your layout?

Note that sfntly is not from the Google Web Font's team but it is a library used by them to provide their service.

Stuart

Kiko Aumond

unread,
Mar 19, 2012, 8:57:13 PM3/19/12
to sfntly...@googlegroups.com
Thank you for clarifying Gill.  I was under the impression that sfntly had some font visualization capability.  I will look into the Google Web Fonts API as you suggest.

Kiko
Reply all
Reply to author
Forward
0 new messages