Go Back   www.tombraiderforums.com > Tomb Raider Modding > Tomb Raider Level Editor > Tutorials and Resources

Thread Tools
Old 19-03-17, 05:01   #1
Niveus's Avatar
Join Date: Feb 2010
Location: United Kingdom Gender: Male
Posts: 3,279
Default Creating Fonts Using Leikkuri & GIMP

I've noticed that Gekkokid's old tutorial on how to create fonts using Leikkuri has gone down. So I decided to recreate it with new images, while using the free, open source image manipulation program GIMP.

Sidenote: throughout the tutorial, I'll explain some steps in small print. If you are a pro , or if you don't care to read the extra information, you can skip these small prints.

There are advantages and disadvantages to creating your font using Leikkuri.

  • The end result is often vastly better looking than the result using the TRNG method.

  • The process is more time consuming - probably it takes 45 minutes, or more if you are a perfectionist. The good thing is, if you have limited time, it is easy to stop what you're doing and come back later.
  • You can only use one font throughout your game for the menus and title screen, since this method patches directly the executable (however, you can still use TRNG scripting to use Windows fonts on diaries and screen text, etc).

  • If you are using a font from online, install it before you open GIMP.
  • If you patch your tomb4 with FLEP after Leikkuri, then FLEP will throw up an error on startup saying that the executable has been tampered with using some other tool. This is normal, and can be disregarded.
  • As you know, TR4 engine cannot utilise “alpha channels” to make a smooth blur between coloured pixels and transparent ones. All pixels must be opaque or transparent, otherwise you end up with those ugly magenta pixels on the borders of your textures, because the semi-transparent pixels are assumed to be fully opaque in the image formats TRLE can handle. That is the reason behind this method.
  • When selecting your font, a good font to use is one that is sans serif and uncomplicated. Sans serif means a font that is without the traditional swishes and embellishments you can see on “Latinate” fonts like Times New Roman, Georgia, etc. Ariel is an example of a standard sans serif font (but then, I wouldn't use Ariel, as it's a very boring recognisable font).

    Fig.1 A serif font

    Fig.2 A sans serif font

    In this tutorial I will show example of both sans serif and serif fonts to visualise the differences - you can then make your own decision.
  • Massive credit to Gekkokid for his original tutorial. If you really don't jam with GIMP, you can use Photoshop and follow his and my tutorial side by side. I do explain everything in detail, so no previous GIMP experience is necessary.

  • You should recompile all your levels, including the title, after the tutorial is complete in order for the changes to be displayed.
  • In this tutorial I use “single windowed mode” for simplicity, if you're having trouble finding something in GIMP. To use this mode go to Windows > Single-Windowed Mode (it should then be ticked).

What you will need:
Leikkuri | Can be downloaded from old TREP homepage
FontEdit | Can be downloaded from TRSearch*
GIMP | Here
Kick-ass font
A perfectionist mentality

*TRSearch.org is in the process of moving to a new server. This link may go dead and need to be updated!!! Please PM me if it does appear to be dead and I will track down the new page. Link active as of 19/03/2017!

  1. Laying out the font
  2. Creating a smoother border
  3. Cutting up the font map with Leikkuri
  4. Creating the font.pc using FontEdit
  5. Character list
  6. Comparison between sans and serif fonts
  7. Adding a bevel effect à la TR1 and TR2
