Return-Path: X-Original-To: apmail-jmeter-dev-archive@minotaur.apache.org Delivered-To: apmail-jmeter-dev-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 01A4B10F5E for ; Wed, 19 Nov 2014 15:11:15 +0000 (UTC) Received: (qmail 83781 invoked by uid 500); 19 Nov 2014 15:11:14 -0000 Delivered-To: apmail-jmeter-dev-archive@jmeter.apache.org Received: (qmail 83751 invoked by uid 500); 19 Nov 2014 15:11:14 -0000 Mailing-List: contact dev-help@jmeter.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@jmeter.apache.org Delivered-To: mailing list dev@jmeter.apache.org Received: (qmail 83735 invoked by uid 99); 19 Nov 2014 15:11:14 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 19 Nov 2014 15:11:14 +0000 X-ASF-Spam-Status: No, hits=1.5 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of philippe.mouawad@gmail.com designates 209.85.223.170 as permitted sender) Received: from [209.85.223.170] (HELO mail-ie0-f170.google.com) (209.85.223.170) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 19 Nov 2014 15:10:48 +0000 Received: by mail-ie0-f170.google.com with SMTP id rd18so651029iec.15 for ; Wed, 19 Nov 2014 07:10:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=L4OAZF2jly6QWFq4cSYZvOBVu9UmHABrfZm4mkiWcPo=; b=Fh/j3JOhglylvvtupY6gd6V+ElwFdepCRhoMS/kaI3wEnk8OJwdoa7NhOlIr18iTDD ZW/yXlyE+fOhAwOwgPYBj0oZOt0qSOwVWNhfs6RZ/oDC9R9xfFobwuF3WHMBXUwvC9FX iak/3LmLKMAT0yXyizLE/GN4Jztm8UI67r0Dhl359t25wzq9K2K2RijQZlUX/Rf5q7sA hM15o6KGXOU2h/c/bnXHWTu/IzsKSy1/PP5yquuO4fv3v12hnJrL3cWl+p/Ih8PCxfLl oFjTWnM8q8x/VvVBdld9zy/9Cc2di7nDx7s+pW07KkEErP9ZS4Ej7MkTP1aeIv1Y+jKc Lcmw== MIME-Version: 1.0 X-Received: by 10.107.130.30 with SMTP id e30mr652040iod.87.1416409847326; Wed, 19 Nov 2014 07:10:47 -0800 (PST) Received: by 10.42.102.131 with HTTP; Wed, 19 Nov 2014 07:10:47 -0800 (PST) In-Reply-To: References: <546CACBE.7010900@oracle.com> Date: Wed, 19 Nov 2014 16:10:47 +0100 Message-ID: Subject: Fwd: Fwd: JAVA8u20 and JAVA8u25 Regression in Graphics2D drawing of derived Fonts ? From: Philippe Mouawad To: "dev@jmeter.apache.org" Content-Type: multipart/alternative; boundary=001a113ece50ce6e040508379de1 X-Virus-Checked: Checked by ClamAV on apache.org --001a113ece50ce6e040508379de1 Content-Type: text/plain; charset=ISO-8859-1 Hi , Could you make some tests on Linux and Windows platform please to see if issue is also there ? Thanks ---------- Forwarded message ---------- From: Philippe Mouawad Date: Wed, Nov 19, 2014 at 4:10 PM Subject: Re: Fwd: JAVA8u20 and JAVA8u25 Regression in Graphics2D drawing of derived Fonts ? To: "dev@jmeter.apache.org" Cc: rory.odonnell@oracle.com, Dalibor Topic , Vaidya Balchandra Hello Rory, I posted a bug, waiting for mail notification. It seems bug appeared after Java 7 u40 as I just tested now with Java7 u71 and it is also broken there. I didn't test versions between 7u40 and 7u71. Regards Philippe On Wed, Nov 19, 2014 at 3:44 PM, Rory O'Donnell wrote: > Hi Philippe, > > Can you log a Java Incident and send us the JI number ? > > Rgds,Rory > On 19/11/2014 14:36, Philippe Mouawad wrote: > >> Hello Rory, >> For information, I submitted this question on Swing-dev , I am not sure it >> is the right list, if so hope you can help. >> >> Regards >> Philippe >> ---------- Forwarded message ---------- >> From: Philippe Mouawad >> Date: Wed, Nov 19, 2014 at 3:34 PM >> Subject: JAVA8u20 and JAVA8u25 Regression in Graphics2D drawing of derived >> Fonts ? >> To: swing-dev@openjdk.java.net >> >> >> Hello, >> We had recently a report of a bug on Apache JMeter: >> >> - https://issues.apache.org/bugzilla/show_bug.cgi?id=57221 >> >> >> The bug only occurs on Java 8 (u20 and u25). >> >> We use jCharts library. >> >> I narrowed the bug and it seems to come from the way derived fonts are >> drawn: >> >> Library uses: >> >> public static final AffineTransform VERTICAL_ROTATION = >> AffineTransform.getRotateInstance( -Math.PI / 2 ); >> >> Then >> >> this.affineTransform= VERTICAL_ROTATION; >> this.font.deriveFont( this.affineTransform ) >> >> So I build a stupid and ugly isolated class to show issue, run it on Java >> 7 >> display is fine , run it on Java8 result is strange. >> >> package org.jCharts; >> >> import java.awt.Color; >> import java.awt.Dimension; >> import java.awt.Font; >> import java.awt.Graphics; >> import java.awt.Graphics2D; >> import java.awt.RenderingHints; >> import java.awt.font.FontRenderContext; >> import java.awt.font.LineMetrics; >> import java.awt.geom.AffineTransform; >> import java.awt.geom.GeneralPath; >> import java.awt.geom.Rectangle2D; >> >> import javax.swing.JFrame; >> import javax.swing.JPanel; >> >> public class Test extends JPanel { >> Rectangle2D.Float rect = new Rectangle2D.Float(200, 200, 220, 35); >> // float theta = 1.1748778437843f; >> double theta = Math.PI / 6; >> >> @Override >> protected void paintComponent(Graphics g) { >> super.paintComponent(g); >> Graphics2D g2 = (Graphics2D) g; >> g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, >> RenderingHints.VALUE_ANTIALIAS_ON); >> g2.setRenderingHint(RenderingHints.KEY_FRACTIONALMETRICS, >> RenderingHints.VALUE_FRACTIONALMETRICS_ON); >> g2.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, >> RenderingHints.VALUE_STROKE_PURE); >> g2.setPaint(Color.blue); >> Font font = g2.getFont().deriveFont(18f); >> g2.setFont(font); >> FontRenderContext frc = g2.getFontRenderContext(); >> String s = "This text should be rotated"; >> float width = (float) font.getStringBounds(s, frc).getWidth(); >> LineMetrics lm = font.getLineMetrics(s, frc); >> float height = lm.getAscent() + lm.getDescent(); >> // Scale text into rect. >> float xScale = rect.width / width; >> float yScale = rect.height / height; >> float scale = (xScale > yScale) ? yScale : xScale; >> // Locate string origin. >> double x = rect.x; >> double y = rect.y + (rect.height + scale * height) / 2 - scale >> * lm.getDescent(); >> AffineTransform at = AffineTransform.getTranslateInstance(x, y); >> at.scale(scale, scale); >> AffineTransform rotator = new AffineTransform(); >> rotator.rotate(theta, rect.getCenterX(), rect.getCenterY()); >> GeneralPath rect2 = new GeneralPath( >> rotator.createTransformedShape(rect)); >> // Draw with no rotation. >> g2.draw(rect); >> g2.setPaint(Color.red); >> g2.setFont(font.deriveFont(at)); >> g2.drawString(s, 0, 0); >> // Rotate once. >> g2.setPaint(Color.blue); >> g2.draw(rect2); >> rotator.concatenate(at); >> g2.setFont(font.deriveFont(rotator)); >> g2.setPaint(Color.red); >> g2.drawString(s, 0, 0); >> // Rotate again. >> rotator.setToIdentity(); >> rotator.rotate(2 * theta, rect.getCenterX(), rect.getCenterY()); >> rect2 = new GeneralPath(rotator.createTransformedShape(rect)); >> g2.setPaint(Color.blue); >> g2.draw(rect2); >> rotator.concatenate(at); >> g2.setFont(font.deriveFont(rotator)); >> g2.setPaint(Color.red); >> g2.drawString(s, 0, 0); >> // Check scaled string bounds. >> // this was handled by the fractional metrics rendering hint >> } >> >> public static void main(String[] args) { >> Test test = new Test(); >> test.setPreferredSize(new Dimension(800, 600)); >> JFrame f = new JFrame(); >> f.getContentPane().add(test); >> f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); >> f.pack(); >> f.setVisible(true); >> } >> } >> >> Regards >> Philippe M. >> >> >> >> > -- > Rgds,Rory O'Donnell > Quality Engineering Manager > Oracle EMEA , Dublin, Ireland > > -- Cordialement. Philippe Mouawad. -- Cordialement. Philippe Mouawad. --001a113ece50ce6e040508379de1--