For that character we are reporting a vertical advance as well as an horizontal 
advance.
There seem to be a few in wingdings that do so - probably those you identify.
It would take some digging to see if we are reporting correctly.

-phil.

Jan Bösenberg (INCORS GmbH) wrote:
Yesterday I ran into an amazing behaviour in glyph rendering. This
probably qualifies as a bug, but in any case it is really weird.

In a few words, if one certain glyph is displayed in a JTextField (or
generally in Swing text), it will kill all trailing glyphs (or at least
make them disappear)! This probably only works on Windows (I tested this
on WinXP running JRE 1.6b66 and JRE 1.5), because Wingdings must be used
for the characters uf000 - uf0ff.

So if you are running Windows, simply run the attached test class. When
you press on the button, character uf0ea, which is rendered using the
Wingdings "bold arrow down", will be inserted at the beginning of the
text in the JTextField (it should be a bold down arrow, otherwise you
probably will not see the effect). Suddenly all trailing characters
disappear. If you remove the character (simply by editing the
JTextField), the characters will reappear. Isn't this weird? And if you
select the killer glyph, only the directly following glyph will be visible.

What actually seems to happen is that the followings glyphs are still
there, but they are shifted up, outside of the visible rect of the
JTextField. And there are other glyphs in Wingdings, that can shift the
trailing glyphs down (for example uf0ea), neutralizing the effect. And
using two of the glyphs shifts the trailing chars twice (so you need two
gylphs shifting into the other direction to neutralize the effect). This
has probably something to do with the inserted glyph's baseline, but it
is strange that the leading glyphs are displayed normally.

I have seen similar effects with our text editor in some cases, when
whole lines were shifted behind some weird glyphs, but this is the first
time that I found something that I can actually put my fingers on.
Actually I am not really sure what to make of this. Is it the correct
behaviour from an engineer's point of view (it certainly is not from a
user's point of view). Is it a bug? Should I file a bug report? Also, is
this a Java2D related issue, or is the Swing team responible here?

Cheers

Jan




************* start of test class *****************

import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;

public class KillerGlyphTest {

  public static void main(String[] args) {
    final JTextField textField = new JTextField("Text to be killed");
    JButton button = new JButton("Insert Killer Glyph");
    button.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent e) {
        // We simply insert one character at the beginning of the text
        textField.setText('\uf0ea' + textField.getText());
      }
    });
    // add button and text field to a panel
    JPanel panel = new JPanel(new BorderLayout());
    panel.add(textField, BorderLayout.NORTH);
    panel.add(button, BorderLayout.CENTER);
    // create a frame and show it
    JFrame frame = new JFrame("Return of the Killer Glyph");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.setContentPane(panel);
    frame.setSize(300, 100);
    frame.validate();
    frame.setLocationRelativeTo(null);
    frame.setVisible(true);
  }

}


************* end of test class *****************


Just for completeness, here is an incomplete list of glyphs from
Wingdings that show a similar behaviour (as you can see they are all
gylphs used for to display up/down metaphor):

- uf0e9 (shifts trailing text down, this can neutralize uf0ea)
- uf0ce (shifts trailing text down)
- uf0cf (shifts trailing text up)
- uf0dd (shifts trailing text down)
- uf0de (shifts trailing text up)
- uf0f1 (shifts trailing text down)
- uf0f2 (shifts trailing text up)
- uf047 (shifts trailing text down)
- uf048 (shifts trailing text up)

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA2D-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA2D-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to