Sun Responds to Anti-alias and currency symbol gotchas

R

Roedy Green

Unfortunately for some reason Sun asks for their response to be kept
private.

I will paraphrase:


Those squirrelly behaviours are not bugs, but features.


Internally when Swing sees a Thai or Arabic character,
it switches to using TextLayout for rendering. A TextLayout
is created with a FontRenderContext, and the anti-aliasing Component
of that FontRenderContext is applied when rendering too. In other
words your anti-alias does not work because it is anti-aliasing the
wrong context when you have Thai or Arabic characters.

Mustang, Java 1.6, will default anti-aliasing to whether the OS
desktop setting is, making it behave like AWT peered components.


There is a related problem that AWT TextArea only displays half the
currency symbols that Swing JTextArea does. AWT Canvas/drawString
does display them though.


Swing can use Java2D, whereas AWT components can't so are restricted
by what's possible in the platform encoding and fonts.



--------------------- Report ---------------------


category : java
subcategory : classes_swing
release : 5.0
type : bug
synopsis : currency chars inhibit anti-aliasing
customer name : Roedy Green
sdn id : Roedy
language : en
company : Canadian Mind Products
hardware : x86
os : windows_2000
bug id : 0
date created : Sun Aug 14 02:55:29 MDT 2005
date evaluated : Mon Aug 15 12:42:14 MDT 2005
description :
FULL PRODUCT VERSION :
java version "1.5.0_04"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_04-b05)
Java HotSpot(TM) Client VM (build 1.5.0_04-b05, mixed mode, sharing)


ADDITIONAL OS VERSION INFORMATION :
Windows 2000


A DESCRIPTION OF THE PROBLEM :
\u0e3f in a JTextArea inhibits antialiasing, ditto \ufdfc. \u0e3f is a
Thai Baht currency sign like a capital B with a line through it.
\ufdfc is the Yemeni Rial currency sign. It looks like Arabic script.
Using one of these characters turns off anti-aliasing for the entire
JTextArea. They seem to have no such effect in AWT with drawString or
with TextArea. This strange behaviour has been observed both in Win2K
and Linux.


See http://mindprod.com/jgloss/antiasias.html
http://mindprod.com/applets/fontshower.html
for code that demonstrates the problem if you add \u0e3f to the sample
display.



STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
http://mindprod.com/applets/fontshower.html


Note how anti-aliasing works fine.


Download the code. Add \u0e3f to the currency display.


Note how this inhibits anti-aliasing.




EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Anti-aliasing should work independently of what chars are in the
JTextArea.



ACTUAL -
Anti-aliasing is inhibited what a JTextArea contains \ufdfc or \u0e3f,
and presumably other "naughty" characters.



ERROR MESSAGES/STACK TRACES THAT OCCUR :
No error messages. I would like you to either fix this or document
the strange behaviour. I wasted days tracking down why my
anti-aliasing was not working.



REPRODUCIBILITY :
This bug can be reproduced always.


---------- BEGIN SOURCE ----------
see http://mindprod.com/products1.html#FONTSHOWER


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


CUSTOMER SUBMITTED WORKAROUND :
I simply avoid displaying these two currency characters.

There is a related problem that AWT TextArea only displays half the
currency symbols that Swing JTextArea does. AWT Canvas/drawString
does display them though.
 
J

jan V

Unfortunately for some reason Sun asks for their response to be kept
private.

Lawyer paranoia? Java clearly is a very strategic offering from Sun, so I
guess much to do with it is regularly scrutinized by top management, and
they will have lawyer types as confidant, as all top management of any
multinational have.
 
R

Raymond DeCampo

Roedy said:
Unfortunately for some reason Sun asks for their response to be kept
private.

I will paraphrase:


Those squirrelly behaviours are not bugs, but features.

How about posting the bug number? Or even better, a link to view the bug.

Thanks,
Ray
 
R

Roedy Green

How about posting the bug number? Or even better, a link to view the bug.

It did not get that far. Sun said the behaviours were a feature so
never got past bug number 0.
..
 
R

Raymond DeCampo

Roedy said:
It did not get that far. Sun said the behaviours were a feature so
never got past bug number 0.
.

Sorry, I misread the original post.

Ray
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top