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

Monospaced font with Special Characters flickers when selected for HiDPI screens

XMLWordPrintable

      A DESCRIPTION OF THE PROBLEM :
      The system uses a scale factor of 1.25 (or higher set as VM arg -Dsun.java2d.uiScale=1.25)
      Font is Monospaced, plain with size 12.
      The RTL support is enabled.
      When text is selected in the text area, the characters start to move.

      When the font is changed to 13px everything seems to work fine.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Create a new JFrame with a JTextArea.
      Set the font of the text area as monospaced, plain, size 12.
      Enable special character support and set orientation as RTL.
      Set a scale factor of 1.25 (or higher) with the VM arg: -Dsun.java2d.uiScale=1.25
      Once the frame is visible, paste the XML text below in the text area:
      Sample text:
      <?xml version='1.0' encoding='UTF-8'?>
      <!DOCTYPE topic PUBLIC "-//OASIS//DTD DITA Topic//EN" "topic.dtd">
      <topic id="lorem">
      <title>Lorem</title>
      <shortdesc>Lorem dolorem</shortdesc>
      <body>
      <p>שימוש בתוכנ<apiname>ת עריכה ב</apiname>עברית תוך ניצ<data>ול של הדפ</data>דפ</p>
      <p>Most of the <b>information</b> was take</p>
      <p>סעיף א. כל בני אדם נולדו בני <i>חורין ושוו</i>ים בער<b>כם</b> ובזכו<filepath>יותיהם. כולם
      ח</filepath>וננו בתבונה וב<cite>מצפון, </cite>לפיכך חובה עלי ברעהו ברוח של אחוה.</p>
      <p>סעיף ב. כל אדם זכאי לזכויות<b> ולחרויות שנקבעו בהכרזש זו ללא</b> הפליה כלשהיא מטעמי גזע,
      צבע, מין, לשון, דח, דעה פוליטית או דעה בבעיות אחרות, בגלל מוצא לאומי או חברתי, קנין,
      לידה או מעמד אחר. גדולה מזו<i>, לא יופלה אדם על פי מע</i>מדה המדיני, על פי סמכותה או על
      פי מעמדה הבינלאומי של המדינה או הארץ שאליה הוא שייך, דין שהארץ היא עצמאית, ובין שהיא
      נתונה לנאמנו<u>ת, בין שהי</u>א נטולת שלטון עצמי ובין שריבונותה מוגבלת כל הגבלה אחרת.</p>
      <p>n from <xref href="http://www.wikipedia.com" format="html" scope="external"
      >Wikipedia</xref>, the free encyclopedia.</p>
      </body>
      </topic>





      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      When random text is selected, symbols should not flicker
      ACTUAL -
      When random text is selected, characters flicker/jump.

      ---------- BEGIN SOURCE ----------
        public static void main(String[] args) {
          Font defaultEditingFont = new Font("Monospaced", Font.PLAIN, 12);
          JFrame jFrame = new JFrame(defaultEditingFont.toString());
          jFrame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
          
          JTextArea textArea = new JTextArea();
          textArea.getDocument().putProperty(TextAttribute.RUN_DIRECTION, TextAttribute.RUN_DIRECTION_RTL);
          textArea.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
          textArea.setFont(defaultEditingFont);
          jFrame.getContentPane().add(textArea);
          
          jFrame.setSize(800, 600);
          jFrame.setVisible(true);
        }
      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      Setting the font size to 13px is ok.

      FREQUENCY : always


        1. Capture.PNG
          Capture.PNG
          105 kB
        2. Capture2.PNG
          Capture2.PNG
          37 kB
        3. CharacterJumping_LTR_Orientation.mp4
          5.20 MB
        4. TestApp.java
          0.8 kB

            rmahajan Rajat Mahajan
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            8 Start watching this issue

              Created:
              Updated: