]> git.tdb.fi Git - libs/gl.git/commitdiff
Add a size parameter to makefont.py
authorMikko Rasa <tdb@tdb.fi>
Sat, 4 Jul 2009 11:32:17 +0000 (11:32 +0000)
committerMikko Rasa <tdb@tdb.fi>
Sat, 4 Jul 2009 11:32:17 +0000 (11:32 +0000)
makefont.py

index ac816633bca2fc6e6efed5c372fa8a4a813665c9..c61c1d5ad7fd9573f0ae5d53e30e06d06a59257c 100755 (executable)
@@ -23,11 +23,11 @@ def convert_def(fn):
 
        return result
 
-def make_font(fn):
+def make_font(fn, size):
        import maketex
        import os
 
-       if os.system("ttf2png \"%s\" -o makefont-tmp.png -d makefont-tmp.def -t -p"%sys.argv[1]):
+       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_inline\n{\n"
@@ -43,8 +43,9 @@ def make_font(fn):
 if __name__=="__main__":
        import sys
 
-       if len(sys.argv)<3:
-               print "Usage: %s <font.ttf> <outfile>"
+       if len(sys.argv)<4:
+               import os
+               print "Usage: %s <font.ttf> <outfile> <size>"%os.path.basename(sys.argv[0])
        else:
                out=file(sys.argv[2], "w")
-               out.write(make_font(sys.argv[1]))
+               out.write(make_font(sys.argv[1], int(sys.argv[3])))