File: createfontdatachunk.py

package info (click to toggle)
pillow 12.1.0-1
  • links: PTS
  • area: main
  • in suites: sid
  • size: 72,560 kB
  • sloc: python: 49,748; ansic: 38,748; makefile: 302; sh: 168; javascript: 85
file content (17 lines) | stat: -rw-r--r-- 582 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
from __future__ import annotations

import base64
import os

if __name__ == "__main__":
    # create font data chunk for embedding
    font = "Tests/images/courB08"
    print("    f._load_pilfont_data(")
    print(f"         # {os.path.basename(font)}")
    print("         BytesIO(base64.decodestring(b'''")
    with open(font + ".pil", "rb") as fp:
        print(base64.b64encode(fp.read()).decode())
    print("''')), Image.open(BytesIO(base64.decodestring(b'''")
    with open(font + ".pbm", "rb") as fp:
        print(base64.b64encode(fp.read()).decode())
    print("'''))))")