Niveus is offline   Reply With Quote
Old 19-03-17, 05:05   #2
Niveus's Avatar
Join Date: Feb 2010
Location: United Kingdom Gender: Male
Posts: 3,279

  • 1.1 Once you have selected your font, and you're ready to go, open GIMP. Go to File > New... and create a new image with the dimensions 256 by 256 pixels.


  • 1.2 Go to the layers stack, select the “Background” layer, and delete it using the 'bin' icon.


  • 1.3 Create a new layer using the 'blank page' icon (near the 'bin' icon we just used in the layers stack).


    A dialogue will open asking for input. Dimensions should be automatically 256 by 256 pixels, so under “Layer Fill Type” select “Foreground colour”, which by default when opening GIMP will be black.

  • 1.4 Once you have your new black layer, select the Text tool (bold 'A' icon) in the tool box.


  • 1.5 Make sure the foreground colour is white (click in the palette, and move the cross-hair to white), and have your font selected (you can type it to find it quicker). I am using Parkinson Medium. We will worry about size later.


  • 1.6 Next, click onto your image and a text layer will be created ready for you to type your text. We need to type here every conceivable character that tomb4 will need when displaying text.

    You can also put here any custom symbols that you want, to make your game unique, but bear in mind it will take up the space of an already existing character. I'll show you how to do that later on in the thread.


    Here I've already written what I will be using for you to copy paste if you like (cross referenced with the original map used by TR4):
    The three As after the cedilla (or, 'squiggly c') are there for their diacritics. Later we will erase these three As.

  • 1.8 You then need to readjust the size of your text layer so that it all fits to your image. Click and hold in the ruler on the left, and then drag the curser over the image to create a guide. You can see how far along in pixels the guide is in the image, in the bottom centre-left. We want the guide to be 2 pixels along.


    Let go once it's at 2, and your guide will be dropped on the image. We want to create one at 254 pixels along, as well.

    The reason we are using guides is because we want the text layer to be as large as possible, to maintain the quality of the font, but not too large that the borders we are going to add later will spill outside the boundaries of the image. Guides is a simple way to do this.

  • 1.9 Once you've got your horizontal guides, we want vertical ones, as well, at the same distances. Click the ruler above the image and drag onto the canvas. First guide at 2 pixels, second at 254.


  • 1.10 Next, we want to drag our text layer border so that it's against the guides. So, click on the Text tool in the tool box again like we did in 1.4 (adding guides automatically selects the Move tool). Then, click on the text layer so that it becomes active again.


  • 1.11 Then, we want to click and drag the handles (small boxes in the corners of your text layer) towards the corners of your image. Now, they should snap into place along your guides. You may have to zoom out (CTRL + scroll wheel) to find all the handles.


  • 1.12 Now, we need to adjust the text so that it displays well in game. Highlight all your text by clicking and dragging in the text layer.

    In the Tool Options, make sure “Antialising” is ticked.
    This smoothes out the text into the background, using the alpha channel.

    The level of “Hinting” should be full.
    This fills out the text to create a fuller border, so when we add a black border later, the borders are less jagged.

    We need to change the “Kerning” of the text to 2 pixels.
    Any font that still has overlapping characters at more than maybe 4 pixels is not worth using: the spacing will look horrendous in game.
    The Kerning is the spacing distance between the characters. We need to increase the spacing so that we avoid ugly text clipping in game due to the character borders we apply in Leikkuri later overlapping with other characters.

    Finally, we can now adjust the size of the text so that it fills out the image. Increase it to the maximum size you can without the text spilling outside the image.


    If you like, when you can make the text no larger without it spilling outside the image, you can decrease the line spacing so that the text squishes together a bit more. Then you can increase the size a bit more. Be wary of not letting the characters get too close together, though.

  • 1.13 That's the first part done with.

