Difference between revisions of "How to Add Characters and Icons to the Font"

From The Powder Toy
Jump to: navigation, search
(Adding an Icon to menus: Grammar and Syntax Corrections)
(Grammar fixes, Syntax corrections, and separate instructions for Windows and Linux)
Line 1: Line 1:
==''' Adding an Icon to menus''' ==
+
If you downloaded the source from Github, then you'll find a folder called font. If you look inside it, you'll see that there is packer.c, unpacker.c and editor.c. If you don't see it, then you either downloaded the source code off of this website, or you deleted it somehow. If this is the case, then just download the source code again from here: [https://github.com/FacialTurd/The-Powder-Toy The-Powder-Toy]. The instructions for Windows and Linux are different, so be sure to follow the correct instructions.
 
 
If you downloaded the source from Github, then you'll find a folder called font. If you look inside it, you'll see that there is packer.c, unpacker.c and editor.c. If you don't see it, then you either downloaded the source code off the website powdertoy.co.uk or you deleted it somehow. If this is the case, then just download the source code again from here: [https://github.com/FacialTurd/The-Powder-Toy The-Powder-Toy]
 
  
 +
== Windows ==
 
'''1)''' Copy font.h from /includes and paste it into /font.
 
'''1)''' Copy font.h from /includes and paste it into /font.
  
'''2)''' Navigate into /font, and open a terminal or command prompt here, compile the font editor tools using the following commands:
+
'''2)''' Navigate into /font, and open a Command Prompt here. Compile the font editor tools using the following commands:
On Linux or other *NIX operating systems:
 
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
make unpacker
+
make unpacker.exe packer.exe editor.exe
make packer
 
make editor
 
 
</syntaxhighlight>
 
</syntaxhighlight>
  
On Windows:
+
'''3)''' In the same terminal run the following command to create a font.bin file the editor can read:
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
make unpacker.exe
+
unpacker.exe
make packer.exe
 
make editor.exe
 
 
</syntaxhighlight>
 
</syntaxhighlight>
  
'''3)''' In the same terminal run the following command to create a font.bin file the editor can read:
+
'''5)''' Run the editor from the terminal and then use the "+" and "-" keys to go the end and find an empty character, empty characters look like thermometers, although be careful not to confuse it with the actual thermometer if it is just erase it via right clicking and left clicking in the drawing field. Now draw you character. Look in the stdout.txt file in the same directory, and the last number in the file is the char id that corresponds to whatever icon you drew.
On Linux or other *NIX:
+
 
 +
'''6)''' Close down the editor, delete the font.h, and run:
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
./unpacker
+
packer.exe > font.h
 
</syntaxhighlight>
 
</syntaxhighlight>
  
On Windows:
+
'''7)''' Copy the new font.h into /includes, replacing the old one.
<syntaxhighlight lang="bash">
+
 
unpacker.exe
+
'''8)''' For your new menu, replace FF with the last number from the stdout.txt file in the font directory.
 +
<syntaxhighlight lang="c">
 +
{"\xFF", "new menu ftw", 0, 1},
 
</syntaxhighlight>
 
</syntaxhighlight>
  
'''5)''' Run the editor from the terminal and then use the "+" and "-" keys to go the end and find an empty character, empty characters look like thermometers, although be careful not to confuse it with the actual thermometer if it is just erase it via right clicking and left clicking in the drawing field. now draw you character and look in cmd/terminal and the last number you will see there is the char id and it corresponds to what icon you drew, on Windows, you will have to find this information in the stdout.txt file in the same directory.
+
'''9)''' Recompile The Powder Toy and you should be ready to go.
  
'''6)''' close down the editor and delete the font.h then run:
+
== Linux ==
Linux and other *NIX:
+
'''1)''' Open a Terminal and ''cd'' to the font directory that's included with the Git source code.
 +
 
 +
'''2)''' Enter the following commands to copy font.h from includes to font and compile the font editor tools:
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
./packer > font.h
+
cp ../includes/font.h .
 +
