Those itp files are actually DDS files swizzled and compressed.
I still need some time to write a program to extract it.
itf files should be easier, most of glyphs are in 8-bit greyscale bitmaps.
The following code snippet shows how to decompress the data part of itp files.
I'll write a complete executable when possible and put it here.
Code:
def decompress(filedata):
width, height = struct.unpack('<II', filedata[0x10:0x18])
print(width, height)
if filedata[0x50:0x54] != b'IDAT':
raise Exception('error format')
offset = 0x74
bitmap = bytearray()
next_chunk_offset = offset + 8 + struct.unpack('<I', filedata[offset:offset+4])[0]
offset += 0xc
while True:
count += 1
arg1 = filedata[offset]
arg2 = filedata[offset+1]
offset += 2
if arg1 == 0:
bitmap += filedata[offset:offset+arg2]
offset += arg2
else:
start = -arg2 - 1 + len(bitmap)
for i in range(arg1):
bitmap += bitmap[start + i].to_bytes(1, byteorder='little')
offset += 1
bitmap += filedata[offset].to_bytes(1, byteorder='little')
if offset >= next_chunk_offset:
if filedata[offset:offset+4] == b'IEND':
break
offset = next_chunk_offset
next_chunk_offset = offset + 8 + struct.unpack('<I', filedata[offset:offset+4])[0]
print(format(next_chunk_offset, 'x'), format(struct.unpack('<I', filedata[offset:offset+4])[0], 'x'))
offset += 0xc
bitmap = unswizzle(bitmap)