Last Shout - Posted by: Bernie - Sep. 09, 2020, 04:40:16 PM
WTF is up NW?!!!! ;D

Author Topic: Main Font Format?  (Read 4257 times)

0 Members and 1 Guest are viewing this topic.

Offline Nazer

  • Hapless Fledgling
  • *
  • Posts: 8
  • Karma: +1/-0
  • Alexander Nazarovsky
    • View Profile
Main Font Format?
« on: Jan. 06, 2007, 12:38:48 PM »
Hi. First of all, thanks to NightWolve and his great work!
Now, I have an idea of translation Ys I & II Complete into Russian.
I've found that the main font is stored in "font._ys". But does anybody know, in which format it is?
Small font 6x6 is actually bitmap and it's easy to edit, but i don't know how to edit the main font?  ???

Offline NightWolve

  • Administrator
  • Distinguished Shogun
  • *****
  • Posts: 865
  • Karma: +132/-0
  • Gender: Male
    • View Profile
    • Ys Utopia.net
Re: Main Font Format?
« Reply #1 on: Jan. 08, 2007, 02:56:36 PM »
As there was a decent English font already included, I never had the need to decode that font file, so I couldn't tell you anything about the format.


You break my record, now I break you, like I break your friend!

Offline Nazer

  • Hapless Fledgling
  • *
  • Posts: 8
  • Karma: +1/-0
  • Alexander Nazarovsky
    • View Profile
Re: Main Font Format?
« Reply #2 on: Jan. 09, 2007, 08:04:50 AM »
Ok, thanks. I shall try to dig it myself =)

Offline Nazer

  • Hapless Fledgling
  • *
  • Posts: 8
  • Karma: +1/-0
  • Alexander Nazarovsky
    • View Profile
Re: Main Font Format?
« Reply #3 on: Jan. 10, 2007, 08:22:30 AM »
NightWolve
One more question. Tell me please? how is data in the main file compressed? do you have compressor? (your decompressor works fine :) )

Offline NightWolve

  • Administrator
  • Distinguished Shogun
  • *****
  • Posts: 865
  • Karma: +132/-0
  • Gender: Male
    • View Profile
    • Ys Utopia.net
Re: Main Font Format?
« Reply #4 on: Jan. 10, 2007, 10:38:25 PM »
No, I never wrote a compressor based on the decompression code I extracted from the executable. I'm not that good...


You break my record, now I break you, like I break your friend!

Offline Nazer

  • Hapless Fledgling
  • *
  • Posts: 8
  • Karma: +1/-0
  • Alexander Nazarovsky
    • View Profile
Re: Main Font Format?
« Reply #5 on: Jan. 17, 2007, 02:14:32 AM »
Actually we found that this file is 1bpp 24x19 font, but 8836 symbols in it :)

Offline NightWolve

  • Administrator
  • Distinguished Shogun
  • *****
  • Posts: 865
  • Karma: +132/-0
  • Gender: Male
    • View Profile
    • Ys Utopia.net
Re: Main Font Format?
« Reply #6 on: Jan. 18, 2007, 07:16:33 AM »
Aaah, so it was 24x19. Yup, you're right. Your Russian characters are right there. They're always included with S-JIS actually. But were you to use 2 byte S-JIS characters right now, do they appear as full-width spaced characters is the question. I imagine the answer is yes since you've come here asking for info. So I suppose all you have to do is copy the bytes where the Russian begins into where the English begins early in the file both for upper and lowercase, then have an editor to map English to Russian or however you edit to make it easier to translate between the two, etc.

I created the attached image using the decompressed font file by running: "php feidian.php -r 24,19,21,32,0x0 FONT.YS FONT_YS". There is a script program to take bitplanes and convert them to bitmap allowing you to edit them in whatever image editor you like. When you're done, you can run it again to convert back to bitplane. It's what I used for Ys IV: The Dawn of Ys. Anyway, I didn't hack the game to read a file like this decompressed as I did for the bitmaps. The image loading function intercepts bitmap files only in the bmp subfolder. I never had to recompress them because I simply read them into the decompression buffer after the original bitmap is decompressed into it. Works like a charm for every game I've used it on.



You break my record, now I break you, like I break your friend!

Offline Nazer

  • Hapless Fledgling
  • *
  • Posts: 8
  • Karma: +1/-0
  • Alexander Nazarovsky
    • View Profile
