Home pageFind It!Contact PJAPJA documentation


 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 I can't draw text


Location : Milan
Member since : Sep 12, 2003
Messages : 1
 Sep 12, 2003 at 1:53 PM
I have uploaded the PJA jar files in a folder of
a web application in TOMCAT 4.0.6
on AIX 4.3.3 with Java 1.3.1

when I run the classic example below to display a jpeg
generated on the fly on a java server page, I am not
able to see the text "Hello" is not drawn.
Seems that g.drawString ("Hello", 30, 50); method is not working...
If I set java.awt.fonts=tomcat_home/webapps/pjaf
that is the folder where I have included some pjaf files generated
with PJAFontCapture.sh I get the error
no fonts found in tomcat_home/webapps/pjaf
and tomcat shutdown

What could it be?
What could I try to visualize the text with drawString method?
When I start tomcat I specify where my java libs fonts are like with the following:
CATALINA_OPTS="$CATALINA_OPTS -Xbootclasspath/a:$CATALINA_HOME/webapps/libadd/pja.jar -Dawt.toolkit=com.eteks.awt.PJAToolkit
-Djava.awt.graphicsenv=com.eteks.java2d.PJAGraphicsEnvironment -Djava.awt.fonts=$JAVA_HOME/jre/lib/fonts"

Please let me know.


<%@ page contentType="image/jpeg"
import="java.awt.image.*,java.awt.*,com.sun.image.codec.jpeg.*" %>
<% // Create an offscreen image 100 x 100 pixels

BufferedImage image = new BufferedImage (100, 100, BufferedImage.TYPE_INT_RGB);
// Draw into the image a black circle with the text Hello on a yellow background
Graphics g = image.getGraphics();
g.setColor (Color.yellow);
g.fillRect (0, 0, 100, 100);
g.setColor (Color.black);
g.drawOval (0, 0, 99, 99);
g.setFont(new Font("Dialog", Font.PLAIN, 9));
g.drawString ("Hello", 30, 50);

// Create a JPEG encoder to send the image at JPEG format
JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(response.getOutputStream());
response.getOutputStream().close (); %>


Location : Paris / France
Member since : Apr 29, 2003
Messages : 394
 Sep 21, 2003 at 5:45 PM
You must put some True Type fonts in your the directory contained in java.awt.fonts property.
With Java 1.3.1, .pjaf font files are not used unless you set com.eteks.awt.nojava2d system property to true and in that case, you can't use any methods of Java2D including the java.awt.image.BufferedImage class (but you may create images with the createImage(int width, int height) method of java.awt.Frame).
Manu (moderator/modérateur)

Home pageFind It!ContactTop

© Copyrights 1997-2023 eTeks - All rights reserved

PJAPJA documentation