Niveus is offline   Reply With Quote
Old 19-03-17, 05:15   #3
Niveus's Avatar
Join Date: Feb 2010
Location: United Kingdom Gender: Male
Posts: 3,279

  • 2.1 Now, your font is properly spaced. We can now get to work creating the border. Click in the foreground colour pallete, and set the colour to magenta (R 255 G 0 B 255, or ff00ff in HTML).


  • 2.2 Next, create a new layer exactly as we did before in 1.3.

  • 2.3 You should now have an image that is completely magenta. If you don't, then use the green arrows to move the magenta layer to the top of the layer stack. Moving on, right click your new magenta layer in the layer stack and select “Add Layer Mask”.


    A mask affects the opacity of a layer. The whiter an area on a mask, the more opaque it is. For example, if you had two layers: one white, underneath, and one blue. A mask on the blue layer, made of a white background and black squiggles, would look as if clouds were appearing on the blue, but really, you are making “invisible” some areas of the blue layer, allowing the white layer underneath to be seen through it.

  • 2.4 A dialogue will present itself. Initalise the mask layer to “White (full opacity)”.


  • 2.5 Once our mask is ready, we need to paint an outline of the text on the mask, in order to create the black border. For now, hide the magenta layer by clicking the eye next to it in the layers stack, so you can see your white text again. Right click your text layer, and select “Text to Path”.


  • 2.6 Now, making sure your text layer is selected, duplicate it using the 'overlapping squares' icon at the bottom of the layer stack.


  • 2.7 Hide the duplicate for now, by clicking the eye next to it in the layer stack. This will be a backup in case you decide to you need edit and space better the text later on.

  • 2.8 Right click your original, visible text layer and select “Discard Text Information”: you won't be able to edit the text any longer of this layer. This is why we made a duplicate.


  • 2.9 If you copied my standard text earlier, then you have these three As with diacritics in your picture. Zoom in (CTRL + scroll wheel) on those three As with the diacritics.

    These are really important for foreign language translations, foreign names and also many English phrases too! ("déjà vu"!) We want to carefully erase the letters so that only the diacritics are left, because tomb4 (in an uncharacteristic stroke of efficiency) superimposes these diacritics over the top of regular vowels when the text calls for the use of diacritical letters.
    If you were to leave the letters behind, then the black border of these diacritics would be messed up by the white pixels from the letters that are too close to the diacritic.

    Using the Rectangle Select tool, (the first tool in the tool box) click and drag over the three As, avoiding the diacritics.


  • 2.10 Now, to delete them, making sure the text layer is still selected, simply press Delete on the keyboard. Deselect everything by clicking outside your image.

  • 2.11 Next, go to the paths stack. It's the stack with squiggles and dots.


    A path is an outline of a selection, shape, line, etc, that GIMP is "remembering" for you to use later.

  • 2.12 You should see a path already there. This is one we made when we selected “Text to Path”. Hover to the left of your path in the stack to see two buttons appear as the cursor passes over them. Click the one on the left to make the path visible, and see it outlined in red in your image.

  • 2.13 Zoom in (CTRL + scroll wheel) to make sure your path is definitely aligned properly with your text. At this level of detail sometimes the path will wander a pixel or two. If it is aligned, you can skip to 2.15.

    If not, select the Move tool in the tool box, and in the tool options, select the “path” filter so that we can only move paths and not layers or selections.


  • 2.14 The cursor should now consists of the usual pointer, a circle with a line through it, and an icon of a path. What it's saying is, “there is no path to select”. Hover over one of the red lines of your path and it should turn into a cursor pointer, a pointing finger, and a move icon. Click the path. Now you can use the arrow keys on the directional pad to move the path a pixel at a time (usually, your path is never far off where it should be).


  • 2.15 Now maneuvre the window and zoom in again on where the three As were earlier, before we erased them. You will see that the path still is “remembering” where they were and is outlining them. We want to remove this part of the path.


  • 2.16 Hide the path from view again, so you can see more clearly what you are doing. Click the eye next to your path to do this.

  • 2.17 Next, right click your path in the stack and click the first option, “Path Tool”.


    This will make the path handles become visible.

  • 2.18 Over in the Tool Options, make sure the Edit Mode is “Edit” as opposed to “Design”.


  • 2.19 Now, while holding Shift, click each handle to delete them.


  • 2.20 Once you are done, go back to the Rectangle Select tool (first tool in the tool box) in order to remove the handles from view again. Back in the path stack, click the 'pink graph' icon to send the newly edited path to the current selection.


    Now you should see “marching ants” along the shape of your text.


  • 2.21 Next, in the tool box, select the Bucket Fill tool.


    Make sure that black is the foreground colour.

  • 2.22 Go back to the layers stack, and unhide your magenta layer and make sure your white mask is selected (by single clicking it). You can tell your mask is selected because the dotted line around your image is green and black, as opposed to the usual yellow and black. Now, fill inside the selection. Your white text should now be peeking through the magenta layer.


    Deselect everything to get rid of the marching ants (choose one of the Selection tools in the tool box, and click outside your image).

  • 2.23 While ensuring the mask is still the active layer, go back to the paths stack. Make sure the foreground colour is black. Right click your path, and select “Stroke Path...”.


  • 2.25 A new dialogue will appear. We want to make sure that we are using “Stroke line”. Check “Solid colour”, and make sure that “Antialiasing” is definitely unticked. (See Fig.34)

    Antialiasing here will mean that in game you will end up with the ugly pink pixels on the borders of your text. However: the text will mostly still look antialiased in game. We're using white antialiased text against a black, solid border.

    The line width will require some experimenting on your part. Probably it will be between 2 and 4, depending on the size of your characters, in order to create a solid black border. I will be using 2 pixel width.


    What we've done here, is painted along the mask. The fill ensured the inner pixels of the text can be seen through the mask, which can sometimes be missed when stroking along the path. Stroking along the path made certain we get that nice black bottom layer peeking through from behind the text, appearing like a border.

  • 2.26 Now you have your (nearly) completed texture map.


    Unfortunately the font I am using is under a commercial licence, so I have watermarked the picture.

  • 2.27 If you look at my map, you can see that some of the border is not totally perfect. The number 3, 7; lowercase X, J; uppercase Q, the brackets and the equals sign need some small adjustments.

    Select the Pencil tool from the tool box, and set the size to 1px.


  • 2.28 Then, zooming in (CTRL + scroll wheel), and with the layer mask selected, and making sure that white is the foreground colour, you can click on stray black pixels in order to set them re-visible again in the magenta layer. Likewise, you can use black to make some of the magenta pixels invisible.

    Here's an animation to show the borders before and after I went over my map with the a fine tooth comb using the pencil tool:


  • 2.29 Now, save this file using File > Save As... (GIMP's native format is .xcf), in case you need to come back to it later to adjust some spacing.

    Then we need to export it to a .tga file for later, for FontEdit. Before we export, we need to remove all the guides, otherwise this information makes the format impossible for FontEdit to read.

    To do so, select the Move tool in the tool box, then simply click and drag them off the canvas. They will disappear.

    Now, go to File > Export... and type whichever name you like, and then the extension .tga (GIMP is pig-headed in the sense that filetypes are simply easier to manually write, than select from the complicated drop down menu ).

    Upon export, a dialogue will pop up. Make sure that RLE compression is unticked, and we have selected the origin as Bottom left from the drop down menu.


    Lastly, we can export it as a .bmp, as purely a reference for use with Leikkuri. When you export, another final dialogue appears. You need to check "Do not save colour space information" and make sure that you have checked 24-bit, in order to make it compatible with Leikkuri.


    In the old tutorial, Gekkokid suggested a more natural colour for use within Leikkuri, because the garish magenta can annoy your eyes after a while. In which case, before you export the .bmp, you can fill the magenta layer (make sure you have not selected the mask: you can tell if the dotted yellow and black line surrounding the image goes black and green) with a colour of your choice. I will be using ivy green.

Last edited by Niveus; 19-03-17 at 05:26.
Niveus is offline   Reply With Quote
Old 19-03-17, 05:19   #4
Niveus's Avatar
Join Date: Feb 2010
Location: United Kingdom Gender: Male
Posts: 3,279

  • 3.1 Open Leikkuri, and click the “Load BMP” button at the bottom of the window pane.

  • 3.2 Open our previously exported .bmp file. You should have something similar to this:


    If you wonder why my background is green: see 2.29. This .bmp we exported is a reference file: it is a visual guide only, in order for us to edit the co-ordinates of the characters in Leikkuri.

  • 3.3 Leikkuri is simple to use. It comes with its own user manual, but I will summarise things here. I'm going to start by going through the lower case charatcers, from 'a' to 'z', since they are the first in my image. On the left we have the character list, so scroll down to lower case 'a'.


  • 3.4 Then, click the magnifying glass in the top right corner of your map. This opens a small window which shows a magnified version of the map for easier editing.


    For now, drag the maginifier away from the original map so you can see the whole thing again.


  • 3.5 Now let's get to editing the co-ordinates of the first character. If you hover over the original map while holding Shift, you will see how this moves the magnifier's view. Move it over lower case 'a'. Now in the character list, double click 'a'.

  • 3.6 Then, using the left mouse button, click and drag across the 'a', from top left to bottom right. Leikkuri will only let you drag in this direction. A cross-hatch square will appear over the letter. We want its border to align directly with the character, like so:


    It takes a few tries to get used to. That's fine. Just keep going until you have it properly aligned.

  • 3.7 If you like, you can turn on axes that will follow your cursor: this makes it easier to see what you're doing. Its colour can also be customised if it blends in too much with your custom background colour.


    Once you are happy with your selection, right click on either the main map or the magnifier's map, and Leikkuri will let you know that it has saved the current co-ordinates.

  • 3.8 Next, we need to align the charatcer. The baseline used in TR4 skims along the top of standard height characters, and that includes the black border. If you are comfortable with this step, and don't want an explanation how to discover where the baseline lies for each character, then skip to 3.9.

    • 3.8.1 To better explain this point, think of a long piece of string. Now imagine we want to hang an assortment of different types of beads along the string to create a necklace. Of course, we need to drill through the beads to make a hole the string can go through. But if you don't think about where you are drilling the hole, you will end up with a string of beads that looks messy.

      The same is true for a string of characters. If they are not aligned along some “baseline”, they will end up looking jumbled and like a 5 year old has arranged them with glue.

    • 3.8.2 So, let's take a word as an example: Septuagenerian (someone who is seventy years old). Most of the letters are the same height and alignment. However, the p and the g have descenders, which means part of the character descends below the standard character height. The t has an ascender, which means it ascends above the standard character height. S is a capital letter, which means it extends above the height of an ascender in most fonts. Numbers count as capital letters, as do nearly all symbols (the upside down question mark and exclamation point are exceptions, see 3.8.6). Punctuation is a bit more complicated, but we will get to it later.

    • 3.8.3 The best thing to do here is go back to GIMP. Remember the guides we used before? We'll use them again to mark out the “baseline” of the letters. Remember: the baseline used in TR4 skims along the top of standard height characters. So let's pull a vertical guide from the top ruler, so that it goes along the top of the 'a', a standard height character. It helps to zoom in a bit here (CTRL + scroll wheel) (if you're having trouble moving the guides, refer to 1.20).


      Now, for non-standard characters, like b, d, f, and h, we now have a reference point for where the “baseline” intersects with the character. Do this for the next row of text, etc.


    • 3.8.4 Some letters don't have easy recognisable reference points like b or d. So, it's easier to visually count how many pixels the capital letters (and finicky letters like lowercase L) are above the baseline. My lower case L is six pixels above the baseline, my capital A is also six pixels above, and the rest of my capitals are seven pixels.

    • 3.8.5 For my punctuation line, I have my c cedilla. I know that the top of the c is the baseline, from looking at my first line of characters, so I can drop a guide there.


      I can then count out visually how many pixels underneath some of my punctuaion marks are.

    • 3.8.6 The upside down question marks and exclamation marks always will have their tops touching the baseline like normal lower case characters. They are intended to dip below the baseline in normal text.

    • 3.8.7 If you have any lines where you have no idea where the baseline might be, you can work it out through deduction. If you look at my dollar sign, you can see it's basically a capital S, which I know to be seven pixels above the baseline. It's got an extra row of pixels due to the middle stem sticking out, so I know the dollar sign lies eight pixels above the baseline. Then I can drop a guide eight pixels below the top of the dollar sign, which shows me how far above the baseline the other characters are.


    • 3.8.8 I now have guides on all my lines of text so I can refer to it if I am unsure where the baseline is.


      You can see I added an extra guide underneath my full stop. This was to make sure my punctuation was definitely in line with the bottom of my standard height characters.

  • 3.9 Now, we want to align our 'a' character. Head to the Alignment window.


    We want to align our 'a' like such: so that the baseline strokes directly the top of the black border of the character. Use single left click and drag to align how you need.

    It doesn't matter how you align the character horizontally. It doesn't affect the alignment in game.

  • 3.10 Next, right click in the alignment window to save the alignment. All done! Move on to b, and do the same.

  • 3.11 Now, with your guides open in gimp, refer back and forth as you need to cut out and align the characters in Leikkuri. Once you get into the swing, it is a simple process.

  • 3.12 Here is some finicky characters: lower case L and F, forward slash, the full stop/period, and the up and down arrows, to give you a general idea of the alignment you want to achieve.


    Remember, your values may be different, so don't copy those in the picture.

  • 3.13 For reference, see 5.1 for a character list and a breakdown of what character these actually pertain to, if you are unsure.

    Once you are done, you can paste your tomb4 in the same directory as Leikkuri, and then use the patch button.
Niveus is offline   Reply With Quote
Old 19-03-17, 05:20   #5
Niveus's Avatar
Join Date: Feb 2010
Location: United Kingdom Gender: Male
Posts: 3,279

  • 4.1 If Leikkuri was simple, then FontEdit is even more so. Double click the executable and straight away a navigation dialogue opens. Navigate to the font.pc in your graphics folder, and double click.

  • 4.2 The click Load TGA, and navigate to your tga which we exported earlier.

  • 4.3 Then, click “Save Font”. Done!

  • 4.4 Now, recompile your levels and title and test in game!

  • 4.5 Now you have the font working in game, you can adjust the resolution in Leikkuri underneath the alignment window in order to best find the look that suits your font. A larger resolution means it will appear smaller, but crisper in game. Careful: the smaller your font, the more strange the menus will look with big gaps between lines. Find a happy medium between quality and menu sizing. It requires trial and error.

    Tip: personally, I would adjust only one value of the resolution until it is not squished. Then, using GIMP, you can create an image that size. Constrain the proportions as you scale the image, by linking the chain in the dialogue! Then you can maintain the aspect ratio as you fiddle with bigger/smaller resolutions, and copy these values in Leikkuri!!


  • 4.6 This was my result after adjusting the resolution:


    Pleased if I do say so.

  • 4.7 It's hard to tell in the image above, however, I have used a dark grey patterned transparent background for my menu. This will help hide any hard egdes and make the font look totally anti-aliased!

  • 4.8 You may notice, that the letters 't', 'm' and 'i' are slightly misaligned - enough for me to want to adjust them, anyway. I will go back and adjust my patch accordingly in Leikkuri, but for the sake of the tutorial, they can remain for now.

  • 4.9 Enjoy your new font!!

Last edited by Niveus; 19-03-17 at 05:29.
Niveus is offline   Reply With Quote
Old 19-03-17, 05:24   #6
Niveus's Avatar
Join Date: Feb 2010
Location: United Kingdom Gender: Male
Posts: 3,279

  • 5.1 This character list omits a-z and 0-9, but explains some of the more obscure characters.

    " - Double quotation mark
    ' - Apostrophe / single quotation mark
    * - Asterisk
    , - Comma
    - - Hyphen
    . - Full stop
    < Angle bracket
    = Equality sign
    > Angle bracket
    ` - Grave accent. I my map it would be diacritic directly to the left of the C cedilla, e.g. [à]
    Combining Accute Accent – In my map it would be diacritic directly left of grave accent, e.g. [á]
    Diaresis – In tomb4 for some reason this refers to the circumflex, e.g. [â]
    ^ - In tomb4 for some reason this refers to umlaut, eg [ä]. Unassigned in my map.
    Tilde – The swung dash. Probably also used for n found in Spanish words, e.g. [ñ]
    Combining Comma Above – I don't know what this space is used for. Unassigned in my map.
    C cedilla – Used in foreign words, especially French, or even English (facade) e.g. [ç]
    Dotless i – Turkic letter e.g. [ı]
    Reversed question mark
    Reversed exclamation mark
    PSX Cross – not used
    PSX Square – not used
    PSX Circle – not used
    PSX Triangle – not used
    PSX R1 – not used
    PSX R2 – not used
    PSX L1 – not used
    PSX L2 – not used
Niveus is offline   Reply With Quote
Old 19-03-17, 05:24   #7
Niveus's Avatar
Join Date: Feb 2010
Location: United Kingdom Gender: Male
Posts: 3,279


In game comparisons, that will get uploaded later. >
Niveus is offline   Reply With Quote
Old 19-03-17, 05:25   #8
Niveus's Avatar
Join Date: Feb 2010
Location: United Kingdom Gender: Male
Posts: 3,279


Adding a bevel effect to the font, that will be uploaded later. >
Niveus is offline   Reply With Quote


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

All times are GMT. The time now is 23:47.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2019, vBulletin Solutions Inc.