To fix this bug do the following. Go to C: Users YOURUSERNAME AppData Local activision codwaw mods TMGStandoff. Open the 'tmgstandoff.iwd' with the program Winrar or something alike. Open the folder 'images' within the iwd and find the file called 'gamefontspc.iwi' and delete it. 2) Replace the 'gamefontspc.iwi' from localizedenglishiw00 or place localizedenglishiw2012.iwd in mods YOURMOVIEMOD Notice: DONT'T FORGET TO BACKUP ORIGINAL FILES!!! Call of Duty 4: gamefontspc.iwi Courtesy of Infinity Ward / Activision Blizzard, Inc. File history Click on a date/time to view the file as it appeared at that time. ERROR: image 'images/gamefontspc.iwi' is missing Couldn't load image 'gamefontspc' THats what comes up everytime I try to play. If you want quiet, you'd better take the next train.
- 3Explanation
Font related files
A font is made up of 4 files:
- image (*.iwi)
- material
- material_properties
- font mapping
The material and material_properties files belong to the image, like for every other iwi. The font mapping file references itself, the material file and maps the letters in the image to the ascii (respectively unicode) characters, used in the string files (raw[LANGUAGE]localizedstrings*.str). The material_properties file is implicitly associated with the material by the engine and doesn't require an explcit reference.
The main font of CoD4 is gamefonts_pc
. It is located in mainlocalized_english_iw00.iwd --> imagesgamefonts_pc.iwi
. The image contains 7 different fonts (background is actually transparent):
Font name | size (hex) | size (dec) | UI font type constant | Value |
smallFont | 0x0A | 10 | UI_FONT_SMALL | 3 |
normalFont | 0x10 | 16 | UI_FONT_NORMAL | 1 |
consoleFont | 0x10 | 16 | UI_FONT_CONSOLE | 5 |
boldFont | 0x10 | 16 | UI_FONT_BOLD | 4 |
bigFont | 0x18 | 24 | UI_FONT_BIG | 2 |
objectiveFont | 0x23 | 35 | UI_FONT_OBJECTIVE | 6 |
extraBigFont | 0x30 | 48 | - | - |
- | - | - | UI_FONT_DEFAULT | 0 (auto-chose betwen big/reg/small) |
These are the settings of the font material in Asset Manager:
File specifications
The structure of a font mapping file is like this:
A character record in detail (margin and dimension = pixels):
Structure in FastFile:
You need to calculate font_name_offset and font_material_offset if you want to create a font file from the fastfile data:
font_name_offset = 24 * number_of_records + 16
font_material_offset = font_name_offset + sizeof(font_name_offset)
Explanation
File relations
In the font file are two strings (character arrays) at the end. One of them is the filename of the material. In the material file is another string to the actual image file (iwi). It references like this:
The glyph (character) entries in the font file store the information, which pixels in the iwi are a letter (plus some other data). That's what i call 'mapping'. It maps common digital letters via their ascii codes to image data. This image data is a portion of the iwi. The so called UV coords tell the game what to 'cut out' of the iwi and use as letter ingame. It actually uses small pictures and no computer text.
UV mapping
U and V are variables like X and Y for coordinates. In 3D it would be UVW (compare to XYZ). XY is for a point in 2D space, UV is similar, but for texturing.
The special thing about UVs is, that they are floating point numbers relative to the image (iwi) dimension.
See here:
(0,0) is the coord in the top left corner. (1,1) is the bottom right corner. The first number is for the vertical direction (left to right), the second for the horizontal (top to bottom). Thus the generalized UV coord is (u,v).
Images/gamefonts_pc.iwi' Is Missing
In case of the CoD fonts, UVs can't be greater than 1 and have to be equal to or be larger than 0. The coord (0.5,0.5) is exactly the center of the image, no matter what height and width the image has. To calculate the UV into pixels, you multiply one image dimension by the appropriate UV value.
Example:
Dimension & margin
The UV coord cuts out the letter of the image only. The height and width in pixels define how large it will actually be ingame. It should usually be 1:1, so no re-scaling.
The margin is sort of similar. It's used to position the letters. Because the game does not use a mono-spaced font, it needs to know how much space it is supposed to leave between the current letter and the following (right padding). A mono-spaced font is if all letters have the same width. But that's not the case here, so the engine needs to know how much padding/margin/spacing is required to stick the letters to a word together without having unregular spaces. They have to be next to each other with a little free space between them to look good. so the margin positions the letters, it refines the spacing for a text (many letters).
Tools
Download Regolith's CoD Font Explorer
Gamefonts_pc.iwi Cod 5 Download
--CoDEmanX 00:23, 6 July 2009 (UTC)
This tutorial will show you how to create new fonts for any call of duty title available.
(You will need the font raw files from the modding tools/ff.
Since I've added a new language to the mod I'm building, I had to add new letters which was not existed on call of duty, so I needed to understand the font binary files structure (which is very simple.)
You will need the next tools:
1. Photoshop
2. Hex editor (Hex workshop recommended)
3. Diego Logic's Cod font explorer
4. Iwi2dds
5. TGA/DDS to iwi (I'm using the mod tools asset manager)
Choosing the font file to modify
the fonts files are located at the raw/fonts path (or English/fonts)
most of the fonts are the same for the last titles of cod.
These are the standard fonts.
(there is no way to find which font is used in what string in-game, only by checking the menu file at ui_mp, or just messing with one of the fonts until you see which one is changing.
Exploring the fonts
first, you will have to find and convert the 'gamefont_pc.iwi' file in one of the localized iwd files at the main folder (most of the time at the first one).
Convert this file to .dds using iwi2dds tool
and save 2 versions of file, in the first version copy the alpha channel to the RGB channel and save it on the name 'gamefont_pc.bmp', in the second one, leave only the alpha channel and save it as TGA 32BIT.
Copy the desired font binary file to your mod folder root /fonts and also the bmp file created before. (The bmp file is used byt he explorer tool to view the image, you will need to update the bmp file after every time you change the tga.)
Choose your font and open it with Diego logic's font explorer as you can see, the font binary file is connected to the gamefonts_pc image, and tells the game where every letter located, what's the size of each letter, and how much space to give it when printing.
When pressing on the icon you will be able to see the image, and choose the letter to show its coordinates.
Modifying the fonts
Open the gamefont_pc.tga file in Photoshop, and choose the letter you want to edit.
After editing (unless you kept the exact letter size and location), the existed properties will be no longer valid to the new letter. So now you will have to change it.
Open the binary font file with hex workshop, and look for the letter you've just changed.
You will have to look for the letter code, you can see all the language codes for English language at the table below:
http://ascii.cl/htmlcodes.htm (ASCII HEX)
in this case the letter that I want to change is capital A (for BIGFONT), and the code for the letter is 41.
Press on Edit>Find>HEX Values>4100 (always add two zeros after the code).
each letter has 24 bytes:
4100 – is the char code (above-mentioned)
00 is the left spacing which is 0
D2 is the top spacing which is -46
19 is the right spacing which is 25
1C = 29 (Width)
24 = 36 (Height)
this is the same values you will get when viewing from the explorer tool
*notice the right spacing will always be the letter width + space, so it means that if A capital is 29 pixels long and the right spacing is 24, it will have a -5 pixels of space to the right.
The left space you should be at 0 unless you have too much space on the left side of the letter. Same for the top (best way is to trial and error).
In order to convert the Hex to decimal you have 2 ways. One is just selecting the byte and on the left windows of the program (data inspector) look what the 'int8' value is.
The other way is to use the base converter
This only applies for the dimensions and spacing and not for the UV'S.
In order to view the value of the UVS, go to Options> Preferences> Precision> and choose 1.12 float precision.
You will have to choose all the 4 bytes mentioned above for each UV.
For example:
And see what is the 'Float' value on the data inspector:
below I selected the left UV for the Capital 'A', and the value is 0.833, which is 83.3% percent from the left side of the image .
Be sure that you change the letter dimensions and spacing so it will fit your new letter.
Use the base converter in order to convert your new value back to hex, and replace the old value.
You can use Photoshop (press on F8) in order to view the width and height of the letter.
*the height and width values should be the exact frame of the letter from right, left, top, bottom.
Finding the correct UV'S coordinates with Photoshop
in order to change the UV'S you will have to know what is your new UV'S.
Open your font image and select the start of the image from the left, until the start of the letter.
As you can see the W value is 30.3% from the left, which means that the left UV Value is 0.303
use the base converter (Intel,Float) to convert 0.303 back to hex, and then change the value with the hex editor.
Do the same for top, right, and bottom.
NOTICE:
for left and right use the W Value (horizontal)
for top and bottom use the H (vertical)
the right and bottom values are reversed. So it means that if the value is 66.0% for example, you will need to subtract it by 100. (100 – 66 = 34). So your new value will be 0.340.
Use The reversed values are only for right and bottom!
*VERY IMPORTANT NOTICE!
Be sure to close Diego Logic's font explorer before saving the binary file, if not, the file won't be updated!
Exporting back to call of duty
after you finish editing, export your tga file back to iwi.
Be sure there is only alpha channel, and that the compression is DX5.
Call your file, gamefonts_pc.iwi and put it in the images folder.
The font binary should be located at the your mod root/fonts, and should be declared with 'font,fonts/fontame' on the mod.csv
(if the font not appearing in game, try to copy the font also to raw/fonts).
Enjoy your new font
IMPORTANT NOTES:
1. Unfortunately this is the best way changing fonts, Diego logic's tool (which is great) allows you to explorer the font, but not the change them within the tool, he said that he will might add this feature in the future so you won't need to mess with the hex editor at all.
2. the fonts files are auto generated with a special tool that was never available on the mod tools, so for right now, the best way is to change it manually. There is some existed tools on the internet which allows you to export fonts into bitmaps, but their binaries should be converted somehow to CoD ones, Unfortunately I'm not a coder (sigh) so I have no Idea how to do that.
good luck
-Tom.