make unpacker packer editor
 
</syntaxhighlight>
 
</syntaxhighlight>
  
Windows:
+
'''3)''' In the same terminal run the following command to create a font.bin file the editor can read:
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
packer.exe > font.h
+
./unpacker > output1.txt
 
</syntaxhighlight>
 
</syntaxhighlight>
  
'''7)''' copy the new font.h into /includes replacing the old one.
+
'''5)''' Run the editor from the terminal and then use the "+" and "-" keys to go the end and find an empty character, empty characters look like thermometers, although be careful not to confuse it with the actual thermometer if it is just erase it via right clicking and left clicking in the drawing field. now draw you character. and look in output1.txt, and the last number there is the char id and it corresponds to what icon you drew.
 +
 
 +
'''6)''' close down the editor and run:
 +
<syntaxhighlight lang="bash">
 +
rm ./font.h
 +
./packer > font.h
 +
cp -f ./font.h ../includes
 +
</syntaxhighlight>
  
'''8)''' for your new menu set the char id to what i told you to remember before.  
+
'''8)''' for your new menu, replace FF with the last number from the output1.txt file in the font directory.
 
<syntaxhighlight lang="c">
 
<syntaxhighlight lang="c">
 
{"\xFF", "new menu ftw", 0, 1},
 
{"\xFF", "new menu ftw", 0, 1},
 
</syntaxhighlight>
 
</syntaxhighlight>
Where FF is the new character ID.
 
  
 
'''9)''' Recompile The Powder Toy and you should be ready to go.
 
'''9)''' Recompile The Powder Toy and you should be ready to go.
  
 
[[Category:Development]]
 
[[Category:Development]]

Revision as of 00:38, 6 August 2012

If you downloaded the source from Github, then you'll find a folder called font. If you look inside it, you'll see that there is packer.c, unpacker.c and editor.c. If you don't see it, then you either downloaded the source code off of this website, or you deleted it somehow. If this is the case, then just download the source code again from here: The-Powder-Toy. The instructions for Windows and Linux are different, so be sure to follow the correct instructions.

Windows

1) Copy font.h from /includes and paste it into /font.

2) Navigate into /font, and open a Command Prompt here. Compile the font editor tools using the following commands:

make unpacker.exe packer.exe editor.exe

3) In the same terminal run the following command to create a font.bin file the editor can read:

unpacker.exe

5) Run the editor from the terminal and then use the "+" and "-" keys to go the end and find an empty character, empty characters look like thermometers, although be careful not to confuse it with the actual thermometer if it is just erase it via right clicking and left clicking in the drawing field. Now draw you character. Look in the stdout.txt file in the same directory, and the last number in the file is the char id that corresponds to whatever icon you drew.

6) Close down the editor, delete the font.h, and run:

packer.exe > font.h

7) Copy the new font.h into /includes, replacing the old one.

8) For your new menu, replace FF with the last number from the stdout.txt file in the font directory.

{"\xFF", "new menu ftw", 0, 1},

9) Recompile The Powder Toy and you should be ready to go.

Linux

1) Open a Terminal and cd to the font directory that's included with the Git source code.

2) Enter the following commands to copy font.h from includes to font and compile the font editor tools:

cp ../includes/font.h .
make unpacker packer editor

3) In the same terminal run the following command to create a font.bin file the editor can read:

./unpacker > output1.txt

5) Run the editor from the terminal and then use the "+" and "-" keys to go the end and find an empty character, empty characters look like thermometers, although be careful not to confuse it with the actual thermometer if it is just erase it via right clicking and left clicking in the drawing field. now draw you character. and look in output1.txt, and the last number there is the char id and it corresponds to what icon you drew.

6) close down the editor and run:

rm ./font.h
./packer > font.h
cp -f ./font.h ../includes

8) for your new menu, replace FF with the last number from the output1.txt file in the font directory.

{"\xFF", "new menu ftw", 0, 1},

9) Recompile The Powder Toy and you should be ready to go.