Sun Responds to Anti-alias and currency symbol gotchas

Discussion in 'Java' started by Roedy Green, Aug 15, 2005.

  1. Roedy Green

    Roedy Green Guest

    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.
    Roedy Green, Aug 15, 2005
    #1
    1. Advertising

  2. Roedy Green

    jan V Guest

    > 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.
    jan V, Aug 17, 2005
    #2
    1. Advertising

  3. 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.
    Raymond DeCampo, Aug 18, 2005
    #3
  4. Roedy Green

    Roedy Green Guest

    On Thu, 18 Aug 2005 01:44:37 GMT, Raymond DeCampo
    <> 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.
    ..
    Roedy Green, Aug 18, 2005
    #4
  5. Roedy Green wrote:
    > On Thu, 18 Aug 2005 01:44:37 GMT, Raymond DeCampo
    > <> 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.
    Raymond DeCampo, Aug 18, 2005
    #5
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Mark Rae
    Replies:
    0
    Views:
    621
    Mark Rae
    Mar 7, 2006
  2. xx

    Graphics2D anti-alias

    xx, Apr 12, 2004, in forum: Java
    Replies:
    1
    Views:
    5,937
    Chris Lamprecht
    Apr 12, 2004
  3. Replies:
    0
    Views:
    2,868
  4. grocery_stocker
    Replies:
    9
    Views:
    753
    grocery_stocker
    May 24, 2008
  5. Guest
    Replies:
    0
    Views:
    667
    Guest
    Oct 9, 2010
Loading...

Share This Page