zine_maker/colophon.py
2021-12-10 01:24:22 +02:00

43 lines
1,004 B
Python

import sys
import random
from zine_maker import Zine
def make_colophon():
# Variables
text_font_size = 12
# set font for all text
zine = Zine(orientation="P", unit="mm", format="A5")
# cover font
zine.add_font(
'CasaleNBP', '', r"fonts/CasaletwoNbp-Bp4V.ttf", uni=True)
cover_font = 'CasaleNBP'
# text font
zine.add_font(
'Kpalter', '',
r"fonts/KpProgrammerAlternatesNbp-Zg1q.ttf", uni=True)
text_font = 'Kpalter'
zine.set_font(text_font, '', size=text_font_size)
# you can change the font to text_font
# or add your fonts
zine.colophon(inputfile, cover_font)
zine.output(output)
if __name__ == '__main__':
# input text and output pdf
if len(sys.argv) > 1:
if len(sys.argv) == 3:
output = sys.argv[2]
inputfile = sys.argv[1]
else:
inputfile = "./text/colophon.txt"
output = "./colophones/colophon{}.pdf".format(random.randint(1, 40))
make_colophon()