User Tools

Site Tools


This is an old revision of the document!


The Font Wizard: Creating new fonts

Creating new fonts for use with a GUI is very easy:

Open the Font Wizard Start CaWE and select the related menu item to open the Font Wizard.

Step 1 Step 1: The welcome page.

Step 2 Step 2: Click the browse button to select the desired font, or enter the filename directly into the related field.

Step 3 Step 3: Check the preview of the generated font texture. Optionally click the button to see a preview of all generated texture images.

Step 4 Step 4: Enter the name under which you would like to save the font. A new directory is created with the given name and all files related to the font are put into this directory.

Step 5 Step 5: Use the indicated name to use the font in the GUI Editor or a GUI script.

Creating fonts at the command prompt

As an alternative to the above, fonts can also be created with the MakeFont programm at the command prompt:

As a first step, you should create or obtain a font file of your desired font. For example, http://www.fontasy.de/ has a library of thousands of free fonts, I'm sure that there are many other places where fonts can be found if you don't want to create your own from scratch.

Then, please open the Windows command console, and cd into the proper directory of your copy of the Cafu SDK:

C:\>cd Cafu-9.06

C:\Cafu-9.06>

Lets assume that we wanted to add the “Times” font for use with a GUI of our own. Just cd into the Fonts directory, create a new directory Times there, and cd into that, too:

C:\Cafu-9.06>cd Fonts

C:\Cafu-9.06\Fonts>mkdir Times

C:\Cafu-9.06\Fonts>dir
 Datenträger in Laufwerk C: ist Carsten
 Datenträgernummer: BC03-5EAF

 Verzeichnis von C:\Cafu-9.06\Fonts

02.09.2006  13:09       <DIR>          .
02.09.2006  13:09       <DIR>          ..
02.09.2006  12:56       <DIR>          Arial
02.09.2006  12:56       <DIR>          Impact
02.09.2006  13:09       <DIR>          Times
08.03.2005  14:36                9.924 Arial.png
15.03.2005  17:07               28.359 FixedWidth.png
               2 Datei(en)         38.283 Bytes
               5 Verzeichnis(se),   3.013.181.440 Bytes frei

C:\Cafu-9.06\Fonts>cd Times

C:\Cafu-9.06\Fonts\Times>

Next let's run the MakeFont program:

C:\Cafu-9.06\Fonts\Times>..\..\MakeFont.exe C:\WINNT\Fonts\times.ttf -m=Times
The Cafu Font Maker, version July 01 2009.

Portions of this software are copyright (c) 2006 The FreeType Project
(www.freetype.org). All rights reserved.


C:\Cafu-9.06\Fonts\Times>

As you can see, MakeFont takes two parameters: first the name of the font file whose font you want to use with Cafu GUIs, then the base name of the font materials. The base name is specified as -m=<base_name>. Although MakeFont will also work if you omit the -m=… part, your fonts will not work properly without it, so please make sure to include it. (The Cafu MatSys needs this option in order to be able to render the fonts properly.)

Well, that's all! :-) Your font is ready to be used in a GUI. In the associated script, just write

    self:set("font", "Fonts/Times");

in the appropriate OnInit() function of the GUI window that should use the new “Times” font.

By the way: The name of the new font is always the name of its directory, using '/' slashes instead of '\'.

guisys/making_new_fonts.1307965672.txt.gz · Last modified: 2013-01-07 12:07 (external edit)