Jump to content
The Dark Mod Forums

Recommended Posts

Posted (edited)

Hi!

 

Since the winter of 2025th I have been translating the "iris" mission. The translation is ready, but one thing - a problem with the Mason Chronicles font - prevents it from being published.

May the forum society help me with it's localization into russian language ?

 

Now it looks like this:

 

image.png.7a843a6634301f2b3b924685caf22cab.png

The file, that comes with the game, contains some letters. But not all of them. Wiki says:

Quote

At this point, the /russian/ versions of the seven bitmap shaders were frozen, and remain unchanged to the current day (unless DarkFate independently has made further alterations; beyond our scope here). [There was a 2021 touch of all font file dates... was anything changed then?]

While a Russian "mason_glow" font was created and shipped, it is merely a placeholder: an exact duplicate of "mason", in regard to the content of their DAT files and their sets of DDS files. Instead, the Russian deployment provides a substitute visual effect by rendering each character twice.

So the font modification was not finished 4 years ago.

 

Ok. I found russian version of Mason font in TTF:

image.thumb.png.4625966b0d21a990c231702d0a3dd155.png

And tried to converi it with  ExportFontToDoom3  and GIMP. I typed the command:

ExportFontToDoom3 masonchronicles3.ttf -size 12 -size 24 -size 48,

It worked, but TGA  font files contain only english letters:

 

image.png.1c4a40439197781bcc0d2989eb919dbc.png

 

Where is my mistake ?

 

 

 

 

Edited by kalinovka
duplicate images
  • kalinovka changed the title to Font localization
Posted (edited)
On 5/27/2025 at 8:12 AM, Geep said:

you may have better luck with ExportFontToDoom3All256, described and available here:

https://wiki.thedarkmod.com/index.php?title=ExportFontToDoom3

Beyond that, I haven't done anything personally with Russian fonts. Maybe the folks at DarkFate have further ideas about conversion from TTF to DAT/DDS (e.g., via some font editor?)

Thanks for your reply. I tried to run ExportFontToDoom3All256. Result is the same. The cause is that it takes only positions 0 -255 from the TTF. But cyrillic letters are located at 1025 - 1115 positions.

 

Edited by kalinovka
Posted

@kalinovka, probably no quick solution. I imagine, with a font editor that reads/writes TTFs, you could relocate the Cyrillic down to the 0-255 range in a custom TTF, which could then be processed by ExportFont3All256.

Or, if you know C++, you could make a variant version of ExportFontDoom3All256 with a different input range (both start and end) in the loop.* The wiki page contains a link to the source code for a Visual Studio build.

In either case, you'd want to order the glyphs (or glyph processing) as Win-1251 (and TDM) expects, so the generated .DAT files would require minimal fixup.

* Specifically, you'd start with FontExporter.cpp, and in function FontExporter::export_, change the loop indices of:
    // Export all characters.
    for (int characterCode = 0; characterCode < Font::numCharactersToExport; characterCode++)

  ...

But if that was all it took, I'd be very surprised.

Posted


@kalinovka, I'm assuming your TTF font codepoints are those of Unicode. A conversion to Win1251 would use this map:

https://www.unicode.org/Public/MAPPINGS/VENDORS/MICSFT/WINDOWS/CP1251.TXT


The lower 128 are just ASCII, where Unicode and Win1251 use the same number.

The upper 128 contain both the 90 codepoints you mentioned (starting with 1025 aka 0x0401), interposed with other characters. A proper rendering for TDM would include all these characters.


It is possible that some old-school font editor already has an export profile for Win1251.

As for hacking up a variant of ExportFontDoom3All256, you'd need to write a static array, holding Unicode values from CP1251.TXT. You could just do the upper 128 if you want, as shown next.

Example:

const static unsigned long UnicodeFor1251::array[] =
{
  0x0402, // 0x80 CYRILLIC CAPITAL LETTER DJE
  0x0403, // 0x81 CYRILLIC CAPITAL LETTER GJE
  ... // more tedious or fancy editing here
}

Then the code loop would be something like [NOT TESTED]:
 

    // Export all characters.
    unsigned long sourceCharacterCode;
    for (int outputCharacterCode = 0; outputCharacterCode < Font::numCharactersToExport; outputCharacterCode++)
    {
        if(outputCharacterCode < 128)
            sourceCharacterCode = outputCharacterCode;
        else
            sourceCharacterCode = UnicodeFor1251[outputCharacterCode - 128];
        bool okay = exportCharacter(sourceCharacterCode, outputCharacterCode);
        if (!okay)
        {
            std::cerr
                << "Error: Unable to export character " 
                << getCharacterCodeString(characterCode) << "."
                << std::endl;

            return false;
        }
    }
    ...

Further down in FontExporter.cpp, more changes...

bool FontExporter::exportCharacter(unsigned long sourceCharacterCode, outputCharacterCode) // WAS single parameter characterCode
{
    Doom3GlyphDescriptor* doom3GlyphDescriptor = 0;

    // Get the index of the glyph that represents this character.
    int glyphIndex = self.font->getGlyphIndexForCharacterCode(sourceCharacterCode); // WAS characterCode
   ...
                // Create a descriptor for the current glyph.
            doom3GlyphDescriptor = &self.doom3GlyphDescriptors[outputCharacterCode]; // WAS characterCode
   ...
}

After a successul export, there's still lots more testing and tweaking to be done, e.g., with datBounds, refont, if you want best character spacing and presentation.
Also, TDM treats codepoint 0xFF specially, as mentioned in https://wiki.thedarkmod.com/index.php?title=I18N_-_Charset

 

Posted (edited)
44 minutes ago, Geep said:


@kalinovka, I'm assuming your TTF font codepoints are those of Unicode. A conversion to Win1251 would use this map:

 

 

Hi! Thanks for your reply. I am not a programmer at all (I graduated foreign languages faculty 20 years ago), so these things look tricky for me. Bu I will try all my best to patch the font.

It is interesting that Carleton font has been already converted to dds with all cyrillic letters. But who had done this work, I was not able to find.

I temporary changed Mason to Carleton, but I don't like the result. So I will continue my experiments.

The task of mission translation seemed simple for me, but for months later it look like a real quest.

If it happens successfully, at least it allows to update fonts in the next version of TDM..

 

One more question - may you tell me how to transform dat files to dds ?

I used the refont ulility, but it creates only a dat file. What should be done next ?

Edited by kalinovka
Posted
1 hour ago, kalinovka said:

One more question - may you tell me how to transform dat files to dds ?

I used the refont ulility, but it creates only a dat file. What should be done next ?

Yes, refont just makes it easier to make changes to a .dat file (via human-editable .ref file).

To transform your .tga's into .dds, either -

But more typically, with GIMP, all the .tga's associated with one of the three TDM-supported font sizes are read in as separate layers, to a common GIMP project file (saved as an .xcf file). Ordinarily, you set only 1 layer visible.

If you do any bitmap editing, the .xcf file becomes in effect the source master. Having all the files together as layers makes it easier to move a glyph (or copy parts of glyphs) from one layer to another.

You use GIMP's Export feature (you specify the .dds extension up the top entry part to tell it the format). Be sure to generate mipmaps.

See:

https://wiki.thedarkmod.com/index.php?title=DDS_Creation_with_GIMP

https://wiki.thedarkmod.com/index.php?title=Font_Bitmaps_in_DDS_Files
particularly "Editing a Bitmap"

Posted
1 hour ago, kalinovka said:

It is interesting that Carleton font has been already converted to dds with all cyrillic letters. But who had done this work, I was not able to find.

Evidently a significant portion of the Cyrillic work was done by Keeper_Riff (in conjunction with Tels) back in 2011. These folks are not active in TDM these days.

Keeper_Riff outlined a workflow, starting with FontLab to edit TTF files...
https://forums.thedarkmod.com/index.php?/topic/12863-translating-the-tdm-gui/page/12/#findComment-271548

Specifically Carleton:
https://forums.thedarkmod.com/index.php?/topic/12863-translating-the-tdm-gui/page/4/#findComment-262135

Posted

Regarding the existing Russian version of TDM's MasonAlternative font, this had a different origin than those Russian fonts processed by Riff_Keeper.

Tels created this in 2012. He started from bitmaps of an ASCII Mason font, then used his Perl patch program to copy selected ASCII glyphs (that resemble in some way Cyrillic) to new font "MasonAlternative". See https://forums.thedarkmod.com/index.php?/topic/12863-translating-the-tdm-gui/page/15/#findComment-274617

In GIMP, he flipped or otherwise hand-edited to make them Cyrillic. He said, "There are still a few dozen missing, but this is enough to render the two headlines we have (New Mission and Setting)"
https://forums.thedarkmod.com/index.php?/topic/12863-translating-the-tdm-gui/page/15/#findComment-274623

This accounts for the incomplete coverage.

Speculatively, he took this approach because it couldn't find a Mason-style TTF font with both Russian characters and an acceptable license (e.g., public domain, or at the least freely redistributable for non-commercial use).

@kalinovka,I wonder what the licensing is for your masonchronicles3.ttf.

Posted (edited)

@Geep  ,

thanks for your answers.

 

Today I spent 3 or 4 hours trying to edit ttf. i used Font Lab 8 for it.

I opened the font file (it was in utf encoding). Then I tried to recode it into cp-1251 and failed.

masonchronicles3.ttf has an unknown license status, of course. But if my attempts lead to good results, I can draw letters in ttf by myself.

 

1 hour ago, Geep said:

Tels created this in 2012. He started from bitmaps of an ASCII Mason font, then used his Perl patch program to copy selected ASCII glyphs (that resemble in some way Cyrillic) to new font "MasonAlternative". See https://forums.thedarkmod.com/index.php?/topic/12863-translating-the-tdm-gui/page/15/#findComment-274617

Tels' unfinished files - are they still available ? Can I continue his work from where he stopped it ? That DDSes made by him are available in the TDM folders, but I have not found sources with .tda or ttf.

 

And I still can't understand how to convert DAT into TGA or DDS.

 

 

Edited by kalinovka
Posted
23 hours ago, kalinovka said:

Today I spent 3 or 4 hours trying to edit ttf. i used Font Lab 8 for it.

I opened the font file (it was in utf encoding). Then I tried to recode it into cp-1251 and failed.

masonchronicles3.ttf has an unknown license status, of course. But if my attempts lead to good results, I can draw letters in ttf by myself.

I haven't used Font Lab, but perhaps there's an online user community that can help.

Drawing font glyphs is challenging but yes possible.

23 hours ago, kalinovka said:

Tels' unfinished files - are they still available ? Can I continue his work from where he stopped it ? That DDSes made by him are available in the TDM folders, but I have not found sources with .tda or ttf.

 

And I still can't understand how to convert DAT into TGA or DDS.

I can help you with Mason files, but I need to find the right version... I'll get back to you.

As for DAT, think of it this way: a TDM file is described by BOTH DAT and TGA/DDS. DAT has the metadata needed for character spacing and scaling. TGA/DDS has the glyph images.

See https://wiki.thedarkmod.com/index.php?title=Font_Metrics_%26_DAT_File_Format

Posted

Just to complicate your life, there are 3 additional aspects to consider about the circa-2014 Mason files, and subsequent circa-2017 improvements to the 'english' version perhaps applicable to your work. (These issues are covered in the wiki "Mason Font" article, with a bit more in my "Analysis of 2.12 TDM Fonts", https://forums.thedarkmod.com/index.php?/topic/22427-analysis-of-212-tdm-fonts/. The 2017 changes can be seen in the *current* 2.13 TDM English Mason files.)


1) Need for custom DAT-scaling on certain Mason characters
The source TTF had upper-case and lower-case characters that were early-on considered too similar to size. So (before 2014) in the DAT, selective per-character scaling was used to differentiate them.  See https://wiki.thedarkmod.com/index.php?title=Font_Metrics_%26_DAT_File_Format#Per-Character_Font_Scaling for details.

As you add new characters, you should do likewise (relatively easy with refont).

2) Creating the "glow" of mason_glow

How Tels created the glow (for 'english' carleton & mason) is discussed in reasonable detail here:

https://forums.thedarkmod.com/index.php?/topic/12863-translating-the-tdm-gui/page/5/#findComment-262661

That could be done for Russian too, which I recall currently fakes a glow, and possibly would require a minor GUI or engine code change to use.

Note: To best accommodate glow and retain GIMP-visualization-alignment between base and glow characters, Tels moved some base characters within their bitmap, to keep their glyphs 2-3 pixels away from any bitmap edge. You should consider this when placing new base glyphs.

Note: For the 3 mason bitmaps doubled in size circa-2017 as discussed next, the mason_glow bitmaps were also doubled.

3) Extensive bitmap editing to solve main menu character jaggedness.

On Oct. 5, 2017, @Springheel in https://forums.thedarkmod.com/index.php?/topic/19129-menu-update/#findComment-412921 said:

"Looking at the Mason fonts, it looks like they were super low res to begin with, and were then just resized [presumably referring to per-character scaling], making them even worse. I'll see what I can do." [Further on, referring to fonts in the TDM menu system:] "It appears that resizing the dds file to make it higher res is possible, so I'll proceed."

Later, on Oct 13, 2017, he concluded within a "More detailed list of changes: "Updated the menu fonts, which were surprisingly bad before"

Unfortunately, I couldn't find details on how this work was actually done. I assume the bitmap editing was all done in GIMP. It started with doubling the size of certain bitmaps from 256x256 to 512x512. This was done for the first 3 bitmaps (i.e., those with ASCII, some Latin-1). Then characters were made more crisp and smooth-edged. How? Dunno. Also, some odd but harmless artifacts happened within GIMP (noted in https://forums.thedarkmod.com/index.php?/topic/22427-analysis-of-212-tdm-fonts/page/3/#findComment-499660)

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recent Status Updates

    • datiswous

      I posted about it before, but I think the default tdm logo video looks outdated. For a (i.m.o.) better looking version, you can download the pk4 attached to this post and plonk it in your tdm root folder. Every mission that starts with the tdm logo then starts with the better looking one. Try for example mission COS1 Pearls and Swine.
      tdm_logo_video.pk4
      · 2 replies
    • JackFarmer

      Kill the bots! (see the "Who is online" bar)
      · 0 replies
    • STiFU

      I finished DOOM - The Dark Ages the other day. It is a decent shooter, but not as great as its predecessors, especially because of the soundtrack.
      · 5 replies
    • JackFarmer

      What do you know about a 40 degree day?
      @demagogue
      · 4 replies
    • jivo

      I just uploaded a new version of the Visible Player Hands mod. It's been updated for TDM 2.13 and has new animations. Check out the post if you're interested!
      · 0 replies
×
×
  • Create New...