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 [2011-06-14 11:46]
Carsten Revised the text
guisys:making_new_fonts [2013-01-07 12:07]
Line 1: Line 1:
-====== The Font Wizard: Creating new fonts ====== 
- 
-Preparing fonts for rendering text within a GUI window is very easy. 
-The key idea is to convert a font file (e.g. one of those installed with your OS, or one downloaded from the Internet) to a set of graphics files that the Cafu GuiSys can use: 
- 
-{{ :​fontwizard:​fontwizard_0.png?​|Open the Font Wizard}} Start CaWE and select the related menu item to open the Font Wizard. <​clear>​ 
- 
-{{ :​fontwizard:​fontwizard_1.png?​|Step 1}} Step 1: The welcome page. <​clear>​ 
- 
-{{ :​fontwizard:​fontwizard_2.png?​|Step 2}} Step 2: Click the ''​...''​ browse button to select the desired font, or enter the filename directly into the related field. <​clear>​ 
- 
-{{ :​fontwizard:​fontwizard_3.png?​|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.<​clear>​ 
- 
-{{ :​fontwizard:​fontwizard_4.png?​|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 saved into this directory.<​clear>​ 
- 
-{{ :​fontwizard:​fontwizard_5.png?​|Step 5}} Step 5: Use the indicated name in the GUI Editor or a GUI script to activate the new font.<​clear>​ 
- 
- 
-===== Creating fonts at the command prompt ===== 
- 
-As an alternative to the above, fonts can also be created with the ''​MakeFont''​ program at the command prompt. Here is the sequence of commands the creates the same font as above: 
- 
-<code dos> 
-d:​\Dev\Cafu>​ cd Fonts 
-d:​\Dev\Cafu\Fonts>​ mkdir Segoe 
-d:​\Dev\Cafu\Fonts>​ cd Segoe 
-d:​\Dev\Cafu\Fonts\Segoe>​ 
-d:​\Dev\Cafu\Fonts\Segoe>​..\..\MakeFont.exe C:​\Windows\Fonts\segoe.ttf -m=Segoe 
-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. 
-</​code>​ 
-''​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/​Segoe"​);​ 
-</​code>​ 
-in the appropriate ''​OnInit()''​ function of the GUI window that should use the new "​Segoe"​ 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)