Discussions
Categories
- 385.5K All Categories
- 4.9K Data
- 2.5K Big Data Appliance
- 2.4K Data Science
- 453.4K Databases
- 223.2K General Database Discussions
- 3.8K Java and JavaScript in the Database
- 47 Multilingual Engine
- 606 MySQL Community Space
- 486 NoSQL Database
- 7.9K Oracle Database Express Edition (XE)
- 3.2K ORDS, SODA & JSON in the Database
- 585 SQLcl
- 4K SQL Developer Data Modeler
- 188K SQL & PL/SQL
- 21.5K SQL Developer
- 46 Data Integration
- 46 GoldenGate
- 298.4K Development
- 4 Application Development
- 20 Developer Projects
- 166 Programming Languages
- 295K Development Tools
- 150 DevOps
- 3.1K QA/Testing
- 646.7K Java
- 37 Java Learning Subscription
- 37.1K Database Connectivity
- 201 Java Community Process
- 108 Java 25
- 22.2K Java APIs
- 138.3K Java Development Tools
- 165.4K Java EE (Java Enterprise Edition)
- 22 Java Essentials
- 176 Java 8 Questions
- 86K Java Programming
- 82 Java Puzzle Ball
- 65.1K New To Java
- 1.7K Training / Learning / Certification
- 13.8K Java HotSpot Virtual Machine
- 94.3K Java SE
- 13.8K Java Security
- 208 Java User Groups
- 25 JavaScript - Nashorn
- Programs
- 667 LiveLabs
- 41 Workshops
- 10.3K Software
- 6.7K Berkeley DB Family
- 3.6K JHeadstart
- 6K Other Languages
- 2.3K Chinese
- 207 Deutsche Oracle Community
- 1.1K Español
- 1.9K Japanese
- 474 Portuguese
Problem with Graphics2D setFont Method in java 1.6

854607
Member Posts: 8
Hi,
We are migrating one of our multithreaded J2SE application from java 1.4 to 1.6.
The application work is following :
1. Get the input data
2. from the input data create a ps file
3. create pcl file from the above created ps file
4. send the pcl to printer to printing.
I am encountering an error in step 2(creating a ps file). The ps file is created by implementing a Printable interface and then we are using Graphics2D setFont method to set the font of the printable.
The application fails due to the setFont method and produces NaN and Infinity values in the ps file. But if I comment all the setFont methods then the application works fine in java 1.6.
Could you please let me know what is the issue and what could be the work around for this?
[I have put one more post. The link is : http://forums.oracle.com/forums/thread.jspa?threadID=2206264&stqc=true]
Edited by: 851604 on Apr 25, 2011 2:17 AM
We are migrating one of our multithreaded J2SE application from java 1.4 to 1.6.
The application work is following :
1. Get the input data
2. from the input data create a ps file
3. create pcl file from the above created ps file
4. send the pcl to printer to printing.
I am encountering an error in step 2(creating a ps file). The ps file is created by implementing a Printable interface and then we are using Graphics2D setFont method to set the font of the printable.
The application fails due to the setFont method and produces NaN and Infinity values in the ps file. But if I comment all the setFont methods then the application works fine in java 1.6.
Could you please let me know what is the issue and what could be the work around for this?
[I have put one more post. The link is : http://forums.oracle.com/forums/thread.jspa?threadID=2206264&stqc=true]
Edited by: 851604 on Apr 25, 2011 2:17 AM
Answers
-
Not enough info to say something. Does it depend on font family/size? e.g. Arial, 10 works fine but Arial 20 fails.
Which OS and exact JDK version do you use?
Do you have SSCCe or at least some code snippets? -
No it does not depend on font family/size.
I am using UNIX os and JDK version i will update you shortly.
Here a small illustration of what I am doing:
public class A implements Printable{
public int print(Graphics graphics, PageFormat pageFormat, int pi){
drawImage((Graphics2D)graphics);
}
public void drawImage(Graphics2D g2){
g2.setFont(new Font("Arial", 1 , 24));
// some other stuff for drawString and drawLine
}
}
This setFont method creates Nan and Infinity values in the ps file produced.
If i comment out his part of code and then run the application then it works fine. -
Could you please guide me on this?
This discussion has been closed.