United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
JDK-8008535 : JDK7 Printing : CJK and Latin Text in a string overlap.

Details
Type:
Bug
Submit Date:
2013-02-20
Status:
Closed
Updated Date:
2014-12-04
Project Name:
JDK
Resolved Date:
2013-05-24
Component:
client-libs
OS:
windows
Sub-Component:
2d
CPU:
generic
Priority:
P2
Resolution:
Fixed
Affected Versions:
7u13,7u15,8
Fixed Versions:

Related Reports
Backport:
Backport:
Duplicate:
Duplicate:
Duplicate:
Duplicate:
Duplicate:
Duplicate:
Duplicate:
Duplicate:

Sub Tasks

Description
When printing text by Java7, some letters are overlapped.
For example, graphics2d.drawString(Japanse+English) causes the
Japanese letters and English letters overlapping.
This is a regression from Java6, because Java6 doesn't have 
this problem.

                                    

Comments
Verified b94!
                                     
2013-06-18
URL:   http://hg.openjdk.java.net/jdk8/jdk8/jdk/rev/f24f9038e050
User:  lana
Date:  2013-06-04 17:27:56 +0000

                                     
2013-06-04
URL:   http://hg.openjdk.java.net/jdk8/2d/jdk/rev/f24f9038e050
User:  prr
Date:  2013-05-24 16:36:11 +0000

                                     
2013-05-24
To reproduce the bug,
1. Compile DrawPanel.java, Print.java and Frame.java
2. Exec Print.java - Japanese text and English text overlap (see print_bug.png attached)
3. Exec Frame.java - looks work fine.

DrawPanel.java have Japanese strings in the source in UTF-8 encoding.  Please compile it on UTF-8 locale.
                                     
2013-02-20
I can reproduce this from JDK 7 b08 onwards.
My guess is that its due to a bug in the fix for
6425068 : Mismatch between the drawing width and font metrics
One part of that fix was to assign glyph positions in certain cases.
If we aren't adding the start position of a new run then you would get this overlapping

                                     
2013-02-20



Hardware and Software, Engineered to Work Together