• Welcome to SC4 Devotion Forum Archives.

LTEXT - Language Text Files (How to make multilingual buildings and queries)

Started by RippleJet, February 22, 2007, 04:02:12 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

sithlrd98

Now this is something different! I like where this is going &apls

Jayson

MAS71

Hi there ! :) I'm here!!  ;D
I'm sorry always to Ripplejet san for my not enough undestanding of English. :-[
I'd already send japanese Font.ini on PM. I'm hope to that will be your any helps.  ;)

Thank you.
-Mas'71

RippleJet

The fonts INI file (TGI 0x00000000, 0x4A87BFE8, 0x2A87BFFC), that I got from Masuda san,
is actually identical with the one that is included in my version of SC4.

All styles have the same fonts, same sizes, same xscales, ...
Thus, that can not be the reason for the differences seen in the images below.

The images show the query of the Census Repository Facility, Version 2,
and were posted the same day in the CAM thread during beta testing:

1. This one was posted by Barby:


2. This one was posted by Masuda san:



The font styles used in the query are:

GenHeader for the titles (e.g. "Census Repository Facility")
GenHeader     = "StocletITC TT",    "18",  "bold|aa=bg|linespacing=2|xscale=1.2|xadvancescale=0.99",      0x4a809916

GenBodyLight for the three lines between RalphaelNinja and the Close button
GenBodyLight  = "Arta",             "13",  "italic|aa=bg|linespacing=2|xscale=0.95|xadvancescale=0.99",   0x4a809918

GenButton within the Close button
GenButton     = "Arta",             "16",  "aa=bg|linespacing=2|xscale=0.95|xadvancescale=0.99",          0x4a809919

PUckDate for the ordinary text
PUckDate         = "Arta",             "11",  "aa=bg|linespacing=1|xscale=0.95|xadvancescale=1",       0x4a809912


I guess this indicates that the font (mxf) files, even if having the same filenames,
are not the same in the Japanese version of the game, as in ours...

Could Masuda san show us the directory listing of his fonts folder?
This is the content of mine:


25.08.2003  06:03            50,000 Arial MT (Bold Italic).mxf
25.08.2003  06:03            50,000 Arial MT (Bold).mxf
25.08.2003  06:03            50,000 Arial MT (Italic).mxf
25.08.2003  06:03            60,000 Arial MT.mxf
25.08.2003  06:03            40,000 Arta (Italic).mxf
25.08.2003  06:03            40,000 Arta.mxf
25.08.2003  06:03            90,000 CordiaUPC (Bold).mxf
25.08.2003  06:03           100,000 CordiaUPC.mxf
25.08.2003  06:03            90,000 Courier LD (Bold Italic).mxf
25.08.2003  06:03            80,000 Courier LD (Bold).mxf
25.08.2003  06:03            80,000 Courier LD (Italic).mxf
25.08.2003  06:03            70,000 Courier LD.mxf
25.08.2003  06:03         2,600,000 HG-Gothic (Bold).mxf
25.08.2003  06:03         2,700,000 HG-Gothic.mxf
25.08.2003  06:03         2,320,000 Hy Round Gothic (bold).mxf
25.08.2003  06:03         7,910,000 Hy Round Gothic.mxf
25.08.2003  06:03         6,160,000 MHei B5 (Bold).mxf
25.08.2003  06:03         2,590,000 MHei GB (Bold).mxf
25.08.2003  06:03            50,000 Stoclet ITC TT (Bold).mxf

ebina

Japanese version contains the same font files. Difference is that Japanese version of SimCityLocale.dat includes modified fonts INI, all letters are displayed in HG-Gothic with different font size in our language version. I think some language versions of SimCityLocale.dat also include special fonts INI.

RippleJet

Thanks, Ebina san! That's good to know! :)
Could you post a copy of the fonts INI file included in the Japanese SimCityLocale.dat?

ebina


RippleJet

Thanks, Ebina!
That explains a lot. :)

Looking at the file sizes, it's also obvious that only three fonts contain a full character set (including Japanese, Chinese, Korean and Thai): ::)


  • HG-Gothic
  • Hy Round Gothic
  • MHei

thetinker

 RippleJet, I sent you a PM, then saw the latest posts. It appears that the only thing affected is the "Census/Repository/Blame" text, with the GenBodyLight font center aligned. It may be getting proportionalized, that is a word processing function where a line of text is stretched to run from margin to margin. Since the anchor point is in the center, the left and right text runs outside the box area. Try left aligning the text, then modify the style and box area to fit.

BTW, for anyone interested, I found the "Place Label" function entry code in the SC4.exe file, so now I have a keyboard shortcut, and you guys can't bribe me with it. Its MsgID is 0x0B980587. Extract the main Key.cfg file from sc_1.dat, find a shortcut you can do without, or an unconfigurd key, and use the MsgID above. Stick the .dat file in your plugins, and you're set to go.

RippleJet

Quote from: thetinker on March 05, 2009, 08:44:46 AM
RippleJet, I sent you a PM, then saw the latest posts. It appears that the only thing affected is the "Census/Repository/Blame" text, with the GenBodyLight font center aligned. It may be getting proportionalized, that is a word processing function where a line of text is stretched to run from margin to margin. Since the anchor point is in the center, the left and right text runs outside the box area. Try left aligning the text, then modify the style and box area to fit.

As I replied in the PM back to you:

The GenBodyLight, which I've used for the text to the left of the Close button is a 13pt Arta in our INI file.
In the Japanese INI file it's replaced by an 11pt HS-Gothic, which, despite being smaller, is a lot wider.

It's quite obvious that HS-Gothic's width is increased due to the complexity of the Japanese/Chinese characters.
I don't think there's any proportionality in that font, as there's a lot of empty space to the left and right of it when using 11pt Arta.

Besides, the width of the field reserved for those texts has been made wider in Version 3 of the Census Repository. ;)

thetinker

 Ripplejet, I put ebina's file in my plugins, plopped the repository, see. the problem. Quit the game, repaced your UI with mine, works perfect. Try it.

thetinker

 Ok, now that I've seen the problem, I went back and restored your original UI. Then I made 3 changes from the font styles GenBody Light to PUckDate in "Census/Repository/Blame". That's all it took. It looks fine on my USA/English installation with Ebina's Japanese fonts.ini file in place. I know her file has changed al the fonts in the rest of my game, so the UI is using the HG-Gothic set. Since all the Ltext you use is included in the .SC4Lot file, I can't see how the Japanese Locale.dat would interact. Of course, I have no idea how the Kana characters will look.

I know I'm getting tired, suddenly I can't spell worth a damn. I'll check back when you've had a chance to try what I did.

And, I re-reread your PM, and took one more look. With the changes I made listed above still, in place, I pulled ebina's file. Yes, that text is a little small, but still quite legible, even for old eyes like mine. So, I see you have three option:
1) The minor change above.
2) Two versions, one Western, one Japanese.
3) Include a custom fonts.ini file with the Japanese version. I haven't tried it, (and I'm not going to right now, I need sleep), but it might be possible to define a new style in the fonts.ini file. That's something that might be worth exploring, because it would offer a lot of flexibility.

I really have to go now. Have fun.

thetinker

 Before I walk away from this for a day or so, let me share one golden insight into HOW the font specs interact.

1) The font size can be anything from 0 to 256.  Bigger size, bigger character, right? Maybe. The smaller the size, the less detail and crispness in the character, but the more characters you can fit on a line. Big font sizes give very crisp, detailed characters, but fewer on a line, and of course, very large. Using smaller sizes, you can tune them somewhat with the gamma, sharpness, and anti-aliasing parameters, but there are limits to how much you can effect a smaller size to enhance it's appearance. Despite the tendency of Maxis/EA to spec odd point sizes, like 13, the best results come from using sizes that are multiples of 16. Also the typeface matters. Two fonts can be spec'd at the same size, but differ in actual size. (BTW, the color parameter has no effect on labels, that seems to be hardcoded.)

2) I use very tiny labels, on the order of 6-8 characters per simcity grid cell. Trying to use a 4 or 6 point font will degrade the characters significantly, with some characters, into ilegibility.  The SECRET (shhh...) is to pick a large font size and use the x-scale and y-scale parameters to scale it down. To get about 4 characters per grid cell, I use a size 80 font, x and y scaled to about 0.25. I get the best of both worlds, small, clearly legible characters.  CharSpacing and XAdvanceScale are used to adjust the spacing between character. They do affect one another in a subtle way I'm too fried to try to explain, so experiment with incremental changes first on one, then the other. Linespacing simply lifts the character above or below the horizontal centerline.

3) None of this matters if you don't want to mess with an enduser's pre-defined Maxis/EA named styles, so you are left with fighting with the problem RippleJet is having in trying to compromise between what Maxis supplied, and what he wants to do.

4) IF someone wants to try an experiment, find the style [Symbols = "SimDingbat"] in the fonts.ini file. There is no SimDingbat font supplied with the game, unless its hidden in the .exe, but even if it is, it isn't used in the game. Replace SimDingbat with one of the supplied font names, spec its parms to something distinctive you can spot in the game, then reference it in a Query. If that works, try redefining the style name "Symbol" to, say, RibbleJetQueryStyle, and reference it  in the Query. If that works, try adding a new style name, and define it, reference it, and check it.  If that works, then we can worry about setting up a registry database for people to reserve style names for the billion or so font.ini mods that will suddenly appear.

Bye, now. ZZzz..

RippleJet

Quote from: thetinker on March 05, 2009, 09:59:42 AM
Ok, now that I've seen the problem, I went back and restored your original UI. Then I made 3 changes from the font styles GenBody Light to PUckDate in "Census/Repository/Blame". That's all it took.

Yes, and as I told in the PM to you, that is the option I was considering.
On the other hand, I would first want to see how the current Version 3 of the Census Repository Facility looks to a Japanese player.

So far we've only seen queries belonging to Version 2. Version 3 is available on the LEX. ;)
Even the UI file you sent me, is from the old version 2. :P

Masuda san or Ebina san? ::)


Quote from: thetinker on March 05, 2009, 09:59:42 AM
It looks fine on my USA/English installation with Ebina's Japanese fonts.ini file in place. I know her file has changed al the fonts in the rest of my game, so the UI is using the HG-Gothic set. Since all the Ltext you use is included in the .SC4Lot file, I can't see how the Japanese Locale.dat would interact. Of course, I have no idea how the Kana characters will look.

The file Ebina san (he is a he) posted was extracted from the Japanese SimCityLocale.dat.
Actually, if entered as UNICODE in an LTEXT file, Japanese characters (katakana, hiragana and kanji) all appear correctly in our games as well.

I doubt those would be included in the small Arta or StocletITC TT font files though...
Thus, I don't know how those are handled within the game.


Quote from: thetinker on March 05, 2009, 09:59:42 AM
3) Include a custom fonts.ini file with the Japanese version. I haven't tried it, (and I'm not going to right now, I need sleep), but it might be possible to define a new style in the fonts.ini file. That's something that might be worth exploring, because it would offer a lot of flexibility.

Providing a custom fonts INI file might be tricky though.
First of all I have no idea if the Chinese, Korean and Thai versions of the game use the same fonts INI file in their SimCityLocale.dat files.

If we created a custom INI file, optimized for a certain market, that might screw up quite a lot other fonts in the game if people elsewhere installed it.
People would be asking why all their fonts suddenly changed into HS-Gothic (without knowing the name of the font of course)...
And that we could never avoid, regardless how well we wrote that in the readme... ::)

MAS71

Upload pics of both here.(Japanese version) "$Deal"$

- Census Repository Facility Version 2 -
Quote2. This one was posted by Masuda san:

- Census Repository Facility Version 3 -

- Original Size -



#### Edited ####
by the way,
A screen size of PC is 1024 x 768 I using.
Is this UI-window's size would change(fit) by(with) screen size of PC??

thetinker

Quote from: RippleJet on March 05, 2009, 01:59:44 PM
Yes, and as I told in the PM to you, that is the option I was considering.
On the other hand, I would first want to see how the current Version 3 of the Census Repository Facility looks to a Japanese player.

So far we've only seen queries belonging to Version 2. Version 3 is available on the LEX. ;)
Even the UI file you sent me, is from the old version 2. :P

Sorry about any miscommunication. I don't currently have my workspace set up for this kind of network collaboration, and I was bouncing back and forth between applications and networking, so I was modifying and posting before I got your PM. ( I was also quite bleary.) I will grab  a copy of version 3, and take a look.

Quote from: RippleJet on March 05, 2009, 01:59:44 PM
Masuda san or Ebina san? ::)

The file Ebina san (he is a he) posted was extracted from the Japanese SimCityLocale.dat.
Actually, if entered as UNICODE in an LTEXT file, Japanese characters (katakana, hiragana and kanji) all appear correctly in our games as well.

I doubt those would be included in the small Arta or StocletITC TT font files though...
Thus, I don't know how those are handled within the game.

I didn't notice an attachment with Masuda san's post. I used the one from Ebina, and Ebina, no offense was intended. I am a typically provincial American, and interpreted the "..ina" as the female diminuative. My apologies.

I know nothing about international typography, so I have to bow to your expertise. I would suspect that non-Western installations have the English fonts.ini embedded in the sc_1.dat file, and for foreign markets, EA included that market's font.ini  in the SimCityLocale.dat, as it is logically loaded later and would overwrite the original. If it were my call as a company exec, that's the way I would have gone. The font package was probably intended to include enough variety for a world market. (Note the HG-Gothic is never mentioned in the Western fonts.ini) Since most commercial typefaces are proprietary and would require licensing, EA either licensed a moderately compatible group, or created their own (my previous Photoshop speculation). Either way, they propably did not anticipate the huge trans-national modding efforts, so they chose cost-effective compromises. I guess we just have to be creative enough to overcome those limitations. Your work is amazing, and you shouldn't take it as a personal defeat if you get 'gotcha'd" by those limited choices.

Quote from: RippleJet on March 05, 2009, 01:59:44 PM
Providing a custom fonts INI file might be tricky though.
First of all I have no idea if the Chinese, Korean and Thai versions of the game use the same fonts INI file in their SimCityLocale.dat files.

If we created a custom INI file, optimized for a certain market, that might screw up quite a lot other fonts in the game if people elsewhere installed it.
People would be asking why all their fonts suddenly changed into HS-Gothic (without knowing the name of the font of course)...
And that we could never avoid, regardless how well we wrote that in the readme... ::)

I think the question is, are all markets getting the same font package. If my Western version doesn't use HG-Gothic, why is it in my fonts folder. They probably all get the same fonts. And no, custom font.ini files as they are currently used supplied by diferent modders would create a nightmare for the end user. Exactly why I didn't want to publish my label font mod, because other than a minor change to the label UI, the mod is only a custom font.ini file.

But... If the experiment I suggested in my prior post can work (and, I'm going to try that experiment tonight), then you avoid the nightmare. A new and unique style name, referencing a standard font, but specing a different set of parameters, and referenced only from a specific plugin mod would not interact with any other GUI element in the game, including other Queries, as long as they did not use that specific name. The only consideration would be which font a local market would use. It would never have occured to me, as a modder, that the Japanese are only using the HG-Gothic font.

As the mod's developer, you might be forced to supply a different .ini file for each market, where the style name uses that market's font. I say that because Ebina's file automatically converted your standard style name references. It wouldn't know what to do with a new style name. Best case, it would use a default font in the Query. Worst case, the game would choke on a null pointer. CTD.

And yes, in good conscience, you would have to check that your mod works with that font. I can see the difficulties in your case, because you are trying to pack a very large amount of data into a very small footprint. My turn to say "impressive work". You could always take the easy way out, and go for a bigger footprint in a version 3.1, but I think you, like me, prefer an elegant solution. I really like the way your layout looks. Very professional.

If you decide to stick with the unmodifed fonts.ini approach, I'm not sure I can offer any concrete help. You only have the style specs available, and have to work your layout around that roadblock. Not a problem with one language. But the title of the topic is "...multilingual..." I only wound up in here by accident, looking for that bldg. property rep tidbit.

I think, for the moment, I don't have anything else to offer. I'll check back in, in a day or too, to see if anything develops, or I have an insight. BTW, RippleJet, nice to meet you, and you, Swamper.

thetinker

IT WORKS!

I cleared all font modifications out of my plugins. I extracted an original clean fonts.ini to Test_fonts.dat.

I opened the Repository in Reader, a handy plugin whose UI I'm becoming familiar with, found a field using GenHeader, and replaced it with Symbols, and saved the file. Apparently, Symbols=SimDingbats exists somewhere in the SC4 installation. I found various symbols, trademark, copyright, etc., so it may actually be used in logos and credits, possibly some other miscellaneous out of the way places.

Exiting SC4, I added a new style name to Fonts.ini, TestMyTheory = "Hy Round Gothic ", "24", "bold", and an arbitrary GUID. (More on the GUID later.) Saved the file, opened the Repository in Reader, went to the field I had previously replaced with Symbols, and typed in TestMyTheory. I did the in-file save in Reader, and re-Previewed it. The UI only showed a tiny illegible font,  but I saved the file anyway. I ran SC4, plopped the Repository, queried it and up popped the Query with the 24 point Hy Round Gothic font in place in all its glory.

IT WORKS!

The problem in Reader occurs because iLive hard coded the standard fonts.ini style names into the .exe, (I checked), and did not expect anyone would customize it. He did make provision to display a default font, but at least on my machine it is too small to be readable. Perhaps if everyone is especially kind to iLive, we could prevail upon him to do an update. Or, one of you up-and-coming programmers could write a new UI Editor with some new capabilities.

BUT IT WORKS!

I have to do some more testing to see if there are conflicts with other GUI elements, but I don't expect any, except in one area, and that is the "arbitrary GUID" that is necessary, and which could lead to conflicts. I scanned through the fonts.ini and choose something in the middle range, about 0xA0 higher than GenHeader. I thought that was reasonably safe for the purpose of this experiment. And so...

* !A HUGE WARNING! *

To all modders looking at this technique. I am NOT a programmer, just a reasonably competent tinkerer. I seriously doubt that Maxis foresaw this kind of add-in customisation. There may be limits to memory buffers allocated for style definitions. I for one know nothing about the GUID implementation. There may be ranges that are totaly safe, and others that may cause your hard drive to run off with your cash (and your wife). We need to find someone in the community, with some real expertise to look at this.

* !DO NOT PUBLISH MODS USING THIS TECHNIQUE! *
* !THIS IS PROOF OF CONCEPT ONLY! *

I need to take some time to pull all my notes together into some kind of documentation, but for you adventurers who want to explore this for your personal use, have fun. Just be careful.

N.B. A footnote: I saved the city, exited SC4, removed the font mod from my plugins, and went back in. The game engine was intelligent enough to default to what I think is the hover query body text font, so it may be safe from that stand-point.

vil

Magic that...

Never mind japanese, at the very least StocletITC has most czech characters available, whereas Arta does not.

However Reader doesnt like UNICODE characters above 00FF (neither editing nor importing), hex editing works but on LTEXT import the 01´s get replaced by 00´s.

Any tips on editing LTEXT files anyone? Any hope for fixing the LTEXT import on reader?

example:

required             works in             UNICODE               after reader
character           reader                                          LTEXT import

á                      á                      E1 00                    E1 00
č                                              0D 01                   0D 00

RippleJet

Thank you, Masuda san for that query image! :)

