In the source for @smealum's HB menu, there's a Python script called font.py. This seems to take a font in .fnt format, which specifies the parameters of each character and their coordinates within an accompanying .png file containing the actual characters.
I'm trying to use this script to create new fonts for the launcher. To make sure it's working I'm using the original font which comes in .fnt in the HB Menu source archive. I'm getting an error I don't understand in the scrips and I'm hoping someone who is familiar with Python can help. Here's the error:
'str' object has no attribute 'getpixel'
It occurs on the line shown in bold.
Thanks in advance guys.
Edit - the bold line doesn't show up in the code block. The error occurs on the line starting data.extend.
I'm trying to use this script to create new fonts for the launcher. To make sure it's working I'm using the original font which comes in .fnt in the HB Menu source archive. I'm getting an error I don't understand in the scrips and I'm hoping someone who is familiar with Python can help. Here's the error:
'str' object has no attribute 'getpixel'
It occurs on the line shown in bold.
Code:
def outputChar(p, c):
global fontData, fontDesc, fontName
im = p[c["page"]][0]
x, y = int(c["x"]), int(c["y"])
w, h = int(c["width"]), int(c["height"])
xo, yo = int(c["xoffset"]), int(c["yoffset"])
id, xa = int(c["id"]), int(c["xadvance"])
if id<164:
c = chr(id)
c = c if c!="'" else "\\'"
c = c if c!="\\" else "\\\\"
c = "\'"+c+"\'"
else:
c = str(id)
data = []
for i in range(w):
data.extend([im.getpixel((x+i,y+h-1-j)) for j in range(h)])
fontDesc[id] = (" (charDesc_s){%s, %d, %d, %d, %d, %d, %d, %d, &%sData[%d]},"%(c,x,y,w,h,xo,yo,xa,fontName,len(fontData)))
fontData.extend(data)
Thanks in advance guys.
Edit - the bold line doesn't show up in the code block. The error occurs on the line starting data.extend.
Last edited by mashers,