• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Creating characters

 
colin shuker
Ranch Hand
Posts: 750
  • Mark post as helpful
  • send pies
  • 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
 
Justin Fox
Ranch Hand
Posts: 802
  • Mark post as helpful
  • send pies
  • 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
 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24212
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • 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.
 
Campbell Ritchie
Sheriff
Pie
Posts: 50171
79
  • Mark post as helpful
  • send pies
  • 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
  • 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:
 
Paul Clapham
Sheriff
Posts: 21416
33
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • 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
  • 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.
 
Bob Good
Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
  • 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
Sheriff
Pie
Posts: 50171
79
  • Mark post as helpful
  • send pies
  • 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
  • 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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic