• We are currently performing site maintenance, parts of civfanatics are currently offline, but will come back online in the coming days. For more updates please see here.

Modifying Font Characters

bazilikas

Chieftain
Joined
Sep 14, 2012
Messages
4
Hi all,

I'm new one on forum and a little confused because it is too big forum :rolleyes:

Looking for a few days way to customize of Civ5 -gods'nkings- font characters for translating english to turkish. So means adding a few special characthers . Although several attempts have not been successful.

What should I do about it? Do not want to try if there is a solution too hard :king:

Thanks.
 
Hello. I have no idea but here is something that comes to my mind: I would look at the Chinese version of the game. I guess the devs didn't design a bitmap font containing tens of thousands of characters but rather relied on the standard truetype font. So I would try to translate a few keys from the Chinese version to Turkish and see if it works.
 
There is some info in the 2K wiki here. Basically, you have to make all changes/additions by XML placed in the /Sid Meier's Civilization 5/Text/ folder. Adding a new language looks like this:

Spoiler :
Code:
<?xml version="1.0" encoding="utf-8" ?>
<GameData>

    <!-- Create "Esperanto" translations table -->
    <Table name="Language_EO">
       <Column name="ID" type="integer" primarykey="true" autoincrement="true" />
       <Column name="Tag" type="text" notnull="true" />
       <Column name="Text" type="text" notnull="true" />
       <Column name="Gender" type="text" />
       <Column name="Plurality" type="text" />
    </Table>

    <!-- Add "Esperanto" language entry -->
    <Languages>
        <Row>
            <Type>eo</Type>
            <Name>Esperanto</Name>
            <TableName>Language_EO</TableName>
           
            <!-- Please see [url]http://wiki.2kgames.com/civ5/index.php/Mods:LocalizationSyntax#List_of_Plural_Rules[/url] for more information on plurality rules -->
            <PluralRule>2</PluralRule>
            
            <!-- Include the following elements if you need to use extended fonts -->
            <UseExtendedFont>1</UseExtendedFont>
            
            <!-- Name of an installed font on the user's machine -->
            <FontName>Segoe UI</FontName>
         </Row>
    </Languages>

    <!-- Insert Translations Here -->

</GameData>

The UseExtendedFont tag opens up all utf-8 characters, most of which are not available in base English localization.

You can also modify the existing English localization like this:

Code:
<?xml version="1.0" encoding="utf-8" ?>
<GameData>
    <Languages>
        <Update>
            <Set UseExtendedFont = "1" FontName = "Arial" />
            <Where Language = "en_US" />
         </Update>
    </Languages>
</GameData>

This bit of code is from memory so I'm not sure it is perfect (I don't work with xml enough to do it off the top of my head with confidence). But I've done this and played around with different fonts, all of which look stretched out wider than the actual font for some reason. "Arial Narrow" looks OK and not at all narrow.

Edit: For those interested in this topic from a modding perspective, note that you can't change anything here by XML/SQL in your mod added as an OnModActivated. Or more precisely, you can change the database data (e.g., UseExtendedFont) but it doesn't seem to do anything at this point. It seems that XML dropped in the Text folder runs before OnModActivated and this is necessary for it to work. (Which gives me the strange idea of dropping other code in the Text folder that has nothing to do with text.)
 
Hello. I have no idea but here is something that comes to my mind: I would look at the Chinese version of the game. I guess the devs didn't design a bitmap font containing tens of thousands of characters but rather relied on the standard truetype font. So I would try to translate a few keys from the Chinese version to Turkish and see if it works.

hm.. it's an interesting idea and worth a try , thanks!

There is some info in the 2K wiki here. Basically, you have to make all changes/additions by XML placed in the /Sid Meier's Civilization 5/Text/ folder. Adding a new language looks like this:

Spoiler:


The UseExtendedFont tag opens up all utf-8 characters, most of which are not available in base English localization.

You can also modify the existing English localization like this:

Code:
<?xml version="1.0" encoding="utf-8" ?>
<GameData>
<Languages>
<Update>
<Set UseExtendedFont = "1" FontName = "Arial" />
<Where Language = "en_US" />
</Update>
</Languages>
</GameData>
This bit of code is from memory so I'm not sure it is perfect (I don't work with xml enough to do it off the top of my head with confidence). But I've done this and played around with different fonts, all of which look stretched out wider than the actual font for some reason. "Arial Narrow" looks OK and not at all narrow.

Edit: For those interested in this topic from a modding perspective, note that you can't change anything here by XML/SQL in your mod added as an OnModActivated. Or more precisely, you can change the database data (e.g., UseExtendedFont) but it doesn't seem to do anything at this point. It seems that XML dropped in the Text folder runs before OnModActivated and this is necessary for it to work. (Which gives me the strange idea of dropping other code in the Text folder that has nothing to do with text.)

To write code not for me :) , but could try to implement what you wrote , appreciating !
 
Before me has found a solution someone who translation for the Civ 5 (without version of GnK) like this ;

Code:
"UseExtendedFont" INTEGER DEFAULT 1,
						"FontName" TEXT DEFAULT "Tahoma",
						"FontWidthScale" FLOAT DEFAULT 0.4,
						"FontHeightScale" FLOAT DEFAULT 0.8);

So just changed FontName as ''Tahoma'' in Civ5LocalizationDatabaseSchema
and also , UseExtendedFont" INTEGER DEFAULT 1 , instead ''0''

I applied same way and it worked :)

d13p0.jpg


Does this problem in the future?
 
@bazilikas,

Just for your information, those "core game files" get overwritten whenever the game updates (e.g., the next time there is a patch). You will then lose your changes.

Adding a file in the Text folder will avoid this problem.
 
As it turns out, I'll probably need to use extended-font characters for some Scandinavian place-names; will that text-folder trick work with the G&K update, and is there any way short of DLL editing to make extended-character access part of a mod (like importing the code into the virtual file system)?
 
, and is there any way short of DLL editing to make extended-character access part of a mod (like importing the code into the virtual file system)?

If there is, I haven't figured it out yet. This is one of those cases where you can update the database (and see the change in the DB) but it doesn't matter by that point. The Text folder seems to be checked at an earlier point. I just dropped an .xml file in there with the following contents:
Code:
<GameData>
	<Languages>

		<Update>

			<Set UseExtendedFont ="1" FontName="Tahoma" FontWidthScale="0.4" FontHeightScale="0.8"/>
			<Where Type="en_US" />

		</Update>

	</Languages>
</GameData>
It doesn't seem to matter what the file is called. One thing strange is that if you set UseExtendedFont ="1" but don't specify a font, you get some really nasty fonts in game. Or if you specify a font but not the two scalings you get some really wide fonts.
 
One thing strange is that if you set UseExtendedFont ="1" but don't specify a font, you get some really nasty fonts in game.
Actually, this is not strange at all. ;)

Games typically use bitmap fonts (manually drawn pictures of every character) rather than vector fonts (like truetype fonts). This is because a nice font vector system is:
* Very complex to implement
* CPU/GPU expensive, especially if you want subpixel aliasing over the GPU output.
* Even more if you want properly outlined fonts (mandatory when your background is not a solid color hence why all games use them) and non-uniform fills (also very common in games).
* Typically produces a worse result than bitmap fonts: vector fonts are not designed for outlined characters and while they provide a better aliasing this is not a problem in games since the font characters are usually very big. They also offer advanced typographic features like better kernings but, again, for games this is not that interesting.

However, artists typically only design pictures for a few dozens of characters. So when a language needs additional characters, or features not needed in western languages (Arabic allographs and ligatures for example), it resorts to a cheap vector system instead (cheap because this is a edge case, it needs to be fast, and the visual result will be disappoint anyway).
 
Actually, this is not strange at all. ;)

However, artists typically only design pictures for a few dozens of characters. So when a language needs additional characters, or features not needed in western languages (Arabic allographs and ligatures for example), it resorts to a cheap vector system instead (cheap because this is a edge case, it needs to be fast, and the visual result will be disappoint anyway).


Considering the technical problems, it's a good thing that both Turkish (the language that the original poster wanted) and the Scandinavian languages (which I'd want personally) use an extended Latin alphabet. Adding a few modified letters to the A-Z set is less work than adding a new alphabet/character block from scratch. And dropping some database tweaks into a text folder is better than settling for awkwardly respelled names in a modpack. For what it's worth, I'd release my own work-in-progress with those same database tweaks included (along with a README file to explain what the extra code is doing in the text folder).
 
Back
Top Bottom