Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Sun Responds to Anti-alias and currency symbol gotchas

Reply
Thread Tools

Sun Responds to Anti-alias and currency symbol gotchas

 
 
Roedy Green
Guest
Posts: n/a
 
      08-15-2005
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.
 
Reply With Quote
 
 
 
 
jan V
Guest
Posts: n/a
 
      08-17-2005
> 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.



 
Reply With Quote
 
 
 
 
Raymond DeCampo
Guest
Posts: n/a
 
      08-18-2005
Roedy Green wrote:
> 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

--
XML is the programmer's duct tape.
 
Reply With Quote
 
Roedy Green
Guest
Posts: n/a
 
      08-18-2005
On Thu, 18 Aug 2005 01:44:37 GMT, Raymond DeCampo
<(E-Mail Removed)> wrote or quoted :

>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.
..
 
Reply With Quote
 
Raymond DeCampo
Guest
Posts: n/a
 
      08-18-2005
Roedy Green wrote:
> On Thu, 18 Aug 2005 01:44:37 GMT, Raymond DeCampo
> <(E-Mail Removed)> wrote or quoted :
>
>
>>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.
> .


Sorry, I misread the original post.

Ray

--
XML is the programmer's duct tape.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Euro currency symbol David Wright Ruby 4 03-31-2009 04:05 PM
RangeValidator validate failed when input with currency symbol HipHopper ASP .Net 1 07-24-2008 06:20 PM
Currency Symbol in JTable RVince Java 3 02-02-2008 11:21 PM
Sun Updates Sun Java Availability Suite, Adds Sun Cluster Advanced Edition for Oracle Real Application Clusters Deployments technology_post@yahoo.com Java 0 04-05-2006 04:29 AM
Wrong currency symbol in .asp app =?Utf-8?B?U3R1YXJ0?= ASP .Net 5 02-08-2005 04:31 PM



Advertisments