Font Pack Demo
Back
The Goal
You can make a mod to replace the font that is used in the game.
We will guide you through how to make such a mod.
We will replace the standard "White Rabbit" font that the game uses
and replace it with a higher resolution version.
Note: The image above uses the font "X Typewriter Bold".
A Useful Script
Font Converter:
The community member baltdev
has created a Python script
for generating individual images for characters of a
.ttl
font.
You may find it very useful for adding a font to FBW!
To use the script, you must download it and rename it to a
.py
file.
Step 1: Prerequisites
Make sure you have already read the
guide for making a texture pack guide
here.
Step 2: Set up the folders
Create a folder called my_font_mod
and put in the Input/Packages
directory of the game.
Create the file
Input/Packages/my_font_mod/dependencies.txt
and have it read as follows:
wf base
Create the folder my_font_mod/About
.
Within that folder, create the file
mod_for.txt
which should read as follows:
base
Also in my_font_mod/About
,
create the file install_dir.txt
which should read as follows:
Input/Packages
You can create the file
my_font_mod/About/about.txt
,
and have it read something like this:
This is a font mod to change the font that the game uses.
If you want, you could also create the file
my_font_mod/About/thumbnail.jpg
.
Create the folder my_font_mod/Textures
.
In that file you will need to create a file called
texture_names.txt
, which we will describe later.
Create the folder my_font_mod/Font
.
We will put files there later.
Step 3A: Font Texture Atlas
There are two ways to describe a font in Fractal Block World:
the first way is with a texture atlas like the following:
The filename and location for this image can be anything
(as long as it is a .png or .tga file).
However, the texture name for this must be
"font
"
(without the quotes).
For example, we could put the texture atlas image
above in the folder
my_font_mod/Font/
and call it "tex_font_atlas.png
".
We would then make the
my_font_mod/Textures/texture_names.txt
file read as follows:
font a ../Font/tex_font_atlas.png
Here we are saying that there is a texture named "font"
,
that has alpha, that maps to the file
../Font/tex_font_atlas.png
relative to
my_font_mod/Textures
.
In other words, the texture name "font
" maps
to the file "my_font_mod/Font/tex_font_atlas.png
".
We must also create the file my_font_mod/Font/tex_font_desc.txt
(and it must have this name and location exactly)
which describes the location of ASCII characters within the atlas.
Fonts for Fractal Block World must describe the ASCII characters
32 through 127 inclusive.
Here is a tex_font_desc.txt
file that goes with the atlas above:
#Format: ascii_num min_u min_v max_u max_v
#u = 0 is left
#v = 0 is bottom
32 0.0 0.904296875 0.07421875 1.001953125
33 0.08203125 0.904296875 0.15625 1.001953125
34 0.1640625 0.904296875 0.23828125 1.001953125
35 0.24609375 0.904296875 0.3203125 1.001953125
36 0.328125 0.904296875 0.40234375 1.001953125
37 0.41015625 0.904296875 0.484375 1.001953125
38 0.4921875 0.904296875 0.56640625 1.001953125
39 0.57421875 0.904296875 0.6484375 1.001953125
40 0.65625 0.904296875 0.73046875 1.001953125
41 0.73828125 0.904296875 0.8125 1.001953125
42 0.8203125 0.904296875 0.89453125 1.001953125
43 0.90234375 0.904296875 0.9765625 1.001953125
44 0.0 0.798828125 0.07421875 0.896484375
45 0.08203125 0.7828125 0.15625 0.896484375
46 0.1640625 0.798828125 0.23828125 0.896484375
47 0.24609375 0.798828125 0.3203125 0.896484375
48 0.328125 0.798828125 0.40234375 0.896484375
49 0.41015625 0.798828125 0.484375 0.896484375
50 0.4921875 0.798828125 0.56640625 0.896484375
51 0.57421875 0.798828125 0.6484375 0.896484375
52 0.65625 0.798828125 0.73046875 0.896484375
53 0.73828125 0.798828125 0.8125 0.896484375
54 0.8203125 0.798828125 0.89453125 0.896484375
55 0.90234375 0.798828125 0.9765625 0.896484375
56 0.0 0.693359375 0.07421875 0.791015625
57 0.08203125 0.693359375 0.15625 0.791015625
58 0.1640625 0.693359375 0.23828125 0.791015625
59 0.24609375 0.693359375 0.3203125 0.791015625
60 0.328125 0.693359375 0.40234375 0.791015625
61 0.41015625 0.693359375 0.484375 0.791015625
62 0.4921875 0.693359375 0.56640625 0.791015625
63 0.57421875 0.693359375 0.6484375 0.791015625
64 0.65625 0.693359375 0.73046875 0.791015625
65 0.73828125 0.693359375 0.8125 0.791015625
66 0.8203125 0.693359375 0.89453125 0.791015625
67 0.90234375 0.693359375 0.9765625 0.791015625
68 0.0 0.587890625 0.07421875 0.685546875
69 0.08203125 0.587890625 0.15625 0.685546875
70 0.1640625 0.587890625 0.23828125 0.685546875
71 0.24609375 0.587890625 0.3203125 0.685546875
72 0.328125 0.587890625 0.40234375 0.685546875
73 0.41015625 0.587890625 0.484375 0.685546875
74 0.4921875 0.587890625 0.56640625 0.685546875
75 0.57421875 0.587890625 0.6484375 0.685546875
76 0.65625 0.587890625 0.73046875 0.685546875
77 0.73828125 0.587890625 0.8125 0.685546875
78 0.8203125 0.587890625 0.89453125 0.685546875
79 0.90234375 0.587890625 0.9765625 0.685546875
80 0.0 0.482421875 0.07421875 0.580078125
81 0.08203125 0.482421875 0.15625 0.580078125
82 0.1640625 0.482421875 0.23828125 0.580078125
83 0.24609375 0.482421875 0.3203125 0.580078125
84 0.328125 0.482421875 0.40234375 0.580078125
85 0.41015625 0.482421875 0.484375 0.580078125
86 0.4921875 0.482421875 0.56640625 0.580078125
87 0.57421875 0.482421875 0.6484375 0.580078125
88 0.65625 0.482421875 0.73046875 0.580078125
89 0.73828125 0.482421875 0.8125 0.580078125
90 0.8203125 0.482421875 0.89453125 0.580078125
91 0.90234375 0.482421875 0.9765625 0.580078125
92 0.0 0.376953125 0.07421875 0.474609375
93 0.08203125 0.376953125 0.15625 0.474609375
94 0.1640625 0.376953125 0.23828125 0.474609375
95 0.24609375 0.376953125 0.3203125 0.474609375
96 0.328125 0.376953125 0.40234375 0.474609375
97 0.41015625 0.376953125 0.484375 0.474609375
98 0.4921875 0.376953125 0.56640625 0.474609375
99 0.57421875 0.376953125 0.6484375 0.474609375
100 0.65625 0.376953125 0.73046875 0.474609375
101 0.73828125 0.376953125 0.8125 0.474609375
102 0.8203125 0.376953125 0.89453125 0.474609375
103 0.90234375 0.376953125 0.9765625 0.474609375
104 0.0 0.271484375 0.07421875 0.369140625
105 0.08203125 0.271484375 0.15625 0.369140625
106 0.1640625 0.271484375 0.23828125 0.369140625
107 0.24609375 0.271484375 0.3203125 0.369140625
108 0.328125 0.271484375 0.40234375 0.369140625
109 0.41015625 0.271484375 0.484375 0.369140625
110 0.4921875 0.271484375 0.56640625 0.369140625
111 0.57421875 0.271484375 0.6484375 0.369140625
112 0.65625 0.271484375 0.73046875 0.369140625
113 0.73828125 0.271484375 0.8125 0.369140625
114 0.8203125 0.271484375 0.89453125 0.369140625
115 0.90234375 0.271484375 0.9765625 0.369140625
116 0.0 0.166015625 0.07421875 0.263671875
117 0.08203125 0.166015625 0.15625 0.263671875
118 0.1640625 0.166015625 0.23828125 0.263671875
119 0.24609375 0.166015625 0.3203125 0.263671875
120 0.328125 0.166015625 0.40234375 0.263671875
121 0.41015625 0.166015625 0.484375 0.263671875
122 0.4921875 0.166015625 0.56640625 0.263671875
123 0.57421875 0.166015625 0.6484375 0.263671875
124 0.65625 0.166015625 0.73046875 0.263671875
125 0.73828125 0.166015625 0.8125 0.263671875
126 0.8203125 0.166015625 0.89453125 0.263671875
You need to use some kind of software to generate
the font texture atlas and the tex_font_desc.txt
file.
Note: If you use this approach of having a single font atlas,
then you will need to disable the "individual character images"
in the texture_names.txt file as follows:
undefine font_char_ascii_32
undefine font_char_ascii_33
undefine font_char_ascii_34
undefine font_char_ascii_35
#...
Step 3B: Individual character images
Recall that we said there are two ways to describe a font in Fractal Block World.
The first way is with a texture atlas described in the previous section.
The second way is by having one texture image for each ASCII
character between 32 through 127 inclusive.
You can have these image files be called anything and in any location,
as long as they are .png or .tga files.
When Fractal Block World renders a character, it first
looks for an individual character image file.
If it cannot find that, it defaults to the texture atlas.
So if you have one character file for each ascii
character between 32 through 127 inclusive,
you do not actually need a texture atlas and
tex_font_desc.txt
file!
For simplicity, you might want to put all your individual character images
in my_font_mod/Font/IndividualChars
(create that folder if it does not exist already).
You could have the file names be of the form
"XX.png
" where XX
is a number
between 32 and 127 inclusive.
We need to tell the engine about the location of these files.
Here is how it works: for each number XX between 32 and 127,
the engine will look for the texture name
font_char_ascii_XX
.
So in summary, if we do not want to use the texture atlas approach,
then this should be our
texture_names.txt
file:
font_char_ascii_32 a ../Font/IndividualChars/32.png
font_char_ascii_33 a ../Font/IndividualChars/33.png
font_char_ascii_34 a ../Font/IndividualChars/34.png
font_char_ascii_35 a ../Font/IndividualChars/35.png
font_char_ascii_36 a ../Font/IndividualChars/36.png
font_char_ascii_37 a ../Font/IndividualChars/37.png
font_char_ascii_38 a ../Font/IndividualChars/38.png
font_char_ascii_39 a ../Font/IndividualChars/39.png
font_char_ascii_40 a ../Font/IndividualChars/40.png
font_char_ascii_41 a ../Font/IndividualChars/41.png
font_char_ascii_42 a ../Font/IndividualChars/42.png
font_char_ascii_43 a ../Font/IndividualChars/43.png
font_char_ascii_44 a ../Font/IndividualChars/44.png
font_char_ascii_45 a ../Font/IndividualChars/45.png
font_char_ascii_46 a ../Font/IndividualChars/46.png
font_char_ascii_47 a ../Font/IndividualChars/47.png
font_char_ascii_48 a ../Font/IndividualChars/48.png
font_char_ascii_49 a ../Font/IndividualChars/49.png
font_char_ascii_50 a ../Font/IndividualChars/50.png
font_char_ascii_51 a ../Font/IndividualChars/51.png
font_char_ascii_52 a ../Font/IndividualChars/52.png
font_char_ascii_53 a ../Font/IndividualChars/53.png
font_char_ascii_54 a ../Font/IndividualChars/54.png
font_char_ascii_55 a ../Font/IndividualChars/55.png
font_char_ascii_56 a ../Font/IndividualChars/56.png
font_char_ascii_57 a ../Font/IndividualChars/57.png
font_char_ascii_58 a ../Font/IndividualChars/58.png
font_char_ascii_59 a ../Font/IndividualChars/59.png
font_char_ascii_60 a ../Font/IndividualChars/60.png
font_char_ascii_61 a ../Font/IndividualChars/61.png
font_char_ascii_62 a ../Font/IndividualChars/62.png
font_char_ascii_63 a ../Font/IndividualChars/63.png
font_char_ascii_64 a ../Font/IndividualChars/64.png
font_char_ascii_65 a ../Font/IndividualChars/65.png
font_char_ascii_66 a ../Font/IndividualChars/66.png
font_char_ascii_67 a ../Font/IndividualChars/67.png
font_char_ascii_68 a ../Font/IndividualChars/68.png
font_char_ascii_69 a ../Font/IndividualChars/69.png
font_char_ascii_70 a ../Font/IndividualChars/70.png
font_char_ascii_71 a ../Font/IndividualChars/71.png
font_char_ascii_72 a ../Font/IndividualChars/72.png
font_char_ascii_73 a ../Font/IndividualChars/73.png
font_char_ascii_74 a ../Font/IndividualChars/74.png
font_char_ascii_75 a ../Font/IndividualChars/75.png
font_char_ascii_76 a ../Font/IndividualChars/76.png
font_char_ascii_77 a ../Font/IndividualChars/77.png
font_char_ascii_78 a ../Font/IndividualChars/78.png
font_char_ascii_79 a ../Font/IndividualChars/79.png
font_char_ascii_80 a ../Font/IndividualChars/80.png
font_char_ascii_81 a ../Font/IndividualChars/81.png
font_char_ascii_82 a ../Font/IndividualChars/82.png
font_char_ascii_83 a ../Font/IndividualChars/83.png
font_char_ascii_84 a ../Font/IndividualChars/84.png
font_char_ascii_85 a ../Font/IndividualChars/85.png
font_char_ascii_86 a ../Font/IndividualChars/86.png
font_char_ascii_87 a ../Font/IndividualChars/87.png
font_char_ascii_88 a ../Font/IndividualChars/88.png
font_char_ascii_89 a ../Font/IndividualChars/89.png
font_char_ascii_90 a ../Font/IndividualChars/90.png
font_char_ascii_91 a ../Font/IndividualChars/91.png
font_char_ascii_92 a ../Font/IndividualChars/92.png
font_char_ascii_93 a ../Font/IndividualChars/93.png
font_char_ascii_94 a ../Font/IndividualChars/94.png
font_char_ascii_95 a ../Font/IndividualChars/95.png
font_char_ascii_96 a ../Font/IndividualChars/96.png
font_char_ascii_97 a ../Font/IndividualChars/97.png
font_char_ascii_98 a ../Font/IndividualChars/98.png
font_char_ascii_99 a ../Font/IndividualChars/99.png
font_char_ascii_100 a ../Font/IndividualChars/100.png
font_char_ascii_101 a ../Font/IndividualChars/101.png
font_char_ascii_102 a ../Font/IndividualChars/102.png
font_char_ascii_103 a ../Font/IndividualChars/103.png
font_char_ascii_104 a ../Font/IndividualChars/104.png
font_char_ascii_105 a ../Font/IndividualChars/105.png
font_char_ascii_106 a ../Font/IndividualChars/106.png
font_char_ascii_107 a ../Font/IndividualChars/107.png
font_char_ascii_108 a ../Font/IndividualChars/108.png
font_char_ascii_109 a ../Font/IndividualChars/109.png
font_char_ascii_110 a ../Font/IndividualChars/110.png
font_char_ascii_111 a ../Font/IndividualChars/111.png
font_char_ascii_112 a ../Font/IndividualChars/112.png
font_char_ascii_113 a ../Font/IndividualChars/113.png
font_char_ascii_114 a ../Font/IndividualChars/114.png
font_char_ascii_115 a ../Font/IndividualChars/115.png
font_char_ascii_116 a ../Font/IndividualChars/116.png
font_char_ascii_117 a ../Font/IndividualChars/117.png
font_char_ascii_118 a ../Font/IndividualChars/118.png
font_char_ascii_119 a ../Font/IndividualChars/119.png
font_char_ascii_120 a ../Font/IndividualChars/120.png
font_char_ascii_121 a ../Font/IndividualChars/121.png
font_char_ascii_122 a ../Font/IndividualChars/122.png
font_char_ascii_123 a ../Font/IndividualChars/123.png
font_char_ascii_124 a ../Font/IndividualChars/124.png
font_char_ascii_125 a ../Font/IndividualChars/125.png
font_char_ascii_126 a ../Font/IndividualChars/126.png
font_char_ascii_127 a ../Font/IndividualChars/127.png
set font_char_ascii_32 clamp true
set font_char_ascii_33 clamp true
set font_char_ascii_34 clamp true
set font_char_ascii_35 clamp true
set font_char_ascii_36 clamp true
set font_char_ascii_37 clamp true
set font_char_ascii_38 clamp true
set font_char_ascii_39 clamp true
set font_char_ascii_40 clamp true
set font_char_ascii_41 clamp true
set font_char_ascii_42 clamp true
set font_char_ascii_43 clamp true
set font_char_ascii_44 clamp true
set font_char_ascii_45 clamp true
set font_char_ascii_46 clamp true
set font_char_ascii_47 clamp true
set font_char_ascii_48 clamp true
set font_char_ascii_49 clamp true
set font_char_ascii_50 clamp true
set font_char_ascii_51 clamp true
set font_char_ascii_52 clamp true
set font_char_ascii_53 clamp true
set font_char_ascii_54 clamp true
set font_char_ascii_55 clamp true
set font_char_ascii_56 clamp true
set font_char_ascii_57 clamp true
set font_char_ascii_58 clamp true
set font_char_ascii_59 clamp true
set font_char_ascii_60 clamp true
set font_char_ascii_61 clamp true
set font_char_ascii_62 clamp true
set font_char_ascii_63 clamp true
set font_char_ascii_64 clamp true
set font_char_ascii_65 clamp true
set font_char_ascii_66 clamp true
set font_char_ascii_67 clamp true
set font_char_ascii_68 clamp true
set font_char_ascii_69 clamp true
set font_char_ascii_70 clamp true
set font_char_ascii_71 clamp true
set font_char_ascii_72 clamp true
set font_char_ascii_73 clamp true
set font_char_ascii_74 clamp true
set font_char_ascii_75 clamp true
set font_char_ascii_76 clamp true
set font_char_ascii_77 clamp true
set font_char_ascii_78 clamp true
set font_char_ascii_79 clamp true
set font_char_ascii_80 clamp true
set font_char_ascii_81 clamp true
set font_char_ascii_82 clamp true
set font_char_ascii_83 clamp true
set font_char_ascii_84 clamp true
set font_char_ascii_85 clamp true
set font_char_ascii_86 clamp true
set font_char_ascii_87 clamp true
set font_char_ascii_88 clamp true
set font_char_ascii_89 clamp true
set font_char_ascii_90 clamp true
set font_char_ascii_91 clamp true
set font_char_ascii_92 clamp true
set font_char_ascii_93 clamp true
set font_char_ascii_94 clamp true
set font_char_ascii_95 clamp true
set font_char_ascii_96 clamp true
set font_char_ascii_97 clamp true
set font_char_ascii_98 clamp true
set font_char_ascii_99 clamp true
set font_char_ascii_100 clamp true
set font_char_ascii_101 clamp true
set font_char_ascii_102 clamp true
set font_char_ascii_103 clamp true
set font_char_ascii_104 clamp true
set font_char_ascii_105 clamp true
set font_char_ascii_106 clamp true
set font_char_ascii_107 clamp true
set font_char_ascii_108 clamp true
set font_char_ascii_109 clamp true
set font_char_ascii_110 clamp true
set font_char_ascii_111 clamp true
set font_char_ascii_112 clamp true
set font_char_ascii_113 clamp true
set font_char_ascii_114 clamp true
set font_char_ascii_115 clamp true
set font_char_ascii_116 clamp true
set font_char_ascii_117 clamp true
set font_char_ascii_118 clamp true
set font_char_ascii_119 clamp true
set font_char_ascii_120 clamp true
set font_char_ascii_121 clamp true
set font_char_ascii_122 clamp true
set font_char_ascii_123 clamp true
set font_char_ascii_124 clamp true
set font_char_ascii_125 clamp true
set font_char_ascii_126 clamp true
set font_char_ascii_127 clamp true
We will explain the "clamp" stuff later.
Note that you can do a mixture of the
two approaches.
Here is what the texture_name.txt
file would look like if you wanted
to use a texture atlas but have an image
to override the lowercase letter "b" (ASCII 98):
#The texture atlas for all characters:
font a ../Font/tex_font_atlas.png
#Overriding individual characters:
font_char_ascii_98 a ../Font/IndividualChars/98.png
set font_char_ascii_98 clamp true
Auto-generating texture_names.txt
Here is a python script to generate
a texture_names.txt file similar to the large one above:
#!python
f = open("./texture_names.txt", "w")
f.write("#------------------------------------------------\n")
f.write("#The texture name \"font\" is special.\n")
f.write("#It is used by the engine for rending fonts.\n")
f.write("\n")
f.write("#We are having the texture atlas be red.\n")
f.write("#This way if an individual character file\n")
f.write("#is not found, we will see a red character.\n")
f.write("\n")
f.write("font a ../Font/tex_font_atlas.png\n")
f.write("\n")
f.write("#------------------------------------------------\n")
f.write("#Texture names that start with \"font_char_ascii_\"\n")
f.write("#are also special. They are used by the engine to\n")
f.write("#render individual characters.\n")
f.write("\n")
for i in range(32, 128):
line = "font_char_ascii_" + str(i) + " a ../Font/IndividualChars/" + str(i) + ".png"
f.write(line + "\n")
f.write("\n")
f.write("#------------------------------------------------\n")
f.write("#We need to set clamping to true for each font character texture.\n")
f.write("\n")
for i in range(32, 128):
line = "set font_char_ascii_" + str(i) + " clamp true"
f.write(line + "\n")
f.close()
Why do we need "clamp"?
Fractal Block World will use the "repeat" mode for texture wrapping by
default.
This can cause problems when individual character images are used
and part of the character is on the edge of the image.
This is what it might look like to use individual
character images without clamping:
Notice that there are thin lines under the capital
A, D, and O (because the top of these characters touch
the border and we are using repeat mode for texture wrapping.
On the other hand, by setting the clamp variable of the
individual character files to true,
it looks like the following:
Step 4: Play It!
Open up Fractal Block World.
Assuming that the xar package is what you typically play,
go to Options -> Select Mods
and select xar
as the package you want to select mods for.
You will see a list of available packages on the left.
One of them should be your my_font_mod
.
Move this from the left to the right.
Now start a new game or load a game that uses
the xar package.
You should see your font used everywhere!
Download
Here
is the promised high resolution White Rabbit font mod.