Home pageFind It!Contact PJAPJA documentation

PJA

 PJA Toolkit forum

This forum is dedicated to PJA Toolkit.
You may read freely the messages it contents. If you want to write a message or answer to a subject, subscribe to it first.

Subjects Recent messages Login Subscribe

Messages of subject No fonts were found

bohnman

Location : essex jct, vermont, usa
Member since : Aug 4, 2003
Messages : 3
 Aug 4, 2003 at 7:07 PM
I am running into an interesting error. When I envoke my servlet and set my java.awt.font directory I get an error that shuts down tomcat.

Error message:
No fonts were found in 'X:\DOCUMENTATION\WEBSPHERE\Examples\Web Content\pjaf'.

I checked the above directory and there are five pjaf files, one of which is Serif(the font i am using). PLEASE, SOMEONE HELP. Note, I do not have the option of changing the servers classpath on boot.

Here is my code.

package com.ibm.btv.samples;

import javax.servlet.*;
import javax.servlet.http.*;

import java.awt.Font;
import java.awt.AWTError;
import java.io.*;
import java.util.*;

import com.eteks.awt.*;
import Acme.JPM.Encoders.GifEncoder;

public class Example extends HttpServlet {
public void doGet(HttpServletRequest req, HttpServletResponse res)
throws ServletException, IOException {

// set the java.awt.fonts directory
String fontPath = getServletContext().getRealPath("/pjaf");
System.setProperty("java.awt.fonts", fontPath);

// create new image
PJAImage image = new PJAImage(760, 760);

// get graphics object
PJAGraphics g = (PJAGraphics) image.getGraphics();

// draw outline
//g.setColor(Color.lightGray);
((PJAGraphicsExtension)g).setColor(225,225,225);
g.drawRect(0, 0, 800, 800);

//Lengend Font
((PJAGraphicsExtension)g).setColor(255,0,0);
String fontName = g.getFontName();
g.setFont("Serif", Font.BOLD, 16);
g.drawString("LEGEND", 10, 40);
g.drawLine(10, 41, 75, 41);
// send output
res.setContentType("image/gif");
res.setHeader("Pragma", "no-cache");

OutputStream out = res.getOutputStream();
try {
new GifEncoder(image, out).encode();
} catch (IOException e) {
}
out.flush();
}
}
---
Mike

Manu

Location : Paris / France
Member since : Apr 29, 2003
Messages : 394
 Aug 7, 2003 at 1:20 AM
I'm astonished by the error you get because an exception with the message "No fonts were found in ..." isn't generated by a PJA class but in the sun.java2d.SunGraphicsEnvironment class.
The only problem I can see in your servlet is that you should use GifEncoderNoCM class instead of GifEncoder. The GifEncoderNoCM class is a special version of GifEncoder that doesn't use the ColorModel class. After making this change, your servlet worked on my Linux test platform...
What JDK do you use ?

---
Manu (moderator/modérateur)

jose

Member since : Feb 18, 2005
Messages : 1
 Feb 18, 2005 at 3:31 PM
Hi,

I get the same error message like Mike since my upgrade from jdk 1.2.2 to 1.3.1.
With jdk 1.2.2 everything worked fine.

The path of the font file is set via jsp:
----------------------------------------------------------------------------
System.setProperty ("java.awt.fonts", "D:/enfinity/share/system/cartridges/xx_ets/release/lib");

response.setContentType("image/jpeg");
ServletOutputStream p = response.getOutputStream();
PJAImage img = new PJAImage(40, 10);_________________<--- error occurs here!
----------------------------------------------------------------------------

Im running windows 2000, application server is Java Web Server under
Intershop enfinity 2.2.

Like Mike's tomcat, the server is shutting down and reboots:
----------------------------------------------------------------------------
ets: No fonts were found in 'D:/enfinity/share/system/cartridges/xx_ets/release/lib'.
ets:
ets: d:\enfinity\jws\bin\jserv.exe
ets: Program d:\enfinity\jdk\bin\java.exe exited with code 2
Java Web Server WARNING: Server ets unexpectedly exited with code 2
ets: d:\enfinity\jws\bin\jserv.exe
ets: ----- Shutting down -----
----------------------------------------------------------------------------

Any ideas?
jose


Home pageFind It!ContactTop

© Copyrights 1997-2023 eTeks - All rights reserved

PJAPJA documentation