Re: Main Font Format?
« Reply #7 on: Jan. 18, 2007, 01:07:04 PM »
You are right, that Russian characters are two byte encoded (like Japanese hieroglyphs).
First byte is 84h and second from 40h to 60h (capital letters) or from 70h to 91h(small letters).
I think that it will be easier to write a program that remaps encodings and puts two-byte encoded characters to the script, rather than alter and recompress this font =)

Offline NightWolve

  • Administrator
  • Distinguished Shogun
  • *****
  • Posts: 865
  • Karma: +132/-0
  • Gender: Male
    • View Profile
    • Ys Utopia.net
Re: Main Font Format?
« Reply #8 on: Jan. 18, 2007, 07:08:47 PM »
Does the game, when printing Russian, using fixed width spacing or does it do variable width as it does for English though? I could test that, but I don't care that much. But anyhow, if not, you need to take the Russian character set and move it to where the English set is, plus, you must hack the game to read the updated font file into the decompression buffer after the original font file is decompressed, etc.


You break my record, now I break you, like I break your friend!

Offline Nazer

  • Hapless Fledgling
  • *
  • Posts: 8
  • Karma: +1/-0
  • Alexander Nazarovsky
    • View Profile
Re: Main Font Format?
« Reply #9 on: Jan. 19, 2007, 04:40:43 PM »
You misunderstood, i shall not change the font, i'll try to change strings in script and exe to the 2-byte encoded Russian (since they already are in the font). I think though in .exe it will be harder, because strings will be longer. But at least i'll try.

Now i've written a simple script editor on Delphi and already translated near 300 strings. If I'll complete this translation, i would like you to include translation into your patch :)

btw do you know what are the numbers in the beginning of the "script.ys1"? Are they corresponding string lengths or not? I'm not changing them, but everything seems to load fine...

In game it looks like this

Offline NightWolve

  • Administrator
  • Distinguished Shogun
  • *****
  • Posts: 865
  • Karma: +132/-0
  • Gender: Male
    • View Profile
    • Ys Utopia.net
Re: Main Font Format?
« Reply #10 on: Jan. 19, 2007, 07:48:45 PM »
Actually, I didn't misunderstand. I've been asking you if when using the 2 byte S-JIS values, do you get a nice variable width like you do for English, OR, do you get an ugly fixed-width spaced font. But based on the image, you don't really need to do anything. You're taking advantage of the fact that I let you grow or shrink the script file to your heart's content, so it'll just be twice as big doing it this way, but you avoid the hassle. Look, normally when you use 2 byte S-JIS characters, they appear as fixed-width spaced characters such as this:



If your Russian appeared that way, then you would have to alter the font file. That's what I've been asking you two times already. But anyway, your image answered my question. The font spacing looks fine. One could do Greek as well and not have to change anything.

The data in the script file at the beginning was rendered obselete because I altered how the script was loaded. Before, you would have to update those offsets for every string. But I changed it on purpose to make my life easier so you could just update strings and not have to rebuild the offsets. I did have to leave it alone though so as to get passed some old portions of the script loading code so I wouldn't have to do more hacking.

As for your offer on making your Russian translation official and giving it to me to create a 2nd patch, I'll have to pass. Are you yourself the translator? I ask because your command of the English language being demonstrated to me here in this thread doesn't give me confidence that your translation to Russian would even be decent. I don't mean to offend, but you know, it is your 2nd language and you are not understanding me very well by the looks of it so I would wonder how well you're understanding Psycho DeuceBag's English in the script... Anyway, normally I wouldn't have helped you because you didn't ask me before you started to hack my work, but this is as far as I go.


You break my record, now I break you, like I break your friend!

Offline Nazer

  • Hapless Fledgling
  • *
  • Posts: 8
  • Karma: +1/-0
  • Alexander Nazarovsky
    • View Profile
Re: Main Font Format?
« Reply #11 on: Jan. 20, 2007, 06:55:15 AM »
Yeah, my English is not very good, but I suppose to give the English script and Russian translated script to some more persons to check it, or even put them both on website so that everyone could seek for the mistakes. Thank you very much for your agreement.

Admin's Note: His Russian Ys I Complete Localization project began here:
https://nazarovsky.livejournal.com/101583.html