Commit 77d60098 authored by Mara Karagianni's avatar Mara Karagianni
Browse files

Update readme

parent d4f6ffbf
# 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
......
No preview for this file type
......@@ -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
......
......@@ -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__':
......
......@@ -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')
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment