Difference between revisions of "Font Tutorial"

From Oldunreal-Wiki
Jump to navigation Jump to search
Line 1: Line 1:
=Creating Localized Fonts=
=Creating Fonts=
==Bitmap Fonts==
==Bitmap Fonts==
===Base===
===Creating Custom Font===
Create texture that corresponds Unreal texture rules, it should be size MxN, where M or M  is power of two(2, 4, 8, 16, 32, 64, 128, 256, 512, 1024) and image should be indexed(8-bit color)
Download reference textures and draw your fonts in order like on MedFont texture. NOTE: empty cells in grid is characters too
All chars should be in grid like on reference textures.
Make sure that grid's color is last(255) color in image palette. Make it light green or something like that, but be sure not to use this color in your font!
Save file as pcx or bmp
 
====Using in Game====
Export font in your class:
 
  #exec Font Import File=Textures\MyFont.pcx Name=MyFont
 
TODO: Write how to draw text
 
===Creating Localized Fonts===
 
First, you need base fonts to make yours.
First, you need base fonts to make yours.


Line 12: Line 27:
NOTE: Grid might be incorrect, report if you find mistake.
NOTE: Grid might be incorrect, report if you find mistake.


===Editing===
====Editing====
You need to explore which position corresponds each character from your charset. And just substitute glyph with your symbol's glyph. But obey order!
You need to explore which position corresponds each character from your charset. And just substitute glyph with your symbol's glyph. But obey order!


===Importing===
====Importing====
Save this text in text file and place it into your System/ directory.
Save this text in text file and place it into your System/ directory.
Remember to change it for your purposes.
Remember to change it for your purposes.
Line 28: Line 43:
When type exec <you_file_name>.txt in UnrealEd to import fonts into Unreal!
When type exec <you_file_name>.txt in UnrealEd to import fonts into Unreal!


===Using in game===
====Using in game====
Find section [Fonts] in your Engine.??t and replace fonts with yours.
Find section [Fonts] in your Engine.??t and replace fonts with yours.


Line 40: Line 55:
   SmallFont=MyFonts.SmallFont
   SmallFont=MyFonts.SmallFont


===Known Problems===
====Known Problems====
Some troubles with font mapping using UTF-16
Some troubles with font mapping using UTF-16



Revision as of 09:52, 31 January 2010

Creating Fonts

Bitmap Fonts

Creating Custom Font

Create texture that corresponds Unreal texture rules, it should be size MxN, where M or M is power of two(2, 4, 8, 16, 32, 64, 128, 256, 512, 1024) and image should be indexed(8-bit color) Download reference textures and draw your fonts in order like on MedFont texture. NOTE: empty cells in grid is characters too All chars should be in grid like on reference textures. Make sure that grid's color is last(255) color in image palette. Make it light green or something like that, but be sure not to use this color in your font! Save file as pcx or bmp

Using in Game

Export font in your class:

 #exec Font Import File=Textures\MyFont.pcx Name=MyFont

TODO: Write how to draw text

Creating Localized Fonts

First, you need base fonts to make yours.

I created fonts imported from Unreal with grid.

It's SmallFont, MedFont, BigFont, LargeFont and WhiteFont

Download Fonts

NOTE: Grid might be incorrect, report if you find mistake.

Editing

You need to explore which position corresponds each character from your charset. And just substitute glyph with your symbol's glyph. But obey order!

Importing

Save this text in text file and place it into your System/ directory. Remember to change it for your purposes.

  Font Import File=texture0.pcx PACKAGE="MyFonts" Name=SmallFont
  Font Import File=texture1.pcx PACKAGE="MyFonts" Name=MedFont
  Font Import File=texture2.pcx PACKAGE="MyFonts" Name=LargeFont
  Font Import File=texture3.pcx PACKAGE="MyFonts" Name=BigFont
  Font Import File=texture7.pcx PACKAGE="MyFonts" Name=WhiteFont
  OBJ SAVEPACKAGE PACKAGE="MyFonts" FILE="..\Textures\MyFonts.utx"

When type exec <you_file_name>.txt in UnrealEd to import fonts into Unreal!

Using in game

Find section [Fonts] in your Engine.??t and replace fonts with yours.

Example:

 [Fonts]
 WhiteFont=MyFonts.WhiteFont
 MedFont=MyFonts.MedFont
 LargeFont=MyFonts.LargeFont
 BigFont=MyFonts.BigFont
 SmallFont=MyFonts.SmallFont

Known Problems

Some troubles with font mapping using UTF-16

TrueType Fonts

Base

You can use your system fonts as a base for in-game fonts.

Editing

Edit fonts in font editor by copying your set of characters to first 255 entries.

TODO: Add Count overview

Importing

Use this script to import TrueType fonts to Unreal


  new TrueTypeFontFactory PACKAGE="UWindowFonts" Name=Tahoma10 FontName="Tahoma" Height=10 AntiAlias=0
  new TrueTypeFontFactory PACKAGE="UWindowFonts" Name=Tahoma20 FontName="Tahoma" Height=20 AntiAlias=1
  new TrueTypeFontFactory PACKAGE="UWindowFonts" Name=Tahoma30 FontName="Tahoma" Height=30 AntiAlias=1 CharactersPerPage=32
  new TrueTypeFontFactory PACKAGE="UWindowFonts" Name=TahomaB10 FontName="Tahoma Bold" Height=10 AntiAlias=1
  new TrueTypeFontFactory PACKAGE="UWindowFonts" Name=TahomaB20 FontName="Tahoma Bold" Height=20 AntiAlias=1 XPad=2
  new TrueTypeFontFactory PACKAGE="UWindowFonts" Name=TahomaB30 FontName="Tahoma Bold" Height=30 AntiAlias=1 CharactersPerPage=32 XPad=2
  new TrueTypeFontFactory PACKAGE="UWindowFonts" Name=UTFont12 FontName="Verdana" Height=12 AntiAlias=0
  new TrueTypeFontFactory PACKAGE="UWindowFonts" Name=UTFont24 FontName="Arial Narrow" Height=24 AntiAlias=1
  new TrueTypeFontFactory PACKAGE="UWindowFonts" Name=UTFont40 FontName="Arial Bold" Height=40 CharactersPerPage=32 AntiAlias=1
  OBJ SAVEPACKAGE PACKAGE="UWindowFonts" FILE="..\Textures\UWindowFonts.utx"

Save it as text file, launch UnrealEd and write in command field exec <text_file_name>.txt

Known Problems

Fonts Tahoma and Arial Bold don't import, but succesfully import in Wine.

Links

http://unreal.epicgames.com/TTFImport.htm