Unicode Characters on Screen

Discussion in 'Java' started by Phillip Lord, Jul 24, 2003.

  1. Phillip Lord

    Phillip Lord Guest

    I'm a little confused over unicode support within java.

    If I do something like....

    JLabel label = new JLabel();
    label.setText( "0" + (char)0x2800 + 1 + (char)0x2801 + 2 + (char)0x2802 );

    which I expect to put the three characters "0 1 2" onto screen
    separated by the three characters which turn out to be the first three
    braille dot characters, in fact I get "0 1 2" separated by little
    boxes which in my experience tends to indicate "I don't know how to
    draw this character".

    Does anyone know how I get the actual characters to appear?

    Phil
     
    Phillip Lord, Jul 24, 2003
    #1
    1. Advertising

  2. Phillip Lord wrote:
    >
    >
    > I'm a little confused over unicode support within java.
    >
    > If I do something like....
    >
    > JLabel label = new JLabel();
    > label.setText( "0" + (char)0x2800 + 1 + (char)0x2801 + 2 + (char)0x2802 );
    >
    > which I expect to put the three characters "0 1 2" onto screen
    > separated by the three characters which turn out to be the first three
    > braille dot characters, in fact I get "0 1 2" separated by little
    > boxes which in my experience tends to indicate "I don't know how to
    > draw this character".
    >
    > Does anyone know how I get the actual characters to appear?


    Use a Font for the JLabel that contains glyphs for those characters.
    I'm not certain offhand what fonts might be suitable.


    John Bollinger
     
    John C. Bollinger, Jul 24, 2003
    #2
    1. Advertising

  3. Phillip Lord wrote:

    > I'm a little confused over unicode support within java.
    >
    > If I do something like....
    >
    > JLabel label = new JLabel();
    > label.setText( "0" + (char)0x2800 + 1 + (char)0x2801 + 2 + (char)0x2802 );
    >
    > which I expect to put the three characters "0 1 2" onto screen
    > separated by the three characters which turn out to be the first three
    > braille dot characters, in fact I get "0 1 2" separated by little
    > boxes which in my experience tends to indicate "I don't know how to
    > draw this character".
    >
    > Does anyone know how I get the actual characters to appear?


    Use a suitable font.

    -Manish

    --
    Manish Jethani (manish.j at gmx.net)
    phone (work) +91-80-51073488
     
    Manish Jethani, Jul 24, 2003
    #3
  4. Phillip Lord wrote:
    >
    >
    > I'm a little confused over unicode support within java.
    >
    > If I do something like....
    >
    > JLabel label = new JLabel();
    > label.setText( "0" + (char)0x2800 + 1 + (char)0x2801 + 2 + (char)0x2802 );


    label.setText("0\u28001\u28012\u2802");


    >
    > Does anyone know how I get the actual characters to appear?
    >


    Use a font that contains the Braille characters.

    Regards,
    John O'Conner
     
    John O'Conner, Jul 25, 2003
    #4
  5. Phillip Lord

    Phillip Lord Guest

    >>>>> "David" == David Zimmerman <> writes:

    David> Phillip Lord wrote:
    >> I'm a little confused over unicode support within java. If I do
    >> something like....


    >> JLabel label = new JLabel();


    >> label.setText( "0" + (char)0x2800 + 1 + (char)0x2801 + 2 +
    >> (char)0x2802 ); which I expect to put the three characters "0 1
    >> 2" onto screen


    >> separated by the three characters which turn out to be the first
    >> three braille dot characters, in fact I get "0 1 2" separated by
    >> little boxes which in my experience tends to indicate "I don't
    >> know how to draw this character". Does anyone know how I get the
    >> actual characters to appear?


    >> Phil



    David> Does the font you're using have those glyphs?


    Okay, from the four identical responses that I got (use the right
    font) I realise that I have been remiss in asking the question.

    From the results I got, the font does not have those glyphs. Clearly
    such font's do exist.

    So the real questions are

    1) Do any of the standard defined fonts for java have these glyphs?
    2) If not can I install new fonts into Java, that will have these
    glyphs?
    3) If I can how do I install such fonts? Can I do it programmatically?
    4) Can any one suggest a good set of fonts with these characters in?


    I'm starting to think that the sane course of action would be just to
    draw these glyphs on screen "by hand" rather than with unicode. They
    are, after all, fairly simple glyphs.


    Phil
     
    Phillip Lord, Jul 25, 2003
    #5
  6. Phillip Lord

    Andy Flowers Guest

    This may or may not help.

    But the SDK comes with a nifty little font viewer. In my JDK this is <JDK
    Root>\demo\jfc\Font2DTest\Font2DTest.jar

    This may help you have a look at what fonts produce what output.

    The caveat may be that you may find a font on a Windows machine that has
    what you want, but this might not be there on Linux/Unix, but as most of the
    worlds graphical clients are Windows this may not be too much of a
    problem...



    "Phillip Lord" <> wrote in message
    news:...
    > >>>>> "David" == David Zimmerman <> writes:

    >
    > David> Phillip Lord wrote:
    > >> I'm a little confused over unicode support within java. If I do
    > >> something like....

    >
    > >> JLabel label = new JLabel();

    >
    > >> label.setText( "0" + (char)0x2800 + 1 + (char)0x2801 + 2 +
    > >> (char)0x2802 ); which I expect to put the three characters "0 1
    > >> 2" onto screen

    >
    > >> separated by the three characters which turn out to be the first
    > >> three braille dot characters, in fact I get "0 1 2" separated by
    > >> little boxes which in my experience tends to indicate "I don't
    > >> know how to draw this character". Does anyone know how I get the
    > >> actual characters to appear?

    >
    > >> Phil

    >
    >
    > David> Does the font you're using have those glyphs?
    >
    >
    > Okay, from the four identical responses that I got (use the right
    > font) I realise that I have been remiss in asking the question.
    >
    > From the results I got, the font does not have those glyphs. Clearly
    > such font's do exist.
    >
    > So the real questions are
    >
    > 1) Do any of the standard defined fonts for java have these glyphs?
    > 2) If not can I install new fonts into Java, that will have these
    > glyphs?
    > 3) If I can how do I install such fonts? Can I do it programmatically?
    > 4) Can any one suggest a good set of fonts with these characters in?
    >
    >
    > I'm starting to think that the sane course of action would be just to
    > draw these glyphs on screen "by hand" rather than with unicode. They
    > are, after all, fairly simple glyphs.
    >
    >
    > Phil
     
    Andy Flowers, Jul 25, 2003
    #6
  7. Phillip Lord

    Phillip Lord Guest

    >>>>> "Andy" == Andy Flowers <> writes:

    Andy> This may or may not help.

    Andy> But the SDK comes with a nifty little font viewer. In my JDK
    Andy> this is <JDK Root>\demo\jfc\Font2DTest\Font2DTest.jar

    Andy> This may help you have a look at what fonts produce what
    Andy> output.

    Andy> The caveat may be that you may find a font on a Windows
    Andy> machine that has what you want, but this might not be there on
    Andy> Linux/Unix, but as most of the worlds graphical clients are
    Andy> Windows this may not be too much of a problem...

    Indeed it does. Sadly none of the fonts on my system has the braille
    fonts. A bit of a pity.

    I think its looking more likely that the appropriate solution is to
    draw the glyphs by hand.

    Cheers

    Phil
     
    Phillip Lord, Jul 25, 2003
    #7
  8. Phillip Lord

    Phillip Lord Guest

    Phillip Lord, Jul 25, 2003
    #8
  9. Phillip Lord

    Andy Flowers Guest

    There are fonts that can be downloaded to display the Braille character set.
    Some are free, other not.

    A quick google search on "Braille font download" should give some ideas,
    especially at http://www.tsbvi.edu/braille-resources/1087-download-braille-and-asl-specialty-fonts which includes,
    amongst others, a font from the UK Royal National Institute for the Blind
    (RNIB) which should have all you need.

    "Phillip Lord" <> wrote in message
    news:...
    > >>>>> "Andy" == Andy Flowers <> writes:

    >
    > Andy> This site may also help
    >
    > Andy> http://www.alanwood.net/unicode/braille_patterns.html
    >
    > Also useful! It shows, if nothing else, that my web browser can
    > display the braille glyphs....
    >
    >
    > Phil
     
    Andy Flowers, Jul 25, 2003
    #9
  10. Phillip Lord

    Phillip Lord Guest

    >>>>> "Andy" == Andy Flowers <> writes:

    Andy> There are fonts that can be downloaded to display the Braille
    Andy> character set. Some are free, other not.

    Andy> A quick google search on "Braille font download" should give
    Andy> some ideas, especially at
    Andy> http://www.tsbvi.edu/braille-resources/1087-download-braille-and-asl-specialty-fonts which includes,
    Andy> amongst others, a font from the UK Royal National Institute
    Andy> for the Blind (RNIB) which should have all you need.

    Yeah, I found these. The problem is that I have absolutely no idea
    what to do with these wrt java. It would also be nice to have stuff
    work cross platform.

    Phil
     
    Phillip Lord, Jul 25, 2003
    #10
  11. Phillip Lord

    Jon A. Cruz Guest

    Phillip Lord wrote:
    > 1) Do any of the standard defined fonts for java have these glyphs?


    Depends on the system they are on. :)



    > 2) If not can I install new fonts into Java, that will have these
    > glyphs?


    Yes.



    > 3) If I can how do I install such fonts? Can I do it programmatically?


    Kinda.

    ;-)

    See java.awt.Font.createFont(int fontFormat,InputStream fontStream)
    (Since JDK 1.3)


    > 4) Can any one suggest a good set of fonts with these characters in?


    Might check if the Vera fonts have them. Otherwise walk all fonts on the
    runtime to find one.

    This method will be *very* helpful in a programmatic search:

    java.awt.Font.canDisplay(char c)

    and find them with

    java.awt.GraphicsEnvironment.getAllFonts()
     
    Jon A. Cruz, Jul 26, 2003
    #11
  12. Phillip Lord

    Dale King Guest

    In article <>,
    says...
    > >>>>> "David" == David Zimmerman <> writes:

    >
    > David> Phillip Lord wrote:
    > >> I'm a little confused over unicode support within java. If I do
    > >> something like....

    >
    > >> JLabel label = new JLabel();

    >
    > >> label.setText( "0" + (char)0x2800 + 1 + (char)0x2801 + 2 +
    > >> (char)0x2802 ); which I expect to put the three characters "0 1
    > >> 2" onto screen

    >
    > >> separated by the three characters which turn out to be the first
    > >> three braille dot characters, in fact I get "0 1 2" separated by
    > >> little boxes which in my experience tends to indicate "I don't
    > >> know how to draw this character". Does anyone know how I get the
    > >> actual characters to appear?

    >
    > >> Phil

    >
    >
    > David> Does the font you're using have those glyphs?
    >
    >
    > Okay, from the four identical responses that I got (use the right
    > font) I realise that I have been remiss in asking the question.
    >
    > From the results I got, the font does not have those glyphs. Clearly
    > such font's do exist.
    >
    > So the real questions are
    >
    > 1) Do any of the standard defined fonts for java have these glyphs?


    Java is more flexible than that. It doesn't exactly have standard defined
    fonts. You can change and extend the font definitions yourself by
    changing the font'properties files. A logical font like dialog in Java
    isn't even necessarily a single font. It can be a combination of fonts
    over various ranges.

    See:

    http://java.sun.com/j2se/1.4.2/docs/guide/intl/fontprop.html

    --
    Dale King
     
    Dale King, Jul 28, 2003
    #12
  13. Phillip Lord

    Phillip Lord Guest

    >>>>> "Dale" == Dale King <> writes:

    >> 1) Do any of the standard defined fonts for java have these
    >> glyphs?


    Dale> Java is more flexible than that. It doesn't exactly have
    Dale> standard defined fonts. You can change and extend the font
    Dale> definitions yourself by changing the font'properties files. A
    Dale> logical font like dialog in Java isn't even necessarily a
    Dale> single font. It can be a combination of fonts over various
    Dale> ranges.



    Okay, thanks for the information, and likewise all to all the other
    people who have offered.

    I am reaching the conclusion here that while it would be possible to
    install fonts with support for the braille glyphs, its actually going
    to be easier to just draw them by hand. I think I could probably get
    them installed on my development machine, but is anyone else going to
    do this?

    Still the information is useful. Braille glyphs are easy to draw, but
    this is not true in general. Were they more complex, then going to
    route of existing fonts would clearly be the way.

    Cheers

    Phi
     
    Phillip Lord, Jul 29, 2003
    #13
  14. Phillip Lord

    Jon A. Cruz Guest

    Phillip Lord wrote:
    > I am reaching the conclusion here that while it would be possible to
    > install fonts with support for the braille glyphs, its actually going
    > to be easier to just draw them by hand. I think I could probably get
    > them installed on my development machine, but is anyone else going to
    > do this?



    Given that Braille fonts are relatively small (small number of
    characters, etc), dynamically loading the font via
    java.awt.Font.createFont() could be the way to go.
     
    Jon A. Cruz, Jul 30, 2003
    #14
    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. Russell
    Replies:
    1
    Views:
    381
    Steve C. Orr [MVP, MCSD]
    Jan 21, 2004
  2. Laszlo Nagy
    Replies:
    6
    Views:
    639
  3. Terry Reedy
    Replies:
    0
    Views:
    524
    Terry Reedy
    Jul 1, 2008
  4. M.-A. Lemburg
    Replies:
    0
    Views:
    902
    M.-A. Lemburg
    Jul 2, 2008
  5. Grzegorz ¦liwiñski
    Replies:
    2
    Views:
    985
    Grzegorz ¦liwiñski
    Jan 19, 2011
Loading...

Share This Page