• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Creating characters

 
Ranch Hand
Posts: 750
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi, this is probably impossible, or very awquard, but is it possible to create my own characters, such as small chess pieces, which can then be written using System.out.println("Pawn="+pawn);

Thanks
 
Ranch Hand
Posts: 802
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
you can write your own class Pawn, and then when you could output:



by creating your own String toString() method for that Pawn class, and format the output you want. Whether it be just the name of that piece, or the name and coords.

Justin Fox
 
author and iconoclast
Posts: 24207
46
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It's a non-Java thing. You would have to create your own typeface, presumably one with support for at least the first 256 code points. Your typeface ("font") would include both a normal US-ASCII character set and then extra glyphs in the unused code points (128-255) to represent your chess pieces and things. Then you'd have to install it on the computer, and configure your terminal window to use it. Then it's easy: from Java, you'd just print the Unicode values which corresponded to the chess piece glyphs.
 
Marshal
Posts: 79177
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I can't tell you where you might find chess pieces, but if you try Unicode numbers more than 2653 and less than 2660 you might find something to your advantage.
 
colin shuker
Ranch Hand
Posts: 750
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm not sure how I would create my own typeface, I googled it, but couldn't find anything of use.

I don't know how I would use 2653 - 2660 either :roll:
 
Marshal
Posts: 28193
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Even if you did create your own typeface, you probably wouldn't be able to persuade the console to use it. But perhaps your "System.out.println" was just a quick example and you really have a more practical use for these symbols?
 
colin shuker
Ranch Hand
Posts: 750
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
No, I would be printing to console, and also to the gui.
I was hoping to use an array of points or something to create small images that can come up as normal text, but like I thought, its too complicated.
 
Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There are some chess pieces in the private area of unicode defined here as an example:

http://www.users.globalnet.co.uk/~ngo/fonts.htm

see these:

http://www.users.globalnet.co.uk/~ngo/QUECHESS.TTF
[ January 18, 2008: Message edited by: Bob Good ]
 
Campbell Ritchie
Marshal
Posts: 79177
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Platform-sensitivity, I am afraid. If you print 2653-2660 on a Linux shell, you get tiny chess pieces appearing. At least I did yesterday. If you tried it on Windows you would get ???
 
colin shuker
Ranch Hand
Posts: 750
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks, I tried the fonts, but I don't like them, and I wouldn't know how to use them.
I also tried the 2653-2660, but on windows, so they came up as '?'.

Thanks
 
I RELEASE YOU! (for now .... ) Feel free to peruse this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic