Game Font Editor

Awesome :goodjob:

My #1 feature would be the automatic star icon. This little thing bothered me forever as I don't know where to find it other than to cut it from other icons... :p
 
Asap, this is wonderful work!
Your utility is already quite useful :goodjob:

Do you plan an add-on for it to handle the actual font section as well?
 
I'm having fun messing around with this, but today I ran into a few problems.

One is, while attempting to open the Colonization GameFont file, I got an error message that said "Failed loading image: File does not fit type - actual font separator line is missing." Odd because I had successfully opened that file before (and I'm currently able to open the Colonization GameFont75 file).

The other is, while attempting to import a TGA file (exported from Colonization), the application crashed and gave the following error message:

Spoiler :

See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.

************** Exception Text **************
System.NullReferenceException: Object reference not set to an instance of an object.
at GameFontEditor.MainForm.btImport_Click(Object sender, EventArgs e)
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)


************** Loaded Assemblies **************
mscorlib
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.5446 (Win7SP1GDR.050727-5400)
CodeBase: file:///C:/Windows/Microsoft.NET/Framework/v2.0.50727/mscorlib.dll
----------------------------------------
GameFontEditor
Assembly Version: 0.2.0.0
Win32 Version: 0.2.0.0
CodeBase: file:///C:/GameFontEditor/GameFontEditor.exe
----------------------------------------
System.Windows.Forms
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.5446 (Win7SP1GDR.050727-5400)
CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Windows.Forms/2.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
----------------------------------------
System
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.5442 (Win7SP1GDR.050727-5400)
CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System/2.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
System.Drawing
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.5420 (Win7SP1.050727-5400)
CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Drawing/2.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
----------------------------------------
FreeImageNET
Assembly Version: 3.13.1.1
Win32 Version: 3.13.1.1
CodeBase: file:///C:/GameFontEditor/FreeImageNET.DLL
----------------------------------------

************** JIT Debugging **************
To enable just-in-time (JIT) debugging, the .config file for this
application or computer (machine.config) must have the
jitDebugging value set in the system.windows.forms section.
The application must also be compiled with debugging
enabled.

For example:

<configuration>
<system.windows.forms jitDebugging="true" />
</configuration>

When JIT debugging is enabled, any unhandled exception
will be sent to the JIT debugger registered on the computer
rather than be handled by this dialog box.


But then after it crashed I fired it up again and imported the same file and it was fine. Anyway, thought I would pass that along just in case it's helpful.

EDIT: I will second (third?) the request for the auto-star function. That would be a great feature, ahead of copy and paste even.
 
I'm having fun messing around with this, but today I ran into a few problems.

One is, while attempting to open the Colonization GameFont file, I got an error message that said "Failed loading image: File does not fit type - actual font separator line is missing." Odd because I had successfully opened that file before (and I'm currently able to open the Colonization GameFont75 file).
...

I am also having this happen on occasion.
 
Can you both attach the files that cause that?
Will it happen again for the same file or does it happen occasionally?

Regarding the error you posted - I looked into it but I'm still not sure what caused it.
I'll try adding a more detailed error displaying in the next version.
 
Can you both attach the files that cause that?
Will it happen again for the same file or does it happen occasionally?

Regarding the error you posted - I looked into it but I'm still not sure what caused it.
I'll try adding a more detailed error displaying in the next version.

It happened for me with the Colonization gamefont, but I tried to open it again and it was fine. Now I'm having the same error with the Greek World gamefont (attached) except I can't get it to open at all. I keep getting the error.

But I was able to get it to work to do the gamefont for my just-released Europa mod, so thank you!
 

Attachments

@el_hidalgo - I'll take a look at it. Thank you.

Progress update:
I've added undo/redo ability (that was really fun to write, and came out really cool!), and an optional auto-backup (default is enabled).

I intend to add a few more features (such as copy/paste) before releasing 0.3.
And speaking of other features - can anyone please create a 'star' icon for the 'ability to add star' feature? I guess we should have 2 (for both sizes), where the background is transparent.
I'm not really good at direct image editing such as this, and it'll take me a long time to do so myself...

Is the star always in the same position? Or should I enable moving it in the icon?
Is there a point in allowing for more than one 'star' overlay, or can it always be the same? (Hmmm... Adding an ability to add any overlay to an icon... interesting...)

Your thoughts?

Do you plan an add-on for it to handle the actual font section as well?

I can add an optional setting for it (as I'm sure most modders would rather not risk changing the font). Since I intentionally limited the editing of this section, it won't be difficult to re-enable it.

I'd love a shortcut icon.:goodjob:

Do you mean a desktop shortcut? Because you can create one yourself.
Spoiler :

Right-click the executable --> "Create shortcut" ; Then simply drag the created shortcut to your desktop.
 
I can add an optional setting for it (as I'm sure most modders would rather not risk changing the font). Since I intentionally limited the editing of this section, it won't be difficult to re-enable it.

Thanks, I will definitely try it! ;)

I may even ask it here too:
My problem is, that in RFC Europe we want to have both russian charachters, and the usual western european accents as well
Do you guys think it's possible?
 
I'm definitely not a very good artist, and to make matters worse I'm color blind, but I did my best to extract the stars from Christian holy city icons (that seemed easiest to work with). In any case, I figure it you can use it until someone comes up with something better.
 

Attachments

Version 0.3 is now available from the same link!

Highlights:
- Undo/redo mechanism
- Cut/Copy/Paste
- Auto-star
- Auto image backup
- UI improvements and extra settings.
- Can edit the actual font

See opening post for a detailed change log.

I've also added more flexibility in the settings for the auto-fix when loading image - check out the tool tips in the settings section.


@DH & el-hidalgo - I've made the editor more flexible for different row sizes (the font separator line was hard coded). It should work now.

@el-hidalgo - thanks for the star images! They are now included in the download and used by the editor :)


Regarding font editing -
I made some experiments, and for some reason it seems that editing the font has no effect in the game. I've edited both files (75 and regular), the changes in the icons were visible but changes in the font section were not :confused:
I checked it in the civilopedia and in the tool tips.
Has anyone ever successfully edited the font itself?

And another small issue - apparently the original font file has a corrupted pixel between 'Q' and 'R'. So the editor fixes it when loading now.
 
Awesome! I plan to make some gamefont changes to my mod this weekend, I'll let you know how I get on with the new version. Thank you so much for your work on this.
 
@el-hidalgo - thanks for the star images! They are now included in the download and used by the editor :)

You're welcome! Just glad I could help in some small way with this project! I have been trying out the new version (perfect timing; I really needed the copy/paste functionality), and I have some preliminary feedback.

1. I don't think it's necessary to confirm clearing a cell anymore, now that you have the undo functionality (which came in handy when I accidentally copied and pasted a blank cell!). I'm working on a classical era mod and I had to clear all the corps and most religions from the standard bts gamefont.

2. I got an error while attempting to "save as." I stopped using "save as" and haven't had any problems since. Error log details in the spoiler.

Spoiler :

See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.

************** Exception Text **************
System.IO.FileNotFoundException: Could not find file 'C:\Users\MyComputer\Desktop\Fonts\Civ_Fonts\GameFontClassic.tga'.
File name: 'C:\Users\MyComputer\Desktop\Fonts\Civ_Fonts\GameFontClassic.tga'
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.File.InternalCopy(String sourceFileName, String destFileName, Boolean overwrite)
at GameFontEditor.MainForm.BackupImage()
at GameFontEditor.MainForm.Save()
at GameFontEditor.MainForm.SaveAs()
at GameFontEditor.MainForm.toolStripButtonSaveAs_Click(Object sender, EventArgs e)
at System.Windows.Forms.ToolStripItem.RaiseEvent(Object key, EventArgs e)
at System.Windows.Forms.ToolStripButton.OnClick(EventArgs e)
at System.Windows.Forms.ToolStripItem.HandleClick(EventArgs e)
at System.Windows.Forms.ToolStripItem.HandleMouseUp(MouseEventArgs e)
at System.Windows.Forms.ToolStripItem.FireEventInteractive(EventArgs e, ToolStripItemEventType met)
at System.Windows.Forms.ToolStripItem.FireEvent(EventArgs e, ToolStripItemEventType met)
at System.Windows.Forms.ToolStrip.OnMouseUp(MouseEventArgs mea)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
at System.Windows.Forms.ToolStrip.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)


************** Loaded Assemblies **************
mscorlib
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.5446 (Win7SP1GDR.050727-5400)
CodeBase: file:///C:/Windows/Microsoft.NET/Framework/v2.0.50727/mscorlib.dll
----------------------------------------
GameFontEditor
Assembly Version: 0.3.0.0
Win32 Version: 0.3.0.0
CodeBase: file:///C:/GameFontEditor/GameFontEditor.exe
----------------------------------------
System.Windows.Forms
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.5446 (Win7SP1GDR.050727-5400)
CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Windows.Forms/2.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
----------------------------------------
System
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.5442 (Win7SP1GDR.050727-5400)
CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System/2.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
System.Drawing
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.5420 (Win7SP1.050727-5400)
CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Drawing/2.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
----------------------------------------
FreeImageNET
Assembly Version: 3.13.1.1
Win32 Version: 3.13.1.1
CodeBase: file:///C:/GameFontEditor/FreeImageNET.DLL
----------------------------------------

************** JIT Debugging **************
To enable just-in-time (JIT) debugging, the .config file for this
application or computer (machine.config) must have the
jitDebugging value set in the system.windows.forms section.
The application must also be compiled with debugging
enabled.

For example:

<configuration>
<system.windows.forms jitDebugging="true" />
</configuration>

When JIT debugging is enabled, any unhandled exception
will be sent to the JIT debugger registered on the computer
rather than be handled by this dialog box.
 
Hmm, the first thing I noticed is that the background when the grid is not shown is now black. Before it was grey which I found more useful. Also the colour of the settings panel is a bit strange. I'm running Windows7 under emulation on a Mac so it's possible that these issues are related to that. Thought I'd check though. Screenshot attached.

Functionality is working great so far though! :)
 

Attachments

  • Black GFE.png
    Black GFE.png
    140.6 KB · Views: 214
@el_hidalgo - I agree on #1. Fixed both issues in the code to be added to the next version. Thanks.

@xyth - It's a theme thing... I'll change it to absolute colors.
 
Regarding font editing -
I made some experiments, and for some reason it seems that editing the font has no effect in the game. I've edited both files (75 and regular), the changes in the icons were visible but changes in the font section were not :confused:
I checked it in the civilopedia and in the tool tips.
Has anyone ever successfully edited the font itself?

The font part of the things is not used for most of the text in the game. Most of the text is done via the actual True Type fonts in the Resources\Fonts folder. Plain Civ4 comes with Arial and Sylfaen (Final Frontier has Verdana). Which font is used for what is controlled in Civ4Theme_Common.thm (which defines 3 sizes of fonts in various styles, plus there are some that are commented out) - regular BtS's theme specifies Sylfaen for these (the Arial font is not mentioned anywhere in the theme files, so it is presumably left over from some earlier build).

The regular font part of the gamefont files is apparently used, but I only know of one place that I'm pretty sure of. I think it is used on the city billboards (the label thing for the city on the main map that shows basic info, including the name and icons for religions and such, and it can also have text for what you are currently building over the production bar part of it). Aside from that, I haven't noticed a good candidate. In FF (Plus or not) the actual verdana font is sans-serif so it looks different from the serif font in the two gamefont files; the city billboards are the only place I can remember seeing the serif font.
 
I'm not sure if I found a problem, but in the attached pic one of the gamefont icons isn't displaying. Is that coming from the gamefont75 file? I'm not even sure. Anyway, I've attached the gamefont75 as well. The icon that's supposed to be there is just the standard "hit musicals" icon. I just moved it to a different cell by copying and pasting, which was necessary because I removed several other icons in the file (all the modern resources, basically. It's for a classical-era mod).
 

Attachments

  • GameFont_75.rar
    GameFont_75.rar
    49.3 KB · Views: 149
  • gamefont75icon.png
    gamefont75icon.png
    24.2 KB · Views: 200
The file seems fine. I agree with NikNaks on the resources XML. If you don't find a problem there, maybe attach it and I'll try to see what's going on?
 
Back
Top Bottom