Font TBL file

This is the place to discuss all issues relating to the manipulation of graphics/animations, sounds, music and cinematics within Diablo 2.

Moderators: Necrolis, Nefarius

User avatar
Havvoric
Moderator
Champion of the Light
Posts: 392
Joined: Mon Apr 12, 2004 1:12 am
Location: Newcastle upon Tyne
Great Britain

Font TBL file

Post by Havvoric » Wed Dec 20, 2006 12:49 am

Hi. I've been looking into custom Fonts recently.

I can get the character glyphs converted properly to dc6.

However, I need a tbl file for it (at the moment, the characters have the wrong dimensions).

I have looked at the contents of the font tbl files (in local\font\latin\), and they seem to be binary files, starting with "Woo!" - does anyone know the format of these files?

User avatar
Joel
Moderator
Dominion
Posts: 6921
Joined: Mon May 27, 2002 7:19 am
Location: Orsay

Hand-picked

Post by Joel » Thu Dec 21, 2006 8:58 am

the font tbl are unused and , IIRC, there is a another file next to them
that contains txt information about character size and kerning.
"How much suffering, mortal, does it take before you lose your grace?"
Shadow Empire (coming soon) | forum

User avatar
Havvoric
Moderator
Champion of the Light
Posts: 392
Joined: Mon Apr 12, 2004 1:12 am
Location: Newcastle upon Tyne
Great Britain

Post by Havvoric » Thu Dec 21, 2006 1:46 pm

Hmmm, that doesn't match with what I see!

If I change the filename loaded, the game aborts when it tries to use the font, with a 'Cannot find file: data\local\font\latin\xxxxxxxx.tbl'

I've not checked whether it's actually used after loading, but it's definitely loaded.

User avatar
Nefarius
Retired Admin
Cherub
Posts: 11607
Joined: Sat Jun 15, 2002 8:13 pm
Location: Where the blood forever rains

Hand-picked

Re: Font TBL file

Post by Nefarius » Fri Dec 22, 2006 12:53 am

You can tap into the location it crashes at and see how it decyphers the files.
''(...) The game can basically be considered unhackable. '' - Blizzard Entertainment (30th May 2000)
Black Omen Productions | MetalStorm: Progress Report | Screenshots

User avatar
Havvoric
Moderator
Champion of the Light
Posts: 392
Joined: Mon Apr 12, 2004 1:12 am
Location: Newcastle upon Tyne
Great Britain

Post by Havvoric » Fri Dec 22, 2006 1:04 am

I know. Was just wondering if anyone had done this before. No point in duplicating effort!
I will be off the net until early January. Will post my findings when I get back.

[EDIT]
From my investigation, this file appears to be made up of two parts

The Header
12 Bytes in length.
First four = "Woo!"
Next six = 01 00 00 00 00 01
Next one = Expected Height of character cell
Next one = Expected Width of character cell

The Character
There are 256 of these - one per 8-bit character
14 bytes in length.
Byte 1 = character code
Byte 2 = 00
Byte 3 = 00
Byte 4 = Character cell width
Byte 5 = Character cell height
Byte 6 = 01
Byte 7 = 00
Byte 8 = 00
Byte 9 = character code
Bytes 10-14 = 00
Last edited by Havvoric on Sun Feb 25, 2007 8:37 am, edited 2 times in total.

User avatar
Armagniac
Posts: 3
Joined: Fri Aug 08, 2008 3:30 pm

Re: Font TBL file

Post by Armagniac » Fri Aug 08, 2008 10:00 pm

Bytes 1 & 2 are actually word with Unicode character value; byte 9 is ANSI code.

User avatar
HerioMortis
Posts: 4
Joined: Mon Aug 11, 2008 7:13 pm

Re: Font TBL file

Post by HerioMortis » Thu Aug 14, 2008 11:01 pm

In case nobody else has managed it so far, I've created a new font16 using some hacky python scripts.

I have it all code and generated files hosted on my website.

I used the python imaging library to generate a pcx file that dc6font would be happy about, the script also creates the kerning .tbl file needed.

