diff options
author | couriersud <couriersud@arcor.de> | 2015-01-22 20:48:48 +0100 |
---|---|---|
committer | couriersud <couriersud@arcor.de> | 2015-01-22 20:48:48 +0100 |
commit | 974bf6697e3a9d54b5838a9f87d78b3fb9e74015 (patch) | |
tree | 816500e098a4ad9a86ee4d8391e8ea076106c9d5 | |
parent | 04e88850a9d9a7a834b26c0a8ac4fa2b15549703 (diff) |
png2bdc.py: Converted to python 2.5 syntax. (nw)
-rw-r--r-- | src/build/png2bdc.py | 38 |
1 files changed, 21 insertions, 17 deletions
diff --git a/src/build/png2bdc.py b/src/build/png2bdc.py index 7d4d7df5d3e..03172654b25 100644 --- a/src/build/png2bdc.py +++ b/src/build/png2bdc.py @@ -116,27 +116,29 @@ def renderFontSaveCached(font, filename, hash32): CACHED_CHAR_SIZE = 12 CACHED_HEADER_SIZE = 16 - try: + #try: + if 0 == 0: fp.write('f') fp.write('o') fp.write('n') fp.write('t') - fp.write(bytearray([hash32 >> 24 & 0xff])) - fp.write(bytearray([hash32 >> 16 & 0xff])) - fp.write(bytearray([hash32 >> 8 & 0xff])) - fp.write(bytearray([hash32 >> 0 & 0xff])) - fp.write(bytearray([font.height >> 8 & 0xff])) - fp.write(bytearray([font.height >> 0 & 0xff])) - fp.write(bytearray([font.yOffs >> 8 & 0xff])) - fp.write(bytearray([font.yOffs >> 0 & 0xff])) - fp.write(bytearray([numChars >> 24 & 0xff])) - fp.write(bytearray([numChars >> 16 & 0xff])) - fp.write(bytearray([numChars >> 8 & 0xff])) - fp.write(bytearray([numChars >> 0 & 0xff])) + fp.write(chr(hash32 >> 24 & 0xff)) + fp.write(chr(hash32 >> 16 & 0xff)) + fp.write(chr(hash32 >> 8 & 0xff)) + fp.write(chr(hash32 >> 0 & 0xff)) + fp.write(chr(font.height >> 8 & 0xff)) + fp.write(chr(font.height >> 0 & 0xff)) + fp.write(chr(font.yOffs >> 8 & 0xff)) + fp.write(chr(font.yOffs >> 0 & 0xff)) + fp.write(chr(numChars >> 24 & 0xff)) + fp.write(chr(numChars >> 16 & 0xff)) + fp.write(chr(numChars >> 8 & 0xff)) + fp.write(chr(numChars >> 0 & 0xff)) # Write a blank table at first (?) charTable = [0]*(numChars * CACHED_CHAR_SIZE) - fp.write(bytearray(charTable)) + for i in range(numChars * CACHED_CHAR_SIZE): + fp.write(chr(charTable[i])) # Loop over all characters tableIndex = 0 @@ -171,7 +173,8 @@ def renderFontSaveCached(font, filename, hash32): dBuffer.append(accum) # Write the data - fp.write(bytearray(dBuffer)) + for j in range(len(dBuffer)): + fp.write(chr(dBuffer[j])) destIndex = tableIndex * CACHED_CHAR_SIZE charTable[destIndex + 0] = i >> 8 & 0xff @@ -190,12 +193,13 @@ def renderFontSaveCached(font, filename, hash32): # Seek back to the beginning and rewrite the table fp.seek(CACHED_HEADER_SIZE, 0) - fp.write(bytearray(charTable)) + for i in range(numChars * CACHED_CHAR_SIZE): + fp.write(chr(charTable[i])) fp.close() return 0 - except: + #except: return 1 |