This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
guisys:making_new_fonts [2011-06-15 14:51] carsten Augmented and improved the text |
guisys:making_new_fonts [2011-06-16 10:51] Carsten Small improvements / fixes |
||
---|---|---|---|
Line 2: | Line 2: | ||
Preparing new fonts for rendering text within a GUI is very easy. | Preparing new fonts for rendering text within a GUI 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: | + | The key idea is to convert a font file (e.g. one of those installed with your OS, or 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_0.png?|Open the Font Wizard}} Start CaWE and select the related menu item to open the Font Wizard. <clear> | ||
Line 13: | Line 13: | ||
In order to overcome the problem, i.e. if you want to use a system font from ''C:\Windows\Fonts'' with the Font Wizard, we recommend to either | In order to overcome the problem, i.e. if you want to use a system font from ''C:\Windows\Fonts'' with the Font Wizard, we recommend to either | ||
- | * type the path and file name of the desired font manually into the related input field, or | + | * type the path and file name of the desired font manually into the input field, or |
* at the command prompt copy the desired font files from ''C:\Windows\Fonts'' into any other directory, then use the "''...''" browse button to select the related file. <clear> | * at the command prompt copy the desired font files from ''C:\Windows\Fonts'' into any other directory, then use the "''...''" browse button to select the related file. <clear> | ||
Line 20: | Line 20: | ||
{{ :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_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> | + | {{ :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 (see below for details).<clear> |
===== Creating fonts at the command prompt ===== | ===== 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: | + | 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 that creates the same font as above: |
<code dos> | <code dos> | ||
Line 42: | Line 42: | ||
===== Using the newly created font ===== | ===== Using the newly created font ===== | ||
- | Your font is now ready to be used in a GUI. Its name always begins with ''Fonts/'', followed by the previously chosen font name. In our example above, the font name is ''Fonts/Segoe''. | + | {{ :fontwizard:new_font_gui_editor.png?|Activate the new font in the GUI Editor}} Your font is now ready to be used in a GUI. Its name always begins with ''Fonts/'', followed by the previously chosen font name. In our example above, the font name is ''Fonts/Segoe''. |
In the GUI Editor, enter the font name into the appropriate field of the window that should use the font. | In the GUI Editor, enter the font name into the appropriate field of the window that should use the font. | ||
- | Alternatively, if you edit the associated GUI script manually, just write | + | Alternatively, if you edit the GUI script manually, just add |
<code=lua> | <code=lua> | ||
self:set("font", "Fonts/Segoe"); | self:set("font", "Fonts/Segoe"); | ||
</code> | </code> | ||
- | in the appropriate ''OnInit()'' function of the GUI window that should use the new font. | + | to the appropriate ''OnInit()'' function to use the new font. |