Duplicate :
|
|
Duplicate :
|
|
Duplicate :
|
|
Duplicate :
|
|
Duplicate :
|
|
Duplicate :
|
|
Relates :
|
|
Relates :
|
|
Relates :
|
|
Relates :
|
|
Relates :
|
FULL PRODUCT VERSION : openjdk version "1.8.0_66-internal" OpenJDK Runtime Environment (build 1.8.0_66-internal-b01) OpenJDK 64-Bit Server VM (build 25.66-b01, mixed mode) ADDITIONAL OS VERSION INFORMATION : Linux xxx 4.1.0-2-amd64 #1 SMP Debian 4.1.6-1 (2015-08-23) x86_64 GNU/Linux EXTRA RELEVANT SYSTEM CONFIGURATION : OpenJDK 8 installed from debian testing repository and CUPS PDF printer installed. A DESCRIPTION OF THE PROBLEM : When printing in landscape, getting FontMetrics returns wrong font parameters - ascent=0, descent=0, height=0 REGRESSION. Last worked in version 8u60 STEPS TO FOLLOW TO REPRODUCE THE PROBLEM : Set up any printer (for example cups-pdf) and use test case in OpenJDK, OracleJDK in Linux returns valid values. When printing in Portrait, fontMetrics return valid values. It seems that in landscape mode there is some transformation on graphics object configured and it affects fontMetrics. EXPECTED VERSUS ACTUAL BEHAVIOR : EXPECTED - Valid font metrics: sun.font.FontDesignMetrics[font=java.awt.Font[family=Monospaced,name=Monospaced,style=plain,size=9]ascent=9, descent=3, height=12] ACTUAL - Incorrect font metrics: sun.font.FontDesignMetrics[font=java.awt.Font[family=Monospaced,name=Monospaced,style=plain,size=9]ascent=0, descent=0, height=0] REPRODUCIBILITY : This bug can be reproduced always. ---------- BEGIN SOURCE ---------- import java.awt.*; import javax.print.attribute.HashPrintRequestAttributeSet; import javax.print.attribute.standard.OrientationRequested; import java.awt.print.*; public class LandscapeFontMetrics { public static void main(String args[]) throws Exception { PrinterJob job = PrinterJob.getPrinterJob(); job.setPrintable(new Printable() { public int print(Graphics g, PageFormat pf, int page) throws PrinterException { if (page > 0) return NO_SUCH_PAGE; Font f = new Font(Font.MONOSPACED, Font.PLAIN, 9); FontMetrics fontMetrics = g.getFontMetrics(f); System.err.println(fontMetrics); assert fontMetrics.getHeight() > 0; //fails in linux openjdk 7 and 8, runs on Oracle JDK 8 return NO_SUCH_PAGE; } }); HashPrintRequestAttributeSet as = new HashPrintRequestAttributeSet(); as.add(OrientationRequested.LANDSCAPE); job.print(as); System.exit(0); } } ---------- END SOURCE ----------
|