JDK-8037574 : java renders 2 combining diacriticals poorly
  • Type: Bug
  • Component: client-libs
  • Sub-Component: 2d
  • Affected Version: 7u51
  • Priority: P4
  • Status: Open
  • Resolution: Unresolved
  • OS: windows_7
  • CPU: x86_64
  • Submitted: 2014-03-07
  • Updated: 2018-09-05
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
tbdUnresolved
Related Reports
Blocks :  
Description
FULL PRODUCT VERSION :

java version "1.7.0_51"
Java(TM) SE Runtime Environment (build 1.7.0_51-b13)
Java HotSpot(TM) 64-Bit Server VM (build 24.51-b03, mixed mode)


ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows [Version 6.1.7601]


A DESCRIPTION OF THE PROBLEM :
I believe this particular character combination should "work out" to be one character, with two combining diacritical marks on it.  Instead it renders 1 character with one combining diacritical mark, and then another "dash circle" with the second diacritical mark.

ADDITIONAL REGRESSION INFORMATION: 
Why does it ask for this twice?


java version "1.7.0_51"
Java(TM) SE Runtime Environment (build 1.7.0_51-b13)
Java HotSpot(TM) 64-Bit Server VM (build 24.51-b03, mixed mode)


STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
run attached code


EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
should output

size should be one character long, like:8 but instead is:8

ACTUAL -
size should be one character long, like:8 but instead is:14


REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
import java.awt.*;
import java.awt.image.BufferedImage;

/**
 */
public class JavaBug {

  public static void main(String[] args) {
    BufferedImage image = new BufferedImage(100, 100, BufferedImage.TYPE_INT_ARGB);
    Graphics2D graphics2D = image.createGraphics();
    StringBuilder text = new StringBuilder();
    text.appendCodePoint(3588);
    text.appendCodePoint(3640);  // combining diacritic mark, should combine with previous character (3588) ??
    text.appendCodePoint(3633);  // combining diacritic mark, should combine with previous character (3588) ??
    System.out.println("size should be one character long, like:" + graphics2D.getFontMetrics().charWidth(3588) + " but instead is:" + graphics2D.getFontMetrics().stringWidth(text.toString()));
    System.out.println("this should show one character, and no dash circles;" + text.toString());
  }
}

---------- END SOURCE ----------


Comments
The Rampdown phase start [1] milestone is approaching, it means we are not targeting "9" to fix P4s anymore, unless the fix is ready and not risky, safe enough not introduce P2-P3 regressions; if this is a case you can retarget back to "9" right before the push the reviewed code. [1] http://openjdk.java.net/projects/jdk8/milestones#Rampdown_start
29-08-2016

can we close this bug based on above comments?
12-07-2016

Works in harfbuzz. String is \u0e04\u0e38\u0e31
21-11-2015

Not (dia)critical :-), but perhaps harfbuzz will resolve this in 9. Will check once it is integrated.
12-11-2015

Reproducible across all releases I've tried. The test however is a little sketchy in that it doesn't specify a font or display anything. The sequence is Thai \u0e04\u0e038\ue031 which is "KHO KHWAI" (consonant) + "SARA U" (vowel) + "MAI HAN-AKAT" (vowel) With most fonts I've tried in JDK the vowels are properly positioned. But the JDK fonts Lucida Sans and Lucida Sans Typewriter and the Windows Arial MS Unicode do not position the MAI HAN-AKAT properly. In the case of Windows native it doesn't display that glyph at all for Arial MS Unicode. Haven't tried Windows on the Lucida fonts. I suspect that these 3 older fonts don't follow the same code path or have the same information. The JDK logical fonts use Lucida Sans so will show the problem. However this can be worked-around by selecting any of the 10-20 Windows fonts that work properly.
19-03-2014

Attached images where you can see Font2DTest's rendering with Lucida isn't placing the vowel but is for Microsoft Sans Serif
19-03-2014

is it affecting 8 or 9?
18-03-2014