From add45b494a6a99cdc9084f6b0ef8dafa66b20a8c Mon Sep 17 00:00:00 2001 From: hugovk Date: Mon, 7 Jul 2014 22:31:20 +0300 Subject: [PATCH] Extract __main__ section of PIL/ImageFont.py into Scripts/createfontdatachunk.py --- PIL/ImageFont.py | 13 +------------ Scripts/createfontdatachunk.py | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 12 deletions(-) create mode 100644 Scripts/createfontdatachunk.py diff --git a/PIL/ImageFont.py b/PIL/ImageFont.py index 25993007d..036a42eb9 100644 --- a/PIL/ImageFont.py +++ b/PIL/ImageFont.py @@ -403,15 +403,4 @@ w7IkEbzhVQAAAABJRU5ErkJggg== ''')))) return f - -if __name__ == "__main__": - # create font data chunk for embedding - import base64 - font = "Tests/images/courB08" - print(" f._load_pilfont_data(") - print(" # %s" % os.path.basename(font)) - print(" BytesIO(base64.decodestring(b'''") - base64.encode(open(font + ".pil", "rb"), sys.stdout) - print("''')), Image.open(BytesIO(base64.decodestring(b'''") - base64.encode(open(font + ".pbm", "rb"), sys.stdout) - print("'''))))") +# End of file diff --git a/Scripts/createfontdatachunk.py b/Scripts/createfontdatachunk.py new file mode 100644 index 000000000..0c860701a --- /dev/null +++ b/Scripts/createfontdatachunk.py @@ -0,0 +1,16 @@ +import base64 +import os +import sys + +if __name__ == "__main__": + # create font data chunk for embedding + font = "Tests/images/courB08" + print(" f._load_pilfont_data(") + print(" # %s" % os.path.basename(font)) + print(" BytesIO(base64.decodestring(b'''") + base64.encode(open(font + ".pil", "rb"), sys.stdout) + print("''')), Image.open(BytesIO(base64.decodestring(b'''") + base64.encode(open(font + ".pbm", "rb"), sys.stdout) + print("'''))))") + +# End of file