aspose file tools *
The moose likes Beginning Java and the fly likes Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark ""fonts not found"" Watch ""fonts not found"" New topic
Author

"fonts not found"

bill steve
Greenhorn

Joined: Feb 22, 2011
Posts: 7
I'm trying to use Apache POI to create a spreadsheet, which i will then email to users. My program creates the spreadsheet, then reads a file to fill in the rows, then writes the completed spreadsheet to a file. The environment is unix running on a mainframe. The program works great. I have problems when i try to add formatting. then it fails, and i get a confusing message about it not being able to find "fonts".

here's the line of code that causes the problem.


Workbook wb = new HSSFWorkbook();
......
Sheet sheet = wb.createSheet("Sheet1");
..........

sheet.autoSizeColumn((short)2);

the autoSizeColumn causes the problem. I suppose it needs the Font info to calculate the column size, but it can't find it for some reason. I see a directory in the Java JDK that seems to have font info in it (LucidaTypewriterRegular.ttf, etc).

the error is below.....I'm pretty new to java, so i could be missing something very basic. i hope so.... any ideas of where to research would be highly appreciated.

thanks


java.lang.Error: Probable fatal error:No fonts found.
at sun.font.FontManager.getDefaultPhysicalFont(FontManager.java:1095)
at sun.font.FontManager.initialiseDeferredFont(FontManager.java:966)
at sun.font.FontManager.initialiseDeferredFonts(FontManager.java:791)
at sun.java2d.SunGraphicsEnvironment.loadFonts(SunGraphicsEnvironment.java:432)
at sun.font.FontManager.findFont2D(FontManager.java:1927)
at sun.font.FontManager.getDefaultPhysicalFont(FontManager.java:1078)
at sun.font.FontManager.initialiseDeferredFont(FontManager.java:966)
at sun.font.FontManager.initialiseDeferredFonts(FontManager.java:791)
at sun.java2d.SunGraphicsEnvironment.loadFonts(SunGraphicsEnvironment.java:432)
at sun.font.FontManager.findFont2D(FontManager.java:1927)
at sun.font.FontManager.getDefaultPhysicalFont(FontManager.java:1078)
at sun.font.FontManager.initialiseDeferredFont(FontManager.java:966)
at sun.font.FontManager.initialiseDeferredFonts(FontManager.java:791)
at sun.java2d.SunGraphicsEnvironment.loadFonts(SunGraphicsEnvironment.java:432)
at sun.font.FontManager.findFont2D(FontManager.java:1927)
at sun.font.FontManager.getDefaultPhysicalFont(FontManager.java:1078)
at sun.font.FontManager.initialiseDeferredFont(FontManager.java:966)
at sun.font.FontManager.initialiseDeferredFonts(FontManager.java:791)
at sun.java2d.SunGraphicsEnvironment.loadFonts(SunGraphicsEnvironment.java:432)
at sun.font.FontManager.findFont2D(FontManager.java:1927)
at sun.font.FontManager.getDefaultPhysicalFont(FontManager.java:1078)
at sun.font.FontManager.initialiseDeferredFont(FontManager.java:966)
at sun.font.FontManager.initialiseDeferredFonts(FontManager.java:791)
at sun.java2d.SunGraphicsEnvironment.loadFonts(SunGraphicsEnvironment.java:432)
at sun.font.FontManager.findFont2D(FontManager.java:1927)
at sun.font.FontManager.getDefaultPhysicalFont(FontManager.java:1078)
at sun.font.FontManager.initialiseDeferredFont(FontManager.java:966)
at sun.font.FontManager.findJREDeferredFont(FontManager.java:878)
at sun.font.FontManager.findDeferredFont(FontManager.java:917)
at sun.font.FontManager.findFont2D(FontManager.java:1836)
at sun.font.FontManager.getDefaultPhysicalFont(FontManager.java:1078)
at sun.font.FontManager.initialiseDeferredFont(FontManager.java:966)
at sun.font.FontManager.findJREDeferredFont(FontManager.java:878)
at sun.font.FontManager.findDeferredFont(FontManager.java:917)
at sun.font.FontManager.findFont2D(FontManager.java:1836)
at sun.font.FontManager.getDefaultPhysicalFont(FontManager.java:1078)
at sun.font.FontManager.initialiseDeferredFont(FontManager.java:966)
at sun.font.FontManager.findJREDeferredFont(FontManager.java:878)
at sun.font.FontManager.findDeferredFont(FontManager.java:917)
at sun.font.FontManager.findFont2D(FontManager.java:1836)
at sun.font.FontManager.getDefaultPhysicalFont(FontManager.java:1078)
at sun.font.FontManager.initialiseDeferredFont(FontManager.java:966)
at sun.font.FontManager.findJREDeferredFont(FontManager.java:825)
at sun.font.FontManager.findDeferredFont(FontManager.java:917)
at sun.font.FontManager.findFont2D(FontManager.java:1836)
at sun.font.FontManager.findFont2D(FontManager.java:1797)
at sun.font.FontManager.getDefaultPhysicalFont(FontManager.java:1078)
at sun.font.FontManager.initialiseDeferredFont(FontManager.java:966)
at sun.font.FontManager.initialiseDeferredFonts(FontManager.java:791)
at sun.java2d.SunGraphicsEnvironment.loadFonts(SunGraphicsEnvironment.java:432)
at sun.java2d.SunGraphicsEnvironment.getAllInstalledFonts(SunGraphicsEnvironment.java:526)
at sun.java2d.SunGraphicsEnvironment.getAllFonts(SunGraphicsEnvironment.java:578)
at sun.java2d.HeadlessGraphicsEnvironment.getAllFonts(HeadlessGraphicsEnvironment.java:90)
at SimpleExcel.main(SimpleExcel.java:37)


Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19799
    
  20

Re-posted here with a possibly interesting reply.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: "fonts not found"