Update readme

This commit is contained in:
Mara Karagianni 2021-12-30 16:58:54 +02:00
parent d4f6ffbfcb
commit 77d600982b
6 changed files with 23 additions and 16 deletions

View file

@ -1,6 +1,6 @@
# Introduction
This zine helps in navigating the zine_maker code, a small software tool derived from pyPDF library. The code is written in Python, and provides a few scripts for creating covers, colophons, content, and also signatures for preparing a PDF for the printer. The scripts run with python version 3.x.x and we can feed to the scripts inputs and outputs. As an input, we give the path to a text file, which shall create the text and images content of the zine, and as an output we give a the path/filename of our choice. We can also run the scripts with no input nor output, in which case, they take as default parameters the readme text from the text/ folder and produce an output to either of the folders covers, colophons, body, or zines, depending on which script we are running each time.
This tutorial helps in navigating the zine_maker code, a small software tool derived from pyPDF library. The code is written in Python, and provides a few scripts for creating covers, colophons, content, and also signatures for preparing a PDF for the printer. The scripts run with python version 3.x.x and we can feed to the scripts inputs and outputs. As an input, we give the path to a text file, which shall create the text and images content of the zine, and as an output we give a the path/filename of our choice. We can also run the scripts with no input nor output, in which case, they take as default parameters the readme text from the text/ folder and produce an output to either of the folders covers, colophons, body, or zines, depending on which script we are running each time.
# Get the code

Binary file not shown.

Binary file not shown.

View file

@ -13,7 +13,7 @@ def make(inputfile, output):
max_height = 190
cell_width = 110
cell_header_height = 26
cell_header_height = 22
cell_height = 8
# set font for all text

View file

@ -28,6 +28,7 @@ def shuffle_zine(finput, foutput):
else:
print("PDF saved as {}".format(foutput))
os.system("mv ./*_chapter.pdf ./.tmp")
os.system("rm ./.tmp/*_chapter.pdf")
if __name__ == '__main__':

View file

@ -121,7 +121,9 @@ class Zine(FPDF):
# check if we have a title
elif line.startswith("<h2>"):
line = re.sub('((<h2>)|(</h2>$))', '', line)
self.set_text_color(130, 50, 250)
purple_shades = random.randrange(100, 180, 20)
#self.set_text_color(130, 50, 250)
self.set_text_color(purple_shades, 0, 200)
self.set_font(header_font, size=22)
if self.get_y() > top_margin:
self.set_xy(left_margin, top_margin+9)
@ -130,9 +132,9 @@ class Zine(FPDF):
0, ln=1, align='C')
left_x = self.get_x()
top_y = self.get_y()
self.dashed_line(
left_x, top_y, left_x+cell_width, top_y,
dash_length=3, space_length=3)
# self.dashed_line(
# left_x, top_y, left_x+cell_width, top_y,
# dash_length=3, space_length=3)
self.set_text_color(0, 0, 0)
self.set_font(text_font, size=text_font_size)
@ -145,8 +147,10 @@ class Zine(FPDF):
elif line.startswith("<b>"):
line = re.sub('((<b>)|(</b>$))', '', line)
self.set_font('helvetica', 'B', size=13)
self.cell(cell_width, cell_height, line,
font_size = 14
self.set_font(header_font, '', font_size)
bold_header_height = font_size
self.cell(cell_width, bold_header_height, line,
0, ln=1, align='C')
self.set_font(text_font, '', size=text_font_size)
@ -155,9 +159,10 @@ class Zine(FPDF):
self.set_xy(left_margin, top_margin+9)
self.add_page()
self.set_font(header_font, size=25)
self.set_text_color(255, 0, 0)
self.multi_cell(cell_width, cell_height, line,
0, align='L')
pink_shades = random.randrange(60, 150, 20)
self.set_text_color(255, pink_shades, pink_shades)
self.cell(cell_width, cell_header_height, line,
0, ln=1, align='L')
# go back to text font
self.set_text_color(0, 0, 0)
self.set_font(text_font, '', size=text_font_size)
@ -165,12 +170,13 @@ class Zine(FPDF):
elif line.startswith("##"):
line = re.sub('()', '', line)
subheader_font = "helvetica"
cell_subheader_height = 10
#gray_shades = random.randrange(0, 256, 60)
self.set_font(subheader_font, size=18)
self.set_text_color(0, 0, 0)
self.multi_cell(cell_width, cell_height, line,
self.multi_cell(cell_width, cell_subheader_height, line,
0, align='L')
# go back to text font
self.set_text_color(0, 0, 0)
self.set_font(text_font, '', size=text_font_size)
elif line.startswith("`") or line.startswith("```"):
@ -199,7 +205,7 @@ class Zine(FPDF):
elif line.startswith("<quote>"):
line = re.sub('(<quote>$)', '', line)
self.set_font(text_font, '', size=13)
self.set_text_color(0, 80, 115)
self.set_text_color(150, 0, 205)
self.multi_cell(cell_width, cell_height, line,
0, align='C')
elif line.startswith("</quote>"):
@ -275,7 +281,7 @@ class Zine(FPDF):
# close the file
title.close()
self.set_text_color(0, 0, 0, 0)
self.set_text_color(0, 0, 0)
def colophon(self, text, colophon_font):
f = open(text, 'r')
@ -296,7 +302,7 @@ class Zine(FPDF):
text_font = 'Helvetica'
# Go to 1.5 cm from bottom
self.set_y(-12)
# self.set_text_color(0, 0, 0)
self.set_text_color(0, 0, 0)
self.set_font(text_font, '', size=7)
# Print current page number
# self.cell(0, 7, '%s' % self.page_no(), 0, 0, 'C')