]> git.tdb.fi Git - libs/gl.git/blobdiff - scripts/makefont.py
For a few lingering whitespace issues
[libs/gl.git] / scripts / makefont.py
index e0b587938a5b80a85187a5e21c75a5c6f364df6e..ad12fee828405860b91159401466ffc47b48eafd 100755 (executable)
@@ -1,23 +1,23 @@
 #!/usr/bin/python
 
 def convert_def(fn):
-       src=file(fn)
+       src = file(fn)
 
-       line=src.readline()
-       tw,th,fh,fa,fd=map(int, line.split())
+       line = src.readline()
+       tw, th, fh, fa, fd = map(int, line.split())
 
-       result="native_size %d;\n"%fh
-       result+="ascent %.3f;\n"%(float(fa)/fh)
-       result+="descent %.3f;\n"%(float(fd)/fh)
+       result = "native_size %d;\n"%fh
+       result += "ascent %.3f;\n"%(float(fa)/fh)
+       result += "descent %.3f;\n"%(float(fd)/fh)
 
        for line in src.readlines():
-               g,x,y,w,h,ox,oy,a=map(int, line.split())
-               result+="glyph %d\n{\n"%g
-               result+="\ttexcoords %f %f %f %f;\n"%(float(x)/tw, float(th-y-h)/th, float(x+w)/tw, float(th-y)/th)
-               result+="\tsize %.3f %.3f;\n"%(float(w)/fh, float(h)/fh)
-               result+="\toffset %.3f %.3f;\n"%(float(ox)/fh, float(oy)/fh)
-               result+="\tadvance %.3f;\n"%(float(a)/fh)
-               result+="};\n"
+               g, x, y, w, h, ox, oy, a = map(int, line.split())
+               result += "glyph %d\n{\n"%g
+               result += "\ttexcoords %f %f %f %f;\n"%(float(x)/tw, float(th-y-h)/th, float(x+w)/tw, float(th-y)/th)
+               result += "\tsize %.3f %.3f;\n"%(float(w)/fh, float(h)/fh)
+               result += "\toffset %.3f %.3f;\n"%(float(ox)/fh, float(oy)/fh)
+               result += "\tadvance %.3f;\n"%(float(a)/fh)
+               result += "};\n"
 
        return result
 
@@ -28,11 +28,11 @@ def make_font(fn, size):
        if os.system("ttf2png \"%s\" -o makefont-tmp.png -d makefont-tmp.def -t -p -s %d"%(fn, size)):
                raise Exception("Could not execute ttf2png")
 
-       result="texture\n{\n"
-       result+="wrap CLAMP_TO_EDGE;\n"
-       result+=maketex.make_tex("makefont-tmp.png")
-       result+="};\n"
-       result+=convert_def("makefont-tmp.def")
+       result = "texture\n{\n"
+       result += "wrap CLAMP_TO_EDGE;\n"
+       result += maketex.make_tex("makefont-tmp.png")
+       result += "};\n"
+       result += convert_def("makefont-tmp.def")
 
        os.unlink("makefont-tmp.png")
        os.unlink("makefont-tmp.def")
@@ -46,5 +46,5 @@ if __name__=="__main__":
                import os
                print "Usage: %s <font.ttf> <outfile> <size>"%os.path.basename(sys.argv[0])
        else:
-               out=file(sys.argv[2], "w")
+               out = file(sys.argv[2], "w")
                out.write(make_font(sys.argv[1], int(sys.argv[3])))