Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8214481

freetype path does not disable TrueType hinting with AA+FM hints

    Details

    • Subcomponent:
      2d
    • Introduced In Version:
      11
    • Resolved In Build:
      b27
    • CPU:
      x86_64
    • OS:
      linux_ubuntu

      Backports

        Description

        A DESCRIPTION OF THE PROBLEM :
        Output is different on Java 11.0.1 vs 10.0.1

        import java.awt.Color;
        import java.awt.Font;
        import java.awt.FontFormatException;
        import java.awt.Graphics2D;
        import java.awt.RenderingHints;
        import java.awt.font.GlyphVector;
        import java.awt.image.BufferedImage;
        import java.io.File;
        import java.io.FileInputStream;
        import java.io.IOException;
        import javax.imageio.ImageIO;

        public class DrawText {
            public static void main(String arg[]) throws IOException, FontFormatException {
                BufferedImage bufferedImage = new BufferedImage(800, 600, BufferedImage.TYPE_INT_RGB);
                Graphics2D graphics2D = (Graphics2D) bufferedImage.getGraphics();
                graphics2D.setBackground(Color.white);
                graphics2D.setPaint(Color.white);
                graphics2D.fillRect(0, 0, 800, 600);
                graphics2D.setRenderingHint(RenderingHints.KEY_FRACTIONALMETRICS,
                        RenderingHints.VALUE_FRACTIONALMETRICS_ON);
                    graphics2D.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
                            RenderingHints.VALUE_ANTIALIAS_ON);
                    graphics2D.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING,
                            RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
                graphics2D.setRenderingHint(RenderingHints.KEY_RENDERING,
                        RenderingHints.VALUE_RENDER_QUALITY);
                graphics2D.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL,
                        RenderingHints.VALUE_STROKE_PURE);
                graphics2D.scale(1 / 1000f, 1 / 1000f);
                graphics2D.setColor(Color.BLACK);
                Font f = Font.createFont(Font.TRUETYPE_FONT,
                        new FileInputStream("cambria.ttc"));
                f = f.deriveFont(12000f);
                graphics2D.setFont(f);
                GlyphVector gv = graphics2D.getFont().createGlyphVector(graphics2D.getFontRenderContext(), "test");
                graphics2D.drawGlyphVector(gv, 0, 10530);
                ImageIO.write(bufferedImage, "tif", new File("image.tif"));
            }
        }

        REGRESSION : Last worked in version 10.0.1


        FREQUENCY : always


          Attachments

          1. cambria.ttc
            1.55 MB
          2. Capture.PNG
            Capture.PNG
            17 kB
          3. DrawText.java
            2 kB

            Issue Links

              Activity

                People

                • Assignee:
                  prr Philip Race
                  Reporter:
                  webbuggrp Webbug Group
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  8 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved: