I'm still working on getting a proper implementation of Russian into GameFont.tga.
I have learned that each icon in GameFont has an ID. The functions to get a specific icon is actually functions to get their ID (an int) and then there is a general piece of code to convert an int to graphics.
Fair enough. We can display whatever we want from GameFont as long as we have the ID. I added a new button to the domestic advisor and it will add 1000 columns. Each column then has an ID and it prints the icon, which is linked to that ID. It's a fairly simple approach to get all IDs. The code is written in such a way that you just have to uncomment a single line to enable it. This mean we can keep it in the code and fairly easy enable it whenever we feel like modifying GameFont.
There is one major problem through. The exe controls what ID certain icons has. Even worse, the debugger reveal that there is no clear pattern to how the exe moves around in this file. This mean we should "ask" the exe for permission whenever we want to modify GameFont. That is clearly a bad situation.
I have come up with the idea to cut out the exe. It will still try to assign IDs, but we can make the exe stop listening to what it says. There are also some calls to gDLL->getInterfaceIFace()->getSymbolID(). We can write our own function to replace this function. This will move the entire ID<->icon matching to the DLL.
Next up is how to handle this in the DLL. First we reorder GameFont. We should have one row for each class of icons. It starts with a row for yields, then a row for buildings. We keep those like that.
After that we make a row for bonuses and then one for father points. After that we make one for FontSymbols and we have everything we have now. Russian can then be added after that.
This layout will result in the ID for an icon will be the ID for the first icon in the row + m_eID of the info class. This mean the DLL can handle everything if we just tell it the ID of the first icon in each row. We have the ID from the domestic advisor meaning it will just be a matter of providing the info to the DLL at startup. I figure if we add a new XML containing those ints, then it will be easy to set and each mod can have its own values.
With a platform like this, adding new icons, be it Russian or anything else will be much easier. In fact we may finally be able to get the correct building icons in domestic advisor.
As it appears to be easy to add new rows, I wonder if I should try to add a row for unit icons (scaled down button art). That would make the unit pages in the domestic advisor look better and it was my original goal when I made that page. I just failed to figure out how to access those images, though I gave up for the right reason: they were inaccessible at the time.
If nobody objects I will start this change ASAP.
Also regarding Russian. I have been working on getting a 3rd party tool to convert the text into the right format (I linked to it before). I have realized that we will likely not need external tools for that. All we need to do is to ensure translators set their editors to UTF-8. When the DLL reads a string from XML, it can then read it char by char. We know the IDs for each character in GameFont and we know what the IDs for the same characters in UTF-8. This mean we can make a conversion table. If read char is, then store the char ingame as X.
The result is that the DLL will act like it can read XML files with UTF-8 encoding and the XML files will that way stay human readable.
How to edit the XML files in UTF-8? Simple: Download
http://notepad-plus-plus.org/
Then set it to always use UTF-8 encoding in the encoding menu and/or set it to use it by default:
http://blog-rat.blogspot.dk/2010/03/how-to-make-utf-8-as-default-encoding.html