[prev in list] [next in list] [prev in thread] [next in thread] 

List:       openjdk-2d-dev
Subject:    [OpenJDK 2D-Dev] The rotate method of OpenJDK is not working properly when using 180 degree rotation
From:       Ayase177 <ayase177 () yahoo ! co ! jp>
Date:       2020-05-27 5:07:19
Message-ID: 1590556039228-0.post () n7 ! nabble ! com
[Download RAW message or body]

The rotate method of OpenJDK is not working properly when using 180 degree
rotation in DBCS plain style.

[Enviroment]
Win10Pro Japanese
AdoptOpenJDK Java8 u252b09.1(x86)

[on condition]
Use Font:MS Gothic <- Japanese Font so Double byte character set use.
Plain Style
font size under 21pt(21pt over is work well)

[Result]
Use Oracle Java8 / Plain style -> OK
Use Oracle Java8 / Bold style-> OK
Use AdoptOpenJDK AdoptOpenJDK Java8 u252b09.1 /  Plain style -> NG
Use AdoptOpenJDK AdoptOpenJDK Java8 u252b09.1 /  Bold style -> OK


[what I want to know]
Does AdoptOpenJDK AdoptOpenJDK Java8 u252b09.1 still have a rotating bug
with an unfixed Double byte character set?

[Similar bug report]
Graphics2D.drawString produces different text widths, but the same height,
when rotated 180 degrees
https://bugs.openjdk.java.net/browse/JDK-8194555

OpenJDK can't support render text with rotation for DBCS fonts
https://bugs.openjdk.java.net/browse/JDK-8163278

Fonts with embedded bitmaps are not always rotated
https://bugs.openjdk.java.net/browse/JDK-8204929


The test code is below.
!!test code use Japanese MS Gothic font and text.!!
=====================================================

package fonttest;

import java.awt.Font;
import java.awt.FontMetrics;
import java.awt.Graphics;
import java.awt.Graphics2D;

import javax.swing.JEditorPane;
import javax.swing.JFrame;

	class TestWindow extends JFrame{

		public TestWindow(String title, int width, int height) {
			super(title);
			setDefaultCloseOperation(EXIT_ON_CLOSE);
			setSize(width,height);
			setLocationRelativeTo(null);
			setResizable(false);
		}
	}
	class DrawCanvas extends JEditorPane{
		public void paintComponent(Graphics g) {
			super.paintComponent(g);

			Font plain_FONT= new Font("MS ゴシック", Font.PLAIN, 15);
			g.setFont(plain_FONT);
			g.drawString("ABCabc0123456789あいうえお name=MS ゴシック(全角) plain 15pt", 10,
50);
			System.out.println("1 " + g.getFont());

			Font bold_FONT= new Font("MS ゴシック", Font.BOLD, 15);
			g.setFont(bold_FONT);
			g.drawString("ABCabc0123456789あいうえお  name=MS ゴシック(全角)  Bold 15pt", 10,
100);
			System.out.println("2 " + g.getFont());

			//rotate
			Graphics2D g2 = (Graphics2D)g;
			g2.setFont(plain_FONT); // change Font object for Bold Style test.
			FontMetrics fm = null;
			String str = "ABCabc0123456789あいうえお";
			fm = g2.getFontMetrics();
			int asent = fm.getAscent();
			g2.rotate(Math.toRadians(-180), 300, 200);
			g2.drawString(str, 150+asent,10);
		}
	}

	public class FontTest {
		public static void main(String[] args) {
			TestWindow tw = new TestWindow("フォントテスト", 800, 600);
			tw.add(new DrawCanvas());
			tw.setVisible(true);
		}
}
================================================================

Thank you.

<http://openjdk.5641.n7.nabble.com/file/t4349/AdoptOpenJDK252b09_Plain.png> 
<http://openjdk.5641.n7.nabble.com/file/t4349/AdoptOpenJDK252b09_Bold.png> 
<http://openjdk.5641.n7.nabble.com/file/t4349/Oracle.png> 
<http://openjdk.5641.n7.nabble.com/file/t4349/Oracle_Bold.png> 




--
Sent from: http://openjdk.5641.n7.nabble.com/OpenJDK-Java-2D-API-f95531.html
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic