-
Bug
-
Resolution: Fixed
-
P4
-
6
-
b28
-
generic
-
generic
-
Verified
For algorithmically bolded Lucida Sans Regular \u200b char - which is a zero width
space - will in some cases report its advance to be 1 pixel.
Although this was first seen with LCD_HRGB, it is also reproducible in AA and BW modes if
fractional metrics is enabled. Problem is reproducible with T2K rasterizer.
==========================
import java.awt.*;
import java.awt.image.*;
public class met {
public static void main(String[] s) {
BufferedImage bi = new BufferedImage(100, 100, BufferedImage.TYPE_INT_ARGB);
Graphics g = bi.getGraphics();
g.setFont(new Font("monospaced", Font.BOLD, 14));
//g.setFont(new Font("Lucida Sans Regular", Font.BOLD, 14));
FontMetrics fm = g.getFontMetrics();
System.out.println("Bold: " + fm.charWidth('\u200b'));
((Graphics2D)g).setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING,
RenderingHints.VALUE_TEXT_ANTIALIAS_LCD_HRGB);
fm = g.getFontMetrics();
System.out.println("Bold + LCD: "+fm.charWidth('\u200b'));
((Graphics2D)g).setRenderingHint(RenderingHints.KEY_FRACTIONALMETRICS,
RenderingHints.VALUE_FRACTIONALMETRICS_ON);
((Graphics2D)g).setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING,
RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
fm = g.getFontMetrics();
System.out.println("Bold FM OFF + AA: " + fm.charWidth('\u200b'));
((Graphics2D)g).setRenderingHint(RenderingHints.KEY_FRACTIONALMETRICS,
RenderingHints.VALUE_FRACTIONALMETRICS_OFF);
((Graphics2D)g).setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING,
RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
fm = g.getFontMetrics();
System.out.println("Bold FM ON + AA: " + fm.charWidth('\u200b'));
((Graphics2D)g).setRenderingHint(RenderingHints.KEY_FRACTIONALMETRICS,
RenderingHints.VALUE_FRACTIONALMETRICS_ON);
((Graphics2D)g).setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING,
RenderingHints.VALUE_TEXT_ANTIALIAS_OFF);
fm = g.getFontMetrics();
System.out.println("Bold FM ON + nonAA: " + fm.charWidth('\u200b'));
System.out.println("All printed values should be 0 to PASS");
}
}
space - will in some cases report its advance to be 1 pixel.
Although this was first seen with LCD_HRGB, it is also reproducible in AA and BW modes if
fractional metrics is enabled. Problem is reproducible with T2K rasterizer.
==========================
import java.awt.*;
import java.awt.image.*;
public class met {
public static void main(String[] s) {
BufferedImage bi = new BufferedImage(100, 100, BufferedImage.TYPE_INT_ARGB);
Graphics g = bi.getGraphics();
g.setFont(new Font("monospaced", Font.BOLD, 14));
//g.setFont(new Font("Lucida Sans Regular", Font.BOLD, 14));
FontMetrics fm = g.getFontMetrics();
System.out.println("Bold: " + fm.charWidth('\u200b'));
((Graphics2D)g).setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING,
RenderingHints.VALUE_TEXT_ANTIALIAS_LCD_HRGB);
fm = g.getFontMetrics();
System.out.println("Bold + LCD: "+fm.charWidth('\u200b'));
((Graphics2D)g).setRenderingHint(RenderingHints.KEY_FRACTIONALMETRICS,
RenderingHints.VALUE_FRACTIONALMETRICS_ON);
((Graphics2D)g).setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING,
RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
fm = g.getFontMetrics();
System.out.println("Bold FM OFF + AA: " + fm.charWidth('\u200b'));
((Graphics2D)g).setRenderingHint(RenderingHints.KEY_FRACTIONALMETRICS,
RenderingHints.VALUE_FRACTIONALMETRICS_OFF);
((Graphics2D)g).setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING,
RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
fm = g.getFontMetrics();
System.out.println("Bold FM ON + AA: " + fm.charWidth('\u200b'));
((Graphics2D)g).setRenderingHint(RenderingHints.KEY_FRACTIONALMETRICS,
RenderingHints.VALUE_FRACTIONALMETRICS_ON);
((Graphics2D)g).setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING,
RenderingHints.VALUE_TEXT_ANTIALIAS_OFF);
fm = g.getFontMetrics();
System.out.println("Bold FM ON + nonAA: " + fm.charWidth('\u200b'));
System.out.println("All printed values should be 0 to PASS");
}
}
- relates to
-
JDK-7183458 Metrics of space character in algorithmically emboldened font have changed in JDK 7.
- Resolved