-
Enhancement
-
Resolution: Fixed
-
P4
-
1.3.0
-
beta
-
x86
-
windows_nt
Name: mc57594 Date: 11/15/99
java version "1.3beta"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3beta-O)
Java(TM) HotSpot Client VM (build 1.3beta-O, mixed mode)
JDK 1.3 Beta (as well as JDK1.2.2) always outputs text/fonts using bitmaps.
Following is a sample code that shows this. One needs to compile this and run
it in JDK1.3Beta VM. The user should redirect the printer output to a file.
Using some tools that would translate the print file to a readable text, it
would become clear that fonts are printed as bitmaps.
// start of PrintFontIsRaster.java
import java.awt.*;
import java.awt.print.*;
public class PrintFontIsRaster
{
public static void main(String[] args)
{
try
{
Frame frame = new Frame();
JobAttributes jobAttr = new JobAttributes();
PageAttributes pageAttr = new PageAttributes();
pageAttr.setPrinterResolution( 600 );
pageAttr.setPrintQuality( 5 );
pageAttr.setOrigin( PageAttributes.OriginType.PHYSICAL );
printSomething( frame, jobAttr, pageAttr,
PageAttributes.OrientationRequestedType.PORTRAIT );
frame.dispose();
System.gc();
}
catch( Exception e )
{
}
System.exit(0);
}
public static void printSomething( Frame frame, JobAttributes jobAttr,
PageAttributes pageAttr, PageAttributes.OrientationRequestedType orientation )
{
pageAttr.setOrientationRequested( orientation );
PrintJob printJob = Toolkit.getDefaultToolkit().getPrintJob(
frame, "JDK1.3", jobAttr, pageAttr );
if ( printJob != null )
{
Graphics g = printJob.getGraphics();
int res = pageAttr.getPrinterResolution()[0];
g.setFont( new Font("Monospaced", Font.PLAIN, adjust(80,res)) );
g.setColor( Color.black );
g.drawString( "TEXT IS BITMAP", adjust(75,res), adjust(300,res) );
g.dispose();
printJob.end();
}
}
public static int adjust( int pixel, int res )
{
int screenRes = Toolkit.getDefaultToolkit().getScreenResolution();
return (int)((pixel * res) / screenRes);
}
}
// end of PrintFontIsRaster.java
Our application uses a lot of text output and it would come up with
substantially large print files when run in JDK1.3Beta (our observation shows
an increase to about 30 times). We are worried that this rasterization might
produce a huge file which would require a large network bandwidth (especially
via the internet) when e-printout is passed around.
(It would also become almost impossible to derive text from print files, for
example, using Acrobat's PDF Writer/Distiller (programs would then have to read
text from print files using some OCR))
Thus, we are requesting for something like an option to do either font raster
printing and font vector printing!
Thanks!
Marlon
(Review ID: 97409)
======================================================================
- relates to
-
JDK-4470606 VM crash while printing in Win2000
- Closed