-
Bug
-
Resolution: Fixed
-
P3
-
5.0
FULL PRODUCT VERSION :
java version "1.5.0_06"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05)
Java HotSpot(TM) Client VM (build 1.5.0_06-b05, mixed mode, sharing)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows XP [Version 5.1.2600]
A DESCRIPTION OF THE PROBLEM :
A string contains some kind of characters(e.g. HALFWIDTH_AND_FULLWIDTH_FORMS) is not printed correctly. These strings are printed by outline data, regardless of whether specified font supports these character or not.
Some kind of printer uses the font replacement, strings which uses replaced font are high quality. However strings witch contains HALFWIDTH_AND_FULLWIDTH_FORMS are low quality, because these strings uses outline data.
In some case, this quality gap is critical.
Cause of this bug, in sun.print.PathGraphics#getGlyphToCharMapForFont(Font2D)
876> for (char c=0; c<CharToGlyphMapper.HI_SURROGATE_START; c++) { // <- cause
877> glyph = font2D.charToGlyph(c);
878> if (glyph != missingGlyph && glyph < numGlyphs) {
879> glyphToCharMap[glyph] = c;
880> }
881> }
882> return glyphToCharMap;
So, characters which has larger code point than surrogate area, are ignored.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
upside string is printed by font, however downside string is printed by outline.
ACTUAL -
both strings are printed by font
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import java.awt.Font;
import java.awt.print.Printable;
import java.awt.print.PrinterJob;
public class Test implements Printable{
public static void main(String[] args) throws Exception{
PrinterJob pj = PrinterJob.getPrinterJob();
pj.setPrintable(new Test());
if(pj.printDialog()) pj.print();
}
public int print(java.awt.Graphics graphics, java.awt.print.PageFormat pageFormat, int param)
throws java.awt.print.PrinterException {
if(param > 0) return Printable.NO_SUCH_PAGE;
graphics.setFont( new Font( "MS Gothic", Font.PLAIN, 16 ) ); //'MS Gothic' has a glyph of '\uFF10'
graphics.drawString("The quick brown fox jumps over the lazy dog.",100,100);
graphics.drawString("The quick brown fox jumps over the lazy dog. \uFF10",100,120);
return Printable.PAGE_EXISTS;
}
}
---------- END SOURCE ----------
java version "1.5.0_06"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05)
Java HotSpot(TM) Client VM (build 1.5.0_06-b05, mixed mode, sharing)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows XP [Version 5.1.2600]
A DESCRIPTION OF THE PROBLEM :
A string contains some kind of characters(e.g. HALFWIDTH_AND_FULLWIDTH_FORMS) is not printed correctly. These strings are printed by outline data, regardless of whether specified font supports these character or not.
Some kind of printer uses the font replacement, strings which uses replaced font are high quality. However strings witch contains HALFWIDTH_AND_FULLWIDTH_FORMS are low quality, because these strings uses outline data.
In some case, this quality gap is critical.
Cause of this bug, in sun.print.PathGraphics#getGlyphToCharMapForFont(Font2D)
876> for (char c=0; c<CharToGlyphMapper.HI_SURROGATE_START; c++) { // <- cause
877> glyph = font2D.charToGlyph(c);
878> if (glyph != missingGlyph && glyph < numGlyphs) {
879> glyphToCharMap[glyph] = c;
880> }
881> }
882> return glyphToCharMap;
So, characters which has larger code point than surrogate area, are ignored.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
upside string is printed by font, however downside string is printed by outline.
ACTUAL -
both strings are printed by font
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import java.awt.Font;
import java.awt.print.Printable;
import java.awt.print.PrinterJob;
public class Test implements Printable{
public static void main(String[] args) throws Exception{
PrinterJob pj = PrinterJob.getPrinterJob();
pj.setPrintable(new Test());
if(pj.printDialog()) pj.print();
}
public int print(java.awt.Graphics graphics, java.awt.print.PageFormat pageFormat, int param)
throws java.awt.print.PrinterException {
if(param > 0) return Printable.NO_SUCH_PAGE;
graphics.setFont( new Font( "MS Gothic", Font.PLAIN, 16 ) ); //'MS Gothic' has a glyph of '\uFF10'
graphics.drawString("The quick brown fox jumps over the lazy dog.",100,100);
graphics.drawString("The quick brown fox jumps over the lazy dog. \uFF10",100,120);
return Printable.PAGE_EXISTS;
}
}
---------- END SOURCE ----------