User Tools

Site Tools


Differences

This shows you the differences between two versions of the page.

Link to this comparison view

guisys:making_new_fonts [2009-07-04 13:39]
127.0.0.1 external edit
guisys:making_new_fonts [2013-01-07 12:07]
Line 1: Line 1:
-====== Making New Fonts ====== 
- 
-Making new fonts for use with a GUI is very easy. The latest Cafu SDK includes the ''​MakeFont''​ command-line program for this purpose. The ''​MakeFont''​ is included both in a version for Microsoft Windows as well as for i386 Linux, but in the examples below I'll just assume that you work under Windows. Using Linux, the process is analogous. 
- 
-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: 
-<​code>​ 
-C:\>cd Cafu-9.06 
- 
-C:​\Cafu-9.06>​ 
-</​code>​ 
- 
-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: 
-<​code>​ 
-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>​ 
-</​code>​ 
- 
-Next let's run the ''​MakeFont''​ program: 
-<​code>​ 
-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>​ 
-</​code>​ 
-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 
-<​code=lua>​ 
-    self:​set("​font",​ "​Fonts/​Times"​);​ 
-</​code>​ 
-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.txt · Last modified: 2013-01-07 12:07 (external edit)