이것저것

타이베리안썬 한글화는 과연 가능할 것인가?

ForceCore 2018. 11. 23. 21:27

1. 폰트 에디터가 필요하다. 그건 있다.

https://forums.cncnet.org/topic/5928-westwood-font-editor-development-thread/


2. 폰트 에디터에서 음의 글꼴폭을 허용하지를 않으니 (;;;) 헥스에딧을 통해 음수를 손으로 입력을 시켜보고, 음수가 되는 것으로 나타나면 


http://nsm53p.tistory.com/320

직결식 한글로 할 수 있다....


editfont.fnt 파일이 사이드바 아이콘으로 쓰이는 글꼴이다.


3. 포맷 정보.

Westwood font format information


FNT Header:


 00 Int16 FileSize;            // Size of the file

 02 Byte DataFormat;           // Data format for the image data: 00 for 4-bit image data, 02 for 8-bit.

 03 Byte Unknown03;            // Unknown entry (0x05 in EOB/C&C/RA1, 0x00 in TS)

 04 Int16 Unknown04;           // [Unused?] Unknown entry (always 0x000e) (font version position?)

 06 Int16 FontDataListOffset;  // Absolute offset of the start of FontDataList (Normally 0x14)

 08 Int16 WidthsListOffset;    // Absolute offset of the start of WidthsList

 0A Int16 FontDataOffset;      // [Unused?] Start of the actual font data? Should equals the first entry in FontDataList, but doesn't in TS.

 0C Int16 HeightsListOffset;   // Absolute offset of the start of HeightsList

 0E Int16 Unknown0E;           // [Unused?] Unknown entry (always 0x1011 or 0x1012; 0x0000 in TS) (font version?)

 10 Byte AlwaysZero;           // [Unused?] Align byte. Always 0x00

 11 Byte LastCharIndex;        // Last (0-based) character index. Add 1 to get the amount of characters.

 12 Byte FontHeight;           // Overall maximum font height.

 13 Byte FontWidth;            // Overall maximum font width.


@06 Int16[LastChar+1] FontDataList;  // array with the positions of all font entries

@08 Byte[LastChar+1] WidthsList;     //  array with the widths of all font entries

@0C Byte[LastChar+1][2] HeightsList; // array with the vertical offset and char height of all font entries


---


Actual font data:

At the positions indicated in the FontDataList, the actual data of the font images can be found.

Depending on the DataFormat byte, this is 4BPP or 8BPP data.


4BPP data means 2 pixels per byte, and aligned in full bytes per line, so if an entry's

width is an odd number, the last half of the last byte on the line is left unused rather

than being the first pixel of the next line.


---


FontDataList does not need a unique entry for each character. Identical characters, like the filler

characters on indices before 0x20, generally all refer to the same data block, to preserve space.


이렇다. 글꼴 폭이 array로 모여 있군. 어딨냐면. 헥스로 까봤을 때 address 0x08에 있다. 0x08에 가서 어디에 array가 있는지 숫자를 읽으니 0x1202라고 되어 있다. (16비트 숫자니까.) Endian을 주의하면서 이를 해독하면 0x0212다. 대문자 P에 해당하는 것 (P=0x50이니까 0x0212 + 0x50 = 0x262)을 보니 글꼴 폭이 6 픽셀이다. P를 고른 이유는 게임을 시작하면 NOD Power Plant 를 지어야 해서 별 다른 일을 하지 않아도 폰트가 어떻게 되는지 바로 확인 할 수 있어서.


글자 P의 Width를 5 4 3 2 1 로 조절하는건 잘 된다. 이를 6 7 8 등으로 크게 바꾸면 이상한 게 보이고, 마침내 -6이라고 (FA) int8로 변환을 시도하면 안 된다. 게임 엔진상 렌더링이 uint8형으로 되어 있기 때문이다...;; 음수의 글꼴폭은 안 되고. 그러면 음수의 x offset은 되나? 폰트 형식에 따르면 그런건 없다.

다행히 이 width를 가지고 장난쳐도 다른 글자에 탈은 없더라. QQQPQQQ 로 발전소의 이름을 뜯어고쳐보아서 확인 함. 앞의 Q는 잘 나오고, 뒤의 Q는 P가 망가져서 안 나온다.


결론: 게임 엔진을 뜯어고치지 않는 한 한글화는 없다. 아니면 한글 기울여 풀어쓰기 밖엔 답이 없다.