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

REGRESSION: TextLayout strikethrough hint does not draw sometimes

XMLWordPrintable

    • 2d
    • b92
    • x86
    • windows_xp

      FULL PRODUCT VERSION :
      mustang b84

      ADDITIONAL OS VERSION INFORMATION :
      Windows XP Sp1+ English+Multilanguage Pack

      A DESCRIPTION OF THE PROBLEM :
      textLayout's drawText failed to draw strikethrough hint on some special position when the font is SimSun and size is 20PT.
      If i draw with other fonts then it's ok. On Tiger Update 6 it's ok.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      run the source code pasted.


      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import java.awt.*;
      import java.awt.font.*;
      import java.text.AttributedString;
      import java.util.*;
      import javax.swing.JFrame;

      public class SongtiBug extends JFrame {
          public SongtiBug() {
              try {
                  jbInit();
                  repaint();
              } catch (Exception e) {
                  e.printStackTrace();
              }
          }

          private void jbInit() throws Exception {
              this.getContentPane().setLayout( null );
              this.setSize( new Dimension(400, 300) );
              this.setTitle( "Bug For U" );
              this.setDefaultCloseOperation(2);
          }

          
          public void paint(Graphics g){
              super.paint(g);
              
              Graphics2D g2d = (Graphics2D)g;
              Map<RenderingHints.Key, Object> mapRender =
                  new HashMap<RenderingHints.Key, Object>();
              mapRender
              .put(RenderingHints.KEY_COLOR_RENDERING, RenderingHints.VALUE_COLOR_RENDER_QUALITY);
              g2d.addRenderingHints(mapRender);
              g2d.setFont(new Font("\u5b8b\u4f53",Font.PLAIN,20));
              AttributedString styledText = new AttributedString("\u4e2d\u6587");
              styledText.addAttribute(TextAttribute.FONT, g2d.getFont());
                  styledText
                  .addAttribute(TextAttribute.UNDERLINE, TextAttribute.UNDERLINE_ON);
                  styledText.addAttribute(TextAttribute.STRIKETHROUGH,TextAttribute.STRIKETHROUGH_ON);
       LineBreakMeasurer measurer =
           new LineBreakMeasurer(styledText.getIterator(),g2d.getFontRenderContext());
           TextLayout layout = measurer.nextLayout(200);
              measurer =
                  new LineBreakMeasurer(styledText.getIterator(),g2d.getFontRenderContext());
              layout.draw(g2d,100,80f);//ok
           layout.draw(g2d,100,117.59375f);//strange !!!
          }
          
          public static void main(String[] argv){
              SongtiBug bug = new SongtiBug();
              bug.setVisible(true);
          }
      }

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

      Release Regression From : mustang
      The above release value was the last known release where this
      bug was known to work. Since then there has been a regression.

            dougfelt Doug Felt (Inactive)
            igor Igor Nekrestyanov (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: