Fonts
- QuestOfDreams
- Site Admin
- Posts: 1520
- Joined: Sun Jul 03, 2005 11:12 pm
- Location: Austria
- Contact:
Re: Fonts
First, you can use either static bitmapped fonts (Pixmap)or dynamically created fonts based upon standard font files such as .ttf files (FreeType).
Both types require a .font file (by default stored in gui/fonts) in xml format that describes the font (name, filename, type ...; see GUI -> Font XML Files in the manual for details). For bitmapped fonts this file also contains information about mapping characters to a region (image) of the font bitmap.
Pixmap fonts also require an image file containing the characters and an .imageset xml file describing the region (image) of each character on the font bitmap. These files should be placed in the gui/imagesets folder.
FontStudio can automatically generate all three required files for you (.font file, .imageset file, image).
FreeType fonts require a .ttf font file that is present in your system folder or in the gui/fonts folder (the save way when giving your game to others; Note that also ttf files have licenses telling you if/how they can be redistributed). You may have a look at the sample .font files (e.g. tahoma.font) to see how they are defined.
That's all to define the font itself for CEGUI.
To actually use your font it must be loaded via a scheme you are using. You have to add a line like
to your .scheme file.
To use your font as default font, you can change the DefaultFont setting in gui/configs/cegui.config (also an xml file).
To use your font only for a specific window you can add a line like
to a window definition in a layout file.
Both types require a .font file (by default stored in gui/fonts) in xml format that describes the font (name, filename, type ...; see GUI -> Font XML Files in the manual for details). For bitmapped fonts this file also contains information about mapping characters to a region (image) of the font bitmap.
Pixmap fonts also require an image file containing the characters and an .imageset xml file describing the region (image) of each character on the font bitmap. These files should be placed in the gui/imagesets folder.
FontStudio can automatically generate all three required files for you (.font file, .imageset file, image).
FreeType fonts require a .ttf font file that is present in your system folder or in the gui/fonts folder (the save way when giving your game to others; Note that also ttf files have licenses telling you if/how they can be redistributed). You may have a look at the sample .font files (e.g. tahoma.font) to see how they are defined.
That's all to define the font itself for CEGUI.
To actually use your font it must be loaded via a scheme you are using. You have to add a line like
Code: Select all
<Font Name="Tahoma" Filename="tahoma.font" />
To use your font as default font, you can change the DefaultFont setting in gui/configs/cegui.config (also an xml file).
To use your font only for a specific window you can add a line like
Code: Select all
<Property Name="Font" Value="Tahoma" />
Re: Fonts
Okay. It's a lot to soak in. I thought I followed the help file all the way, but I must have missed something. This coming weekend, I will give this a go. Thanks, QOD!
Steve Dilworth - Resisting change since 1965!
- QuestOfDreams
- Site Admin
- Posts: 1520
- Joined: Sun Jul 03, 2005 11:12 pm
- Location: Austria
- Contact:
Re: Fonts
Have you figured it out or do you need some more information?
- QuestOfDreams
- Site Admin
- Posts: 1520
- Joined: Sun Jul 03, 2005 11:12 pm
- Location: Austria
- Contact:
Re: Fonts
Ok, let's assume you just want a different (bitmapped) font for the New Game button in the main menu.
Move the Calibri12.imageset file and the Calibri12.png file to the gui/imagesets folder.
Open the RFLook.scheme file in the gui/schemes folder with the RF Script Editor. After the line
add
Open the menu_main.layout file in the gui/layouts folder with the RF Script Editor.
Find the definition of the New Game Button that starts with the line
To the list of properties add the Font property:
If RF doesn't display the png file correctly, you may have to convert it to a tga file (e.g. using GIMP).
Then you have to open the Calibri12.imageset file and in the 2nd line find
and change it to
- If you haven't done so already, extract the FontStudio421.zip file in the tools folder.
- Open FontStudio. On the left side you see a preview of the font image, on the right side you can customize the font.
- Select the the font, its size and attributes. I chose Calibri and size 12.
- In this example I left the character range and placement at their default values.
- On the General Settings tab increase the texture size to 256x256 (click Apply) so all characters fit on the image.
- Click on the Export button and select Export to CEGUI Font File. Save as Calibri12.
- This will generate 3 files: Calibri12.font, Calibri12.imageset and Calibri12.png.
Move the Calibri12.imageset file and the Calibri12.png file to the gui/imagesets folder.
Open the RFLook.scheme file in the gui/schemes folder with the RF Script Editor. After the line
Code: Select all
<Font Name="Tahoma" Filename="tahoma.font" />
Code: Select all
<Font Name="Calibri12" Filename="Calibri12.font" />
Find the definition of the New Game Button that starts with the line
Code: Select all
<Window Type="RFLook/Button" Name="Menu/Main/NewGame" >
Code: Select all
<Property Name="Font" Value="Calibri12" />
Then you have to open the Calibri12.imageset file and in the 2nd line find
Code: Select all
Imagefile="Calibri12.png"
Code: Select all
Imagefile="Calibri12.tga"
Re: Fonts
Got it!!! Thank you, Daniel, for all your patience and help. I also was able to figure how to do what I really wanted in the first place...change the text on the countdown timer. Not the type style I want yet, but that will come this weekend now that I know how.
[edit]I had to convert to TGA.
[edit]I had to convert to TGA.
Steve Dilworth - Resisting change since 1965!
Re: Fonts
All right! I have successfully placed my own font in the HUD for the health indicator. I have also created my own graphic health indicator. I'll attach a screen.
The Eye of Horus disappears as you lose health, and yes...that is a flying carpet!
The Eye of Horus disappears as you lose health, and yes...that is a flying carpet!
- Attachments
-
- newhud3.jpg
- (74.35 KiB) Not downloaded yet
Steve Dilworth - Resisting change since 1965!
Re: Fonts
Very nice Egyptian Hud graphic Steve, feels like am back in the good old game days of 2001.
Is that carpet a magic flying one that you can carry you to that place?Maybe spoil the of the elements.
It is not absolutely needed to answer and spoil the adventure surprise ,I am glad i see a new RF level screenshot.
Is that carpet a magic flying one that you can carry you to that place?Maybe spoil the of the elements.
It is not absolutely needed to answer and spoil the adventure surprise ,I am glad i see a new RF level screenshot.
Re: Fonts
Thank you, Veleran. I'm loving creating with RF again. Hard to believe it was 2003 when I completed Castle of the Pharaoh. So long ago...Veleran wrote:Very nice Egyptian Hud graphic Steve, feels like am back in the good old game days of 2001.
Is that carpet a magic flying one that you can carry you to that place?Maybe spoil the of the elements.
It is not absolutely needed to answer and spoil the adventure surprise ,I am glad i see a new RF level screenshot.
Yep, magic carpet to take you to the entrance of the pyramid. You will have to find it, though. I haven't added in all the buildings.
Steve Dilworth - Resisting change since 1965!