2

I have a servlet which generates an image. I want to load the font it uses from a TTF file, so that the servlet is not dependent on that font being available on that particular server.

I load the font using java.awt.Font.createFont(). When I test this on my local Glassfish on Mac OS X this works fine, but when I try it on Glassfish on a Linux server I get the following exception:

java.awt.FontFormatException: bad table, tag=1279872591
    at sun.font.TrueTypeFont.init(TrueTypeFont.java:
    at sun.font.TrueTypeFont.<init>(TrueTypeFont.java:162)
    at sun.font.FontManager.createFont2D(FontManager.java:2264)

I was under the impression that the parsing of the TTF file was done entirely in Java, and therefore not platform specific. Is this assumption wrong? Or is there some other reason why this fails?

Kees Kist
  • 2,641
  • 5
  • 20
  • 25
  • 1
    I answered a question like this at this link: http://stackoverflow.com/questions/20584290/what-does-java-awt-fontformatexception-bad-table-tag-1196445523-indicating/33874027#33874027 – Leonardo Pessoa Nov 23 '15 at 15:02

2 Answers2

0

I realise this is an old question, but I had this problem and eventually solved it by overriding the ttf's on the server with the same files from an older release. I guess they must have gotten corrupted or something during a transfer or whatever.

If anyone else comes through here it might be worth trying out the same.

Numeron
  • 8,723
  • 3
  • 21
  • 46
0

On Linux, launching a JVM in a console and using it to access awt or swing components sometimes causes problem because the X11 support is not included. You should try using headless mode to launch the server.

SJuan76
  • 24,532
  • 6
  • 47
  • 87