Quote from: MAS71 on March 05, 2009, 07:57:53 PM
A screen size of PC is 1024 x 768 I using.
Is this UI-window's size would change(fit) by(with) screen size of PC??

No, the query has a fixed size of 760 × 596 pixels.


Quote from: thetinker on March 05, 2009, 08:51:40 PM
You could always take the easy way out, and go for a bigger footprint in a version 3.1, but I think you, like me, prefer an elegant solution.

Since the "footprint" already is close to 800 × 600 pixels, I don't want to increase it.
There probably are quite a number of players out there still having that resolution in SC4.

And since Masuda san kindly showed that the text which is GenBodyLight (11 pt HS-Gothic),
now (in Version 3) fits between the BSC logo and the Close button, I'm pretty satisfied with it. ;)


Quote from: thetinker on March 06, 2009, 01:24:28 AM
The problem in Reader occurs because iLive hard coded the standard fonts.ini style names into the .exe, (I checked), and did not expect anyone would customize it. He did make provision to display a default font, but at least on my machine it is too small to be readable. Perhaps if everyone is especially kind to iLive, we could prevail upon him to do an update. Or, one of you up-and-coming programmers could write a new UI Editor with some new capabilities.

iLive has been MIA since some four years back, and is certainly not coming back to do any modifications.
On the other hand, I never use the UI Editor, I make all queries in Reader's text view, which provides a lot preciser control over the layout.


Quote from: vil on March 06, 2009, 02:07:54 AM
However Reader doesnt like UNICODE characters above 00FF (neither editing nor importing), hex editing works but on LTEXT import the 01´s get replaced by 00´s.

Any tips on editing LTEXT files anyone? Any hope for fixing the LTEXT import on reader?

Vil, can you use the letter č while editing LTEXT files in PIM-X?

vil

Oh yes it works fine!

Cant open arbitrary LTEXTS in PIM-X though can I? Like from SimcityLocale.dat?

Can create new, paste text, save and  :-\  TGIs with reader.

RippleJet

Ahh, now I understand...
And no, you cannot add č in Reader in an LTEXT file...

Instead I would create a phony ploppable lot in PIM-X, convert the Item Description into a "multilingual" LTEXT file,
and finish that LTEXT file in PIM-X for whatever purpose you need it, including whatever Czech characters you desire...

Then copy that LTEXT file in Reader to where ever you need it, change it's TGI, but do not change its content.

Maybe we should ask Stéph for a tool, only to edit LTEXT files with... ::)