• We have updated our Community Code of Conduct. Please read through the new rules for the forum that are an integral part of Paradox Interactive’s User Agreement.

ancestral

Second Lieutenant
44 Badges
Dec 21, 2007
187
3
  • Pillars of Eternity
  • Crusader Kings II
  • Europa Universalis III
  • Divine Wind
  • Europa Universalis IV
  • Heir to the Throne
  • Europa Universalis III Complete
  • Europa Universalis III Complete
  • Stellaris
  • Mount & Blade: Warband
  • Crusader Kings II: Reapers Due
  • Stellaris: Digital Anniversary Edition
  • Stellaris: Leviathans Story Pack
  • Stellaris - Path to Destruction bundle
  • Cities: Skylines - Mass Transit
  • Crusader Kings Complete
  • Surviving Mars
  • Stellaris: Synthetic Dawn
  • Age of Wonders III
  • Cities: Skylines - Green Cities
  • Stellaris: Apocalypse
  • Surviving Mars: Digital Deluxe Edition
  • Cities: Skylines - Parklife
  • Cities: Skylines Industries
  • Crusader Kings III
  • Crusader Kings III: Royal Edition
  • Europa Universalis IV: Call to arms event
  • Crusader Kings II: Legacy of Rome
  • Crusader Kings II: The Old Gods
  • Crusader Kings II: Rajas of India
  • Crusader Kings II: The Republic
  • Crusader Kings II: Sons of Abraham
  • Crusader Kings II: Sunset Invasion
  • Crusader Kings II: Sword of Islam
  • Europa Universalis III Complete
  • Crusader Kings II: Conclave
  • Magicka
  • Sengoku
  • Warlock: Master of the Arcane
  • 500k Club
  • Cities: Skylines
  • Europa Universalis IV: Pre-order
  • Crusader Kings II: Way of Life
  • Crusader Kings II: Horse Lords
I’ve been busy making some font mods for CKII. I’ve offered to make a tutorial explaining how to make custom map fonts, and it’s been requested, so I thought I would share with you the secret sauce :D

Many of the tools used here can be applied to making fonts for other Paradox games. However, these instructions will be specific to CKII for now.

Setup: What You Need
  • BMFont (freeware), a bitmap font editor by Angelcode. There may be others (and feel free to experiment), but BMFont is the most mature, and the latest update draws better-looking glyphs.
  • A free font (more on this in a bit)
  • A text editor (Notepad, Word, TextEdit, vi, etc.)
  • A graphic editor (optional; Paint.NET, GIMP, Pixelmator, etc.)

Choosing a Font
Paradox seems to like using Trajan, as they’ve used it not only for CKII, but also with Sengoku, EU:Rome, and it looks like EUIV as well. (Of course, so does half of Hollywood.) Legibly it works fine for the map, so it’s not a bad choice. My gripe, however, is that it isn’t particularly medieval, and in addition to being overused in application today, it’s just a little bland. Take the opportunity to find a font you like, and something where capitals look good and are readable.

Be mindful of copyrights!
Using a font for personal work, and even for static images is usually fine, especially if no money is exchanging hands. However, making a bitmap font is essentially redistributing the font (or a majority of its glyphs) in a different medium. For this reason, it’s important to know how a font may be copyrighted.

Windows and Mac users: any font bundled with your computer, almost assuredly, is copyrighted, which means if you’re going to share your creation with others, you do not have the rights to distribute the font. But this gets tricky. Some fonts allow embedding, and creating a bitmap is typically considered embedding. You may have to do research on who released the font files to see if you are allowed to make bitmaps — technically speaking.

So what fonts are safe to use? Any font that lets you re-distribute it and make modified versions. Google Web Fonts is an excellent source for free fonts, many of which are licensed under the Open Font License or public domain. The OFL allows you to make changes and redistribute, as long as the creation includes the OFL license with it, and doesn’t pretend to be the original font by name. The good news is that since we are embedding we don’t need to be concerned about including the license file (see the OFL FAQ if you are curious about this).

Once you’ve chosen the font, install it in your system and you’ll be ready to go.

For the example here, we’re going to make a bitmap font of Julee, a Google Web Font.

Creating the Bitmap
  1. Open BMFont.
  2. Choose “Font settings” from the File menu, or Press F.
  3. Choose the installed font, and be sure you adjust the settings to match those in the image below.

    bmfont1.png
  • Unicode versus ANSI: You don’t need to choose Unicode, since the game isn’t concerned with rare glyphs and languages. Additionally, the game will crash if trying to render glyphs with IDs larger than 255 in the description file (which will get generated later). Perhaps the only reason you’d want to choose Unicode is if you specifically wanted to access particular letters or symbols that had a special Unicode code outside of the standard ASCII. (Even then, you’d have to re-assign the character to an existing ASCII character.) Note that some glyphs will be clipped if not set to ANSI — it will be readily clear if your font choice is affecetd or not when visualizing. (I have no idea why, but it’s probably a bug.)
  • Size: The game uses 100px for the map font, but not all fonts are created equal. Feel free to experiment if the letters seem to small or too big on the map.
  • Do not include kerning pairs: Likely doesn’t matter for the map font, as the letters are spaced generously by the game. Possibly turning this off make look better when the game tries to cram text to fit inside a tiny nation. For small fonts, kerning is a must.
  • Match char height: I normally keep this off, but this measures the height to be the base height as opposed to the total line height. Text will be larger if this is checked.
  • Render from TrueType outline: Actully, stay away from this; you’ll get better output from the full font data tables.
  • TrueType hinting: Makes text at small sizes more legible on the screen. Leave this off unless you are making a small replacement font.
  • Super sampling: Super sampling draws the characters at a larger size internally, then scales it down. 4 is the maximum, and is worth a try, however, your mileage may vary.
  • Outline thickness: Experiment with this setting. Though not required, having an outline in a neutral gray will help the text standout over both dark and light areas, though setting one too big will look distracting and aesthetically displeasing. (Roughly 2 pixels seems to be a good amount to test with first.) If you’re working on in-game text instead, turn this off.
Click OK when you’re done.​

4. Choose “Export options” from the File menu, or press T.
5. Adjust the settings to match those in the image below.

bmfont2.png
  • Padding: Turn this on if you’d like to make an effect around the text (for example, applying a glow or drop shadow, which would need some additional space to each side).
  • Spacing: I always leave this at 1. I’m not sure the use for increasing it further, except maybe for certain drawing algorithms in particular games.
  • Equalize the cell heights: For EU3 font modding I’d usually leave this unchecked. However, I’ve noticed with CKII some of the diacriticals (umlauts and accents) might not display correctly without this checked. (There’s no large advantage with it checked, other than a smaller file, but in my experience, a slightly larger file here doesn’t seem to slow the game down by any noticeable measure.)
  • Width and Height: These numbers need to be a power of 2. You’ll likely need to make this 1024 by 1024. That should be enough room. (Smaller fonts will need fewer pixels, obviously.)
  • Bit Depth: This needs to be set to 32 bits to force the alpha channel.
  • Channels and Values: These settings will let you change the color of the text. Some settings here will render the fonts in white instead of black, or even apply a colored background without an alpha mask. (Best to leave this just as I have it.)
  • Font descriptor: Choose “Text” or this won’t work.
  • Textures and Compression: Choose “dds” and “DXT5”. Avoid DXT1 and DXT3. Some fonts in game use TGA format, and some both. The game looks for a DDS file first, and TGA next. If you are replacing existing fonts, DDS is a must. (If not, then it doesn’t matter much here which you choose.)
Once you save from BMFont the image should be usable right away. However, if you want to edit it first before using it in the game (add glow effects to the letters, etc.), and if your graphics editor doesn’t play nicely with DDS files, you can export it from BMFont as a PNG or TGA instead, and export it using your graphics editor or a different converter to DDS when you’re all done.
When you’re satisfied, click OK.


6. Select the characters to export. Selecting them all is fine. To select them all easily, choose “Select All Chars” from the Edit menu.​
  • The bare minimum you need for the map font are capital letters and lowercase letters with accents and space. Leaving out all non-accented lowercase letters and characters between 128-191 (except keep 154, 156 and 158) would be okay too.
  • One option you have, if you don’t like how the lowercase accent letters show up, is to select the uppercase accented characters instead. For Julee, I’m choosing to do this, so I am keeping the accented capitals and not the lowercase. I could remove more characters, but I’ll play it safe.
bmfont3.png

7. Preview the font by choosing “Visualize” from the File menu, or press V. If it fits in one page, congratulations, you’re all set! (If it doesn’t, you’ll need to either make the width and height larger, eliminating some characters, decreasing the padding and spacing, unchecking the “equalize the cell heights” or even choosing a smaller font size for your font. Then try again.) Close the Preview window.

8. Choose “Save” and save the file somewhere to your computer. Call it whatever you’d like for now.
You’ll notice have two files: one bitmap image, and a font description text file (.FNT)​

Editing the Font Description File

The last step here is to edit this file to the exact formatting CKII expects it to be in. (A text editor with a Find and Replace All feature will be extremely useful here.)
  • Delete all chnl=15 after page=0 on each line,
  • Delete unicode=0.
  • Delete outline=2.
  • Delete packed=0 alphaChnl=2 redChnl=0 greenChnl=0 blueChnl=0 at the end of line 2.
  • Delete the line page id=0 file="yourFileName.dds".
  • Delete the line chars count=123.
  • Delete packed=0 alphaChnl=2 redChnl=0 greenChnl=0 blueChnl=0 at the end of line 2.
For me, the first 5 lines look like this:

Code:
info face="Julee" size=100 bold=0 italic=0 charset="ANSI" stretchH=100 smooth=1 aa=1 padding=0,0,0,0 spacing=1,1
common lineHeight=100 base=76 scaleW=1024 scaleH=1024 pages=1
char id=32   x=1014  y=525   width=5     height=104   xoffset=-2    yoffset=-2    xadvance=24    page=0
char id=33   x=91    y=630   width=21    height=104   xoffset=3     yoffset=-2    xadvance=22    page=0
char id=34   x=706   y=525   width=26    height=104   xoffset=3     yoffset=-2    xadvance=27    page=0

At this point, save, and rename them MapFont.dds and MapFont.fnt. You can place them in C:\\Users\YourUser\Documents\Paradox Interactive\Crusader Kings II\gfx\fonts\ or ~/Documents/Paradox Interactive/Crusader Kings II/gfx/fonts/ (create the fonts folder if it doesn’t exist), or you can create a small mod just for the font and put it in the mod folder.

If you notice there is no map font visible then something is wrong. Probably something is incorrect with the .fnt file. Make sure you don’t have IDs larger than 255. It also doesn’t hurt to compare it with a standard fnt file. (You can also compare your files with one of my map font mods.)

Optional: Using Capital Accented Characters

Since I opted to use capital accented letters, I need to change the font description file so the uppercase ones are located where the lowercase ones were.

You can open BMFont again for reference to help. Depending on the font, you may not have all of these characters. For any of these numbers you do have, change them as follows:
  • Change 138 to 154.
  • Change 140 to 156.
  • Change 142 to 158.
  • Change 159 to 255.
  • Change 192-214 to 224-246.
  • Change 216-222 to 248-254.
Tweaking and Final Result
Here’s my font. As you can see, it may need a little bit of work. I have a bright white outline which clashes with the black text. A little tweaking could help.

tutorial-fontingame1.jpg


Opening the image in a graphic editor, I changed the brightness down 50%.
then changed the brightness up 10%. Save, and vòilá!

Edit:
I’ll revisit Julee one day, but a better approach would be to duplicate the layer, create a Stroke for the image, perform a Gaussian blur on the same layer and then merge them together. Play with the opacity a little when choosing Stroke, you can get some nice effects.

tutorial-fontingame2.jpg


There. Pretty good. I could further try tweaking this, but for now, I’ll call that done.

Download the Sample File

Care to try it out? Feel free to download the finished file.


If you have questions, feel free to post them here, or PM me if you prefer.
 
Last edited:
  • 1
Reactions:
I have gone through this process and it worked with this caveat. It has the white outline and I have a dds file I can't open in gimp. Can you explain a little more? Thank you.

Edit: Figured it out. For Gimp 2.6+ you can download the dds plugin here: http://registry.gimp.org/node/13044
Drag the extracted .exe to the location listed in the readme file.

It works. Now I need to sort out how to get the font to show up in smaller territories. In Sengoku, IWATE, for example, lacks a name until you zoom in 2 or 3 levels.

Last question, how do you make it into a mod, so it can be shared?

Cheers
 
Last edited:
I got it sorted. We must have been posting at the same time.

What method do you use? I would like the font to scale down better so that it shows in smaller territories while zoomed out. Also, could a tga be used instead of the dds?

Thank you.
 
A student's PS is quite cheap when compared to the full one.

I make two layers, the bottom one with 80% opacity, desaturated and less light, the top one with 30% opacity, blurred. Still gives things a slight halo but won't jag much.
 
I will give it a try. Is there any benefit to having the size greater than 100? I have tried 100 than 60 to accommodate the smaller territories - there may not be a correlation. The later versions of Gimp are excellent.
 
Thanks for the feedback!

Honestly, people should be making these into mods and not littering their game folders! That way you can easily turn them on and off, and share them too.

If you want to see how it’s done, you can now download the finished file. You can also check out the map fonts I’ve made previously.
 
Last edited:
Very nice! I used this tutorial to map my own mapfont for Sengoku. Trajan is more legible, but I didn't feel it was appropriate for a game based in feudal Japan.
30OyO6S.jpg
 
Hi, I'm following your tutorial, but I'm making fonts for the interface not for the map. I can't manage to make the text spacing out a bit, in game they always cram together. I tried to adjust spacing or padding, nothing happens... any idea how to fix it?
 
Yep, by generating only lowercase characters, then attributing uppercase id to lowercase characters in the txt file.