This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
PTS's profile picture

Box-drawing characters

Started by PTS, 10 March 2012 - 11:04 AM
PTS #1
Posted 10 March 2012 - 12:04 PM
I looked at the font file in minecraft.jar and it is identical to the code page 437, used in MS-DOS and BIOS. Can I print them with ComputerCraft? When I try to call the special box-drawing character with string.char() or using the unicode '\###' identifier, they all return question marks. Trying to paste them in an outside text editor wont work either.

I made a loop that goes from 0 to 255 and then I used print(string.char(n)) to print all of the characters and all the special ones are question marks. If I paste some unicode char in a lua script with an outside text editor, however, the output in Minecraft is characters not seen in that previous loop.
PTS #2
Posted 10 March 2012 - 07:53 PM
After rigurous testing I've discovered the string.char() function can take more than one numeric argument. I've devised a function that maps all dual-argument combinations from 0 to 255 (a total of 65563 combinations) and looked trough all of them. Most of the combinations don't work (result in question marks), except for a few that start at 194,### trough 195,###. Here are some of the more interesting characters:
£ 194,35
ª 194,42
« 194,43
¬ 194,44
º 194,58
» 194,59
¼ 194,60
½ 194,61
¿ 194,63
These repeat every 64 indices. Starting at 195,### you can find most regular letters that combine with umlaut and other special symbols. They also repeat every 64 indices. The mystical box-drawing characters though do not appear anywhere within this map and I can only assume they require a combination of more than 2 arguments. If you try to call string.byte() on most of them (I pasted them in a UTF-8 file from an external editor) they return up to 8 arguments, but the length varies. Attempting to draw these combinations with string.char() results in question marks and sometimes symbols from the aforementioned character map.

I have not been able to derive any logic as to how these are arranged other than the repeating pattern every 64 indices. There is no correlation between the order in which they appear here and the order of the font file or the code page 437. I hope my research can be used to find the elusive characters. I may be back with more results tomorrow.
MysticT #3
Posted 10 March 2012 - 08:27 PM
Inside minecraft.jar, there's a file called font.txt, it has all the characters that can be used by minecraft (and CC).
font.txt:
Spoiler# This file NEEDS to be in UTF-8 format!
!"#$%&'()*+,-./
0123456789:;<=>?
@ABCDEFGHIJKLMNO
PQRSTUVWXYZ[]^_
'abcdefghijklmno
pqrstuvwxyz{|}~⌂
ÇüéâäàåÇêëèïîìäå
éææôöòûùÿöüø£ø׃
áíóúññªº¿®¬&frac12;&frac14;¡«»
The characters you want can't be used.
Smidge #4
Posted 10 July 2012 - 07:43 AM
Inside minecraft.jar, there's a file called font.txt, it has all the characters that can be used by minecraft (and CC).
font.txt:
Spoiler# This file NEEDS to be in UTF-8 format!
!"#$%&amp;'()*+,-./
0123456789:;<=>?
@ABCDEFGHIJKLMNO
PQRSTUVWXYZ[]^_
'abcdefghijklmno
pqrstuvwxyz{|}~⌂
ÇüéâäàåÇêëèïîìäå
éææôöòûùÿöüø£ø׃
áíóúññªº¿®¬&frac12;&frac14;¡«»
The characters you want can't be used.

How do you think this was done then?
http://pds.no-ip.fr/...19_16.55.34.png
Cloudy #5
Posted 10 July 2012 - 08:08 AM
Probably by replacing the default.png with one with a white square for one of the characters.