I use a bitmap font from the Xorg project as I've had no luck yet with truetype fonts. It messes up in the antialiasing so it looks really horrible.
Think I have to load the diablo palette into the image before rendering the text, that is what I am working on right now.

(Oh, and first post from me!)

User avatar
Necrolis
Senior Admin
Throne
Posts: 9125
Joined: Sat Mar 25, 2006 1:22 pm
Location: The Land of the Dead
South Africa

Hand-picked

Post by Necrolis » Fri Aug 15, 2008 9:14 am

Its probably easier to use sdls truetype lib for the images(i have some code sitting around that would work perfectly for this, and the dc6 conv code, could throw this together if any one needs it[just shortens the process])
Image
Netiquette, Do you USE it?!?! | Nefarius' Fixed TXT Files | Terms Of Service
Blackened | Day of Death | D2GFEx
"What was yours is mine. Your land, your people, and now your life." - Lim-Dul, the Necromancer
Judgement is Final, Death is Eternal

User avatar
HerioMortis
Posts: 4
Joined: Mon Aug 11, 2008 7:13 pm

Re: Font TBL file

Post by HerioMortis » Mon Dec 21, 2009 12:42 am

Necroing this thread as I notice I forgot to put a link in my post.

My font rendering tool is at http://ogun.org/diablo2/
Simple but works, I never got antialiased fonts to work well, hence the usage of a X font.
Rather hardcoded python, but commented as to what is going on.

Screenshot:
Image
My small diablo font hacks: http://ogun.org/diablo2/

kambala
Dark Alliance Beta Test
Crusader
Posts: 77
Joined: Wed Nov 25, 2009 4:32 pm
Location: Moscow
Russia

Re: Font TBL file

Post by kambala » Sat Jan 02, 2010 5:07 pm

HerioMortis, font8.dc6 (and possibly tbl) from your site seems to be broken (something with the height of characters)
cross-platform tools: K.A.M.B.A.L.A.: Kinetic Artificial Machine Built for Assassination and Logical Analysis

CoRRuPTeD
Posts: 35
Joined: Tue Dec 10, 2002 11:14 pm
Location: Denmark

Re: Font TBL file

Post by CoRRuPTeD » Sun Jan 10, 2010 2:53 pm

Hey,

Is there an easy way to get the font that is used in the polish version of Diablo 2? Or are you stuck with the language as well then?

Example: Image

User avatar
HerioMortis
Posts: 4
Joined: Mon Aug 11, 2008 7:13 pm

Re: Font TBL file

Post by HerioMortis » Wed Jan 13, 2010 5:01 pm

Polish fonts would be stored in the polish mpq:s. I do not have any of those so I cannot verify.
Presumably I should work in the same way.
My small diablo font hacks: http://ogun.org/diablo2/

kambala
Dark Alliance Beta Test
Crusader
Posts: 77
Joined: Wed Nov 25, 2009 4:32 pm
Location: Moscow
Russia

Re:

Post by kambala » Thu Jan 14, 2010 7:26 pm

Havvoric" wrote:The Header
12 Bytes in length.
First four = "Woo!"
Next six = 01 00 00 00 00 01
in RUS font the number in bold is 05. can it mean the ISO 8859-x table? (8859-1 is basic latin, 8859-5 is cyrillic)
cross-platform tools: K.A.M.B.A.L.A.: Kinetic Artificial Machine Built for Assassination and Logical Analysis

User avatar
HerioMortis
Posts: 4
Joined: Mon Aug 11, 2008 7:13 pm

Re: Re:

Post by HerioMortis » Fri Jan 15, 2010 1:41 pm

kambala" wrote: in RUS font the number in bold is 05. can it mean the ISO 8859-x table? (8859-1 is basic latin, 8859-5 is cyrillic)
Sounds reasonable, seeing as 5 is the latin/cyrillic table of 8859.

I've updated the code so it can now deal with antialiased fonts, currently playing the game using verdana bold :)
Still have some issues with the kerning, but working on it.
My small diablo font hacks: http://ogun.org/diablo2/

kambala
Dark Alliance Beta Test
Crusader
Posts: 77
Joined: Wed Nov 25, 2009 4:32 pm
Location: Moscow
Russia

Re: Font TBL file

Post by kambala » Fri Jan 15, 2010 3:20 pm

currently I'm looking into chinese font16.tbl, and the last 4 bytes of header are

Code: Select all

EE 35 0D 01
which doesn't make a lot of sense...

and the character structure is also other. here's a sample chinese symbol U+5377:

Code: Select all

77 53 00 0D 0D 01 00 00 8D 05 00 00 00 00
Last edited by kambala on Fri Jan 15, 2010 4:55 pm, edited 1 time in total.
cross-platform tools: K.A.M.B.A.L.A.: Kinetic Artificial Machine Built for Assassination and Logical Analysis

User avatar
Necrolis
Senior Admin
Throne
Posts: 9125
Joined: Sat Mar 25, 2006 1:22 pm
Location: The Land of the Dead
South Africa

Hand-picked

Re: Font TBL file

Post by Necrolis » Fri Jan 15, 2010 4:49 pm

you won't get too far just looking at the headers of files, you need to check the code that reads it, cause, for instance, the last for bytes could be read as a DWORD, making it 0x010D35EE or 2 WORDs, making it 0x35EE and 0x010D etc. also just a note here, most the games pixel length funcs use ave width and height, and not the length and height of each char
Image
Netiquette, Do you USE it?!?! | Nefarius' Fixed TXT Files | Terms Of Service
Blackened | Day of Death | D2GFEx
"What was yours is mine. Your land, your people, and now your life." - Lim-Dul, the Necromancer
Judgement is Final, Death is Eternal

User avatar
Demon9ne
Dark Alliance Beta Test
Champion of the Light
Posts: 385
Joined: Mon Dec 20, 2004 6:01 am
Location: IL, USA

Re: Font TBL file

Post by Demon9ne » Mon Jun 04, 2012 3:32 pm

Apologies for resurrecting this old topic, but I wanted to correct some info...

In the 12-byte header of a font tbl file, byte 11 is actually the leading and byte 12 is the cap height in pixels.

User avatar
Necrolis
Senior Admin
Throne
Posts: 9125
Joined: Sat Mar 25, 2006 1:22 pm
Location: The Land of the Dead
South Africa

Hand-picked

Re: Font TBL file

Post by Necrolis » Thu Feb 18, 2021 10:48 pm

Demon9ne" wrote:Apologies for resurrecting this old topic, but I wanted to correct some info...

In the 12-byte header of a font tbl file, byte 11 is actually the leading and byte 12 is the cap height in pixels.

Code: Select all

struct D2CharStrc		//sizeof 0x0E
{
	WORD wChar;		//+00
	BYTE nUnk;		//+02	
	BYTE nWidth;		//+03
	BYTE nHeight;		//+04
	bool bTrue;		//+05
	WORD wUnkEx;		//+06
	WORD wImageIndex;	//+08
	DWORD dwUnk;		//+0A		
};

struct D2FontStrc		//sizeof 0x108 ? sizeof 0xE0B
{
	DWORD dwHeader;		//+00 - 'Woo!'
	WORD wOne;		//+04
	int nLocale;		//+06
	BYTE nLineHeight;		//+0A
	BYTE nUnk;		//+0B
	D2CharStrc pChars[0]; //+0C - variable amoutn  based on the langauge
};

struct D2FontCache		//sizeof 0x14
{
	D2CellFileStrc* pImage;		//+00
	D2FontStrc* pFontInfo[2];	//+04
	D2CharStrc* pCharInfo;		//+0C
	DWORD dwTick;			//+10
};
bit old, but may be helpful none the less

Feb 2021: Some small changes since there where some big errors that affected a few people
Image
Netiquette, Do you USE it?!?! | Nefarius' Fixed TXT Files | Terms Of Service
Blackened | Day of Death | D2GFEx
"What was yours is mine. Your land, your people, and now your life." - Lim-Dul, the Necromancer
Judgement is Final, Death is Eternal

Return to “Multimedia”