-
Bug
-
Resolution: Fixed
-
P4
-
8, 9, 11
-
b23
-
x86_64
-
linux
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8223057 | 11.0.5-oracle | Andrew Brygin | P4 | Resolved | Fixed | b01 |
JDK-8223503 | 11.0.4 | Andrew Brygin | P4 | Resolved | Fixed | b03 |
JDK-8235298 | openjdk8u242 | Andrew Brygin | P4 | Resolved | Fixed | team |
JDK-8235559 | openjdk8u232 | Andrew Brygin | P4 | Resolved | Fixed | master |
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 ----------
- backported by
-
JDK-8223057 Wrong fontMetrics when printing in Landscape (OpenJDK)
-
- Resolved
-
-
JDK-8223503 Wrong fontMetrics when printing in Landscape (OpenJDK)
-
- Resolved
-
-
JDK-8235298 Wrong fontMetrics when printing in Landscape (OpenJDK)
-
- Resolved
-
-
JDK-8235559 Wrong fontMetrics when printing in Landscape (OpenJDK)
-
- Resolved
-
- duplicates
-
JDK-8177387 The document can not be printed out after setting landscape option
-
- Closed
-
-
JDK-8205046 Calling Graphics2D.rotate(...) modifies FontMetrics
-
- Closed
-
-
JDK-8205152 In LANDSCAPE mode and REVERSE_LANDSCAPE mode the printed JTable contents without proper header.
-
- Closed
-
-
JDK-8213453 Incorrect FontMetrics on Windows via PrinterJob Graphics
-
- Closed
-
-
JDK-8217509 Broken fontmetrics when printing Text using background with alpha channel
-
- Closed
-
-
JDK-8219717 Regression manual Test "java/awt/print/PrinterJob/TransImages/TransImages.java" fails
-
- Closed
-
- relates to
-
JDK-8205159 The Header of the print out displayed incomplete
-
- Closed
-
-
JDK-8219717 Regression manual Test "java/awt/print/PrinterJob/TransImages/TransImages.java" fails
-
- Closed
-
-
JDK-8177387 The document can not be printed out after setting landscape option
-
- Closed
-
-
JDK-8205152 In LANDSCAPE mode and REVERSE_LANDSCAPE mode the printed JTable contents without proper header.
-
- Closed
-
-
JDK-8205159 The Header of the print out displayed incomplete
-
- Closed
-