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

From The Powder Toy
Jump to: navigation, search
(Enter a short summary [b])
m (Reverted edits by HerpesMaster11 (talk) to last revision by LBPHacker)
Line 1: Line 1:
My name is Walter Hartwell White. I live at 308 Negra Arroyo Lane, Albuquerque, New Mexico, 87104. This is my confession. If you're watching this tape, I'm probably dead- murdered by my brother-in-law, Hank Schrader. Hank has been building a meth empire for over a year now, and using me as his chemist. Shortly after my 50th birthday, he asked that I use my chemistry knowledge to cook methamphetamine, which he would then sell using connections that he made through his career with the DEA. I was... astounded. I... I always thought Hank was a very moral man, and I was particularly vulnerable at the time - something he knew and took advantage of. I was reeling from a cancer diagnosis that was poised to bankrupt my family. Hank took me in on a ride-along and showed me just how much money even a small meth operation could make. And I was weak. I didn't want my family to go into financial ruin, so I agreed. Hank had a partner, a businessman named Gustavo Fring. Hank sold me into servitude to this man. And when I tried to quit, Fring threatened my family. I didn't know where to turn. Eventually, Hank and Fring had a falling-out. Things escalated. Fring was able to arrange - uh, I guess... I guess you call it a "hit" - on Hank, and failed, but Hank was seriously injured. And I wound up paying his medical bills, which amounted to a little over $177,000. Upon recovery, Hank was bent on revenge. Working with a man named Hector Salamanca, he plotted to kill Fring. The bomb that he used was built by me, and he gave me no option in it. I have often contemplated suicide, but I'm a coward. I wanted to go to the police, but I was frightened. Hank had risen to become the head of the Albuquerque DEA. To keep me in line, he took my children. For three months, he kept them. My wife had no idea of my criminal activities, and was horrified to learn what I had done. I was in hell. I hated myself for what I had brought upon my family. Recently, I tried once again to quit, and in response, he gave me this. [Walt points to the bruise on his face left by Hank in "Blood Money."] I can't take this anymore. I live in fear every day that Hank will kill me, or worse, hurt my family. All I could think to do was to make this video and hope that the world will finally see this man for what he really is.
+
== Icons ==
 +
Any icons specific to The Powder Toy are allocated from one of the private use areas of unicode: U+E000 through U+F8FF. If you wish to add a new icon you should allocate it from that range.
 +
 
 +
== Compiling the font editor ==
 +
 
 +
The data for the font is specified in <code>data/font.bz2</code> but editing that file by hand is a bad idea. The TPT source comes with a graphical editor for this file, which you can build by setting the <code>build_font</code> option to <code>true</code>, as explained in [[Building TPT with Meson|the meson guide]]. This will produce an executable called <code>font</code> or <code>font.exe</code>. You will have to pass the path to <code>data/font.bz2</code> to it as a command line argument, e.g. <code>font.exe ..\data\font.bz2</code> or <code>build\font.exe data\font.bz2</code>.
 +
 
 +
== Editing the font ==
 +
 
 +
After opening <code>font.bz2</code> using the font editor you will be presented with a GUI. The top part contains the character currently being edited. Below you can select the unicode codepoint you're currently looking at (in hexadecimal, or using the arrows), make the character wider or narrower, create or delete the character, toggle the grid and the rulers (take a look at several uppercase and lowercase characters, characters with lower hooks and accents, to see how these rulers are used).
 +
Below you can configure the foreground and background colors for the editor (sometimes useful for multi-colored icons). "Render" reflects your changes in the font editor program itself, and "Save" saves your changes into <code>font.bz2</code>. On the bottom left there is a text field into which you can enter codepoints in hexadecimal, and they will be rendered on the bottom right, this is to test what they look like among other text.
 +
 
 +
The font editor also supports some key bindings: Left and Right to switch between characters; Shift-Left, Right, Up, Down to shift the current character by 1 pixel in either direction; C to copy the current character and V to paste; Q to exit.
 +
 
 +
Once you're done with editing the font press "Save" and exit. This will update <code>font.bz2</code> so next time you compile TPT it will include your changes to the font.
 +
 
 +
== Menu Icons ==
 +
 
 +
Defines for the menu sections are located in <code>simulation/SimulationData.h</code>. Take a look at <code>LoadMenus()</code> in <code>simulation/SimulationData.cpp</code>. The first column is the unicode codepoint for the icon, the second column is the menu name. These are what you need to edit to create a new menu.
 +
 
 +
[[Category:Development]]

Revision as of 04:54, 26 December 2022

Icons

Any icons specific to The Powder Toy are allocated from one of the private use areas of unicode: U+E000 through U+F8FF. If you wish to add a new icon you should allocate it from that range.

Compiling the font editor

The data for the font is specified in data/font.bz2 but editing that file by hand is a bad idea. The TPT source comes with a graphical editor for this file, which you can build by setting the build_font option to true, as explained in the meson guide. This will produce an executable called font or font.exe. You will have to pass the path to data/font.bz2 to it as a command line argument, e.g. font.exe ..\data\font.bz2 or build\font.exe data\font.bz2.

Editing the font

After opening font.bz2 using the font editor you will be presented with a GUI. The top part contains the character currently being edited. Below you can select the unicode codepoint you're currently looking at (in hexadecimal, or using the arrows), make the character wider or narrower, create or delete the character, toggle the grid and the rulers (take a look at several uppercase and lowercase characters, characters with lower hooks and accents, to see how these rulers are used). Below you can configure the foreground and background colors for the editor (sometimes useful for multi-colored icons). "Render" reflects your changes in the font editor program itself, and "Save" saves your changes into font.bz2. On the bottom left there is a text field into which you can enter codepoints in hexadecimal, and they will be rendered on the bottom right, this is to test what they look like among other text.

The font editor also supports some key bindings: Left and Right to switch between characters; Shift-Left, Right, Up, Down to shift the current character by 1 pixel in either direction; C to copy the current character and V to paste; Q to exit.

Once you're done with editing the font press "Save" and exit. This will update font.bz2 so next time you compile TPT it will include your changes to the font.

Menu Icons

Defines for the menu sections are located in simulation/SimulationData.h. Take a look at LoadMenus() in simulation/SimulationData.cpp. The first column is the unicode codepoint for the icon, the second column is the menu name. These are what you need to edit to create a new menu.