55 lines
1.4 KiB
Python
55 lines
1.4 KiB
Python
import sys
|
|
from zine_maker import Zine
|
|
|
|
|
|
def make(inputfile, output):
|
|
# Variables
|
|
text_font_size = 10
|
|
|
|
top_margin = 20
|
|
left_margin = 20
|
|
right_margin = 20
|
|
left_max_margin = 160
|
|
|
|
max_height = 190
|
|
cell_width = 110
|
|
cell_header_height = 22
|
|
cell_height = 8
|
|
|
|
# set font for all text
|
|
zine = Zine(orientation="P", unit="mm", format="A5")
|
|
|
|
# text font
|
|
zine.add_font(
|
|
'Kpalter', '',
|
|
r"fonts/KpProgrammerAlternatesNbp-Zg1q.ttf", uni=True
|
|
)
|
|
zine.add_font('CasaleNBP', '', r"./fonts/CasaletwoNbp-Bp4V.ttf", uni=True)
|
|
header_font = 'CasaleNBP'
|
|
#header_font = 'Kpalter'
|
|
text_font = 'helvetica'
|
|
zine.set_font(text_font, '', size=text_font_size)
|
|
|
|
zine.create_pages(inputfile, max_height, left_margin,
|
|
left_max_margin, top_margin, right_margin,
|
|
cell_width, cell_height, cell_header_height,
|
|
header_font, text_font, text_font_size)
|
|
|
|
zine.output(output)
|
|
print("PDF saved as {}".format(output))
|
|
|
|
|
|
if __name__ == '__main__':
|
|
# input text and output pdf
|
|
if len(sys.argv) > 1:
|
|
if len(sys.argv) == 2:
|
|
output = "./body/readme.pdf"
|
|
if len(sys.argv) == 3:
|
|
output = sys.argv[2]
|
|
inputfile = sys.argv[1]
|
|
else:
|
|
inputfile = "./text/readme"
|
|
output = "./body/readme.pdf"
|
|
|
|
make(inputfile, output)
|