diff --git a/body/images.pdf b/body/images.pdf new file mode 100644 index 0000000..350dfae Binary files /dev/null and b/body/images.pdf differ diff --git a/body/oulipo.pdf b/body/oulipo.pdf new file mode 100644 index 0000000..41ab4f9 Binary files /dev/null and b/body/oulipo.pdf differ diff --git a/body/oulipo1.pdf b/body/oulipo1.pdf new file mode 100644 index 0000000..4265ecb Binary files /dev/null and b/body/oulipo1.pdf differ diff --git a/colophon.py b/colophon.py index 7f3f3ff..2333fd4 100644 --- a/colophon.py +++ b/colophon.py @@ -1,4 +1,5 @@ import sys +import random from zine_maker import Zine @@ -12,17 +13,19 @@ def make_colophon(): # cover font zine.add_font( - 'CasaleNBP', '', r"/home/mara/.fonts/CasaletwoNbp-Bp4V.ttf", uni=True) + 'CasaleNBP', '', r"fonts/CasaletwoNbp-Bp4V.ttf", uni=True) cover_font = 'CasaleNBP' # text font zine.add_font( 'Kpalter', '', - r"/home/mara/.fonts/KpProgrammerAlternatesNbp-Zg1q.ttf", uni=True) + r"fonts/KpProgrammerAlternatesNbp-Zg1q.ttf", uni=True) text_font = 'Kpalter' zine.set_font(text_font, '', size=text_font_size) - zine.colophon(inputfile) + # you can change the font to text_font + # or add your fonts + zine.colophon(inputfile, cover_font) zine.output(output) @@ -34,6 +37,6 @@ if __name__ == '__main__': inputfile = sys.argv[1] else: inputfile = "./text/colophon.txt" - output = './covers/colophon.pdf' + output = "./colophones/colophon{}.pdf".format(random.randint(1, 40)) make_colophon() diff --git a/colophones/colophon.pdf b/colophones/colophon.pdf new file mode 100644 index 0000000..4639fde Binary files /dev/null and b/colophones/colophon.pdf differ diff --git a/cover.py b/cover.py index 7dcd3f9..d2d2829 100644 --- a/cover.py +++ b/cover.py @@ -1,41 +1,26 @@ import sys +import random from zine_maker import Zine def make_cover(): # Variables - header_font = 'helvetica' - header_font_size = 14 text_font_size = 12 - top_margin = 20 - left_margin = 20 - right_margin = 20 - left_max_margin = 160 - - max_height = 190 - left_x = 20 - top_y = 30 - cell_width = 110 - cell_header_height = 16 - cell_height = 6 - # set font for all text zine = Zine(orientation="P", unit="mm", format="A5") # cover font - zine.add_font('CasaleNBP', '', r"/home/mara/.fonts/CasaletwoNbp-Bp4V.ttf", uni=True) + zine.add_font('CasaleNBP', '', r"fonts/CasaletwoNbp-Bp4V.ttf", uni=True) cover_font = 'CasaleNBP' # text font zine.add_font( - 'Kpalter', '', r"/home/mara/.fonts/KpProgrammerAlternatesNbp-Zg1q.ttf", uni=True) + 'Kpalter', '', r"fonts/KpProgrammerAlternatesNbp-Zg1q.ttf", uni=True) text_font = 'Kpalter' zine.set_font(text_font, '', size=text_font_size) - zine.cover("deconstruct mailman", cover_font, max_height=140) - # import random - # zine.output("cover{}.pdf".format(random.randint(10, 20))) + zine.cover(inputfile, cover_font, max_height=140) zine.output(output) @@ -47,6 +32,6 @@ if __name__ == '__main__': inputfile = sys.argv[1] else: inputfile = "./text/cover.txt" - output = './covers/cover.pdf' + output = "./covers/cover{}.pdf".format(random.randint(1, 40)) make_cover() diff --git a/covers/cover.pdf b/covers/cover.pdf new file mode 100644 index 0000000..4b89e4c Binary files /dev/null and b/covers/cover.pdf differ diff --git a/doc_pdf.py b/doc_pdf.py index 8dee754..cf7aedd 100644 --- a/doc_pdf.py +++ b/doc_pdf.py @@ -1,4 +1,5 @@ import sys +import random from zine_maker import Zine @@ -20,26 +21,21 @@ def make(): cell_header_height = 16 cell_height = 6 - # Image variables -# img_x = 20 -# img_y = 80 -# img_len = 120 - # set font for all text zine = Zine(orientation="P", unit="mm", format="A5") # cover font zine.add_font( - 'CasaleNBP', '', r"/home/mara/.fonts/CasaletwoNbp-Bp4V.ttf", uni=True + 'CasaleNBP', '', r"fonts/CasaletwoAlternatesNbp-RgRM.ttf", uni=True ) cover_font = 'CasaleNBP' # text font zine.add_font( 'Kpalter', '', - r"/home/mara/.fonts/KpProgrammerAlternatesNbp-Zg1q.ttf", uni=True + r"fonts/KpProgrammerAlternatesNbp-Zg1q.ttf", uni=True ) - text_font = 'Helvetica' + text_font = 'Kpalter' zine.set_font(text_font, '', size=text_font_size) zine.create_pages(inputfile, max_height, left_margin, @@ -57,7 +53,7 @@ if __name__ == '__main__': output = sys.argv[2] inputfile = sys.argv[1] else: - inputfile = "./text/notes_sample" - output = './finals/test.pdf' + inputfile = "./text/oulipo1.txt" + output = "./body/body{}.pdf".format(random.randint(1, 40)) make() diff --git a/fonts/CasaletwoAlternatesNbp-RgRM.pkl b/fonts/CasaletwoAlternatesNbp-RgRM.pkl new file mode 100644 index 0000000..698a032 Binary files /dev/null and b/fonts/CasaletwoAlternatesNbp-RgRM.pkl differ diff --git a/fonts/CasaletwoAlternatesNbp-RgRM.ttf b/fonts/CasaletwoAlternatesNbp-RgRM.ttf new file mode 100644 index 0000000..8870bce Binary files /dev/null and b/fonts/CasaletwoAlternatesNbp-RgRM.ttf differ diff --git a/fonts/CasaletwoNbp-Bp4V.pkl b/fonts/CasaletwoNbp-Bp4V.pkl new file mode 100644 index 0000000..77f7cd2 Binary files /dev/null and b/fonts/CasaletwoNbp-Bp4V.pkl differ diff --git a/fonts/CasaletwoNbp-Bp4V.ttf b/fonts/CasaletwoNbp-Bp4V.ttf new file mode 100644 index 0000000..19d419d Binary files /dev/null and b/fonts/CasaletwoNbp-Bp4V.ttf differ diff --git a/fonts/KpProgrammerAlternatesNbp-Zg1q.cw127.pkl b/fonts/KpProgrammerAlternatesNbp-Zg1q.cw127.pkl new file mode 100644 index 0000000..f1258fd Binary files /dev/null and b/fonts/KpProgrammerAlternatesNbp-Zg1q.cw127.pkl differ diff --git a/fonts/KpProgrammerAlternatesNbp-Zg1q.pkl b/fonts/KpProgrammerAlternatesNbp-Zg1q.pkl new file mode 100644 index 0000000..920eca0 Binary files /dev/null and b/fonts/KpProgrammerAlternatesNbp-Zg1q.pkl differ diff --git a/fonts/KpProgrammerAlternatesNbp-Zg1q.ttf b/fonts/KpProgrammerAlternatesNbp-Zg1q.ttf new file mode 100644 index 0000000..91f4fc6 Binary files /dev/null and b/fonts/KpProgrammerAlternatesNbp-Zg1q.ttf differ diff --git a/fonts/KpProgrammerNbp-3M3X.ttf b/fonts/KpProgrammerNbp-3M3X.ttf new file mode 100644 index 0000000..6abf28a Binary files /dev/null and b/fonts/KpProgrammerNbp-3M3X.ttf differ diff --git a/shuffle_pdf.py b/shuffle_pdf.py index f3508fa..12d13e4 100644 --- a/shuffle_pdf.py +++ b/shuffle_pdf.py @@ -253,7 +253,7 @@ class Zine(FPDF): top_margin = 20 margin = 25 self.add_font( - 'CasaleNBP', '', r"/home/mara/.fonts/CasaletwoNbp-Bp4V.ttf", + 'CasaleNBP', '', r"fonts/CasaletwoNbp-Bp4V.ttf", uni=True) self.set_margins(margin, top_margin, margin) size = 13 @@ -288,12 +288,12 @@ else: zine = Zine(orientation="P", unit="mm", format="A5") # cover font -zine.add_font('CasaleNBP', '', r"/home/mara/.fonts/CasaletwoNbp-Bp4V.ttf", uni=True) +zine.add_font('CasaleNBP', '', r"fonts/CasaletwoNbp-Bp4V.ttf", uni=True) cover_font = 'CasaleNBP' # text font zine.add_font( - 'Kpalter', '', r"/home/mara/.fonts/KpProgrammerAlternatesNbp-Zg1q.ttf", uni=True) + 'Kpalter', '', r"fonts/KpProgrammerAlternatesNbp-Zg1q.ttf", uni=True) text_font = 'Kpalter' zine.set_font(text_font, '', size=text_font_size) diff --git a/thumbs/compiler.png b/thumbs/compiler.png new file mode 100644 index 0000000..7802f84 Binary files /dev/null and b/thumbs/compiler.png differ diff --git a/thumbs/libs-black.png b/thumbs/libs-black.png new file mode 100644 index 0000000..7a7e178 Binary files /dev/null and b/thumbs/libs-black.png differ diff --git a/thumbs/libs-green.png b/thumbs/libs-green.png new file mode 100644 index 0000000..de44294 Binary files /dev/null and b/thumbs/libs-green.png differ diff --git a/thumbs/mailman-config.png b/thumbs/mailman-config.png new file mode 100644 index 0000000..cae5177 Binary files /dev/null and b/thumbs/mailman-config.png differ diff --git a/thumbs/system-config.png b/thumbs/system-config.png new file mode 100644 index 0000000..1bb962e Binary files /dev/null and b/thumbs/system-config.png differ diff --git a/thumbs/venv.png b/thumbs/venv.png new file mode 100644 index 0000000..882d076 Binary files /dev/null and b/thumbs/venv.png differ diff --git a/zine_maker.py b/zine_maker.py index d40fc7f..cfc0195 100644 --- a/zine_maker.py +++ b/zine_maker.py @@ -202,50 +202,53 @@ class Zine(FPDF): # self.footer() - def cover(self, title, cover_font, max_height): + def cover(self, file_title, cover_font, max_height): col = 10 margin = 15 import random self.set_margins(margin, margin, margin) self.add_page() - for letter in title: - if self.get_y() >= max_height: - self.set_xy(margin+col, margin) - col += 40 - size = random.randrange(30, 50, 15) - self.set_font(cover_font, '', size) - variable_x = margin+col - print("LETTER {}, POSITION Y {}".format(letter, self.get_y())) - print("VAR X {}".format(variable_x)) - self.set_xy(variable_x, self.get_y()) + try: + title = open(file_title, 'r') + except Exception as e: + print(e, "Make sure the path and the file exists!", end="\n") + else: + for line in title.readlines(): + for letter in line: + if self.get_y() >= max_height: + self.set_xy(margin+col, margin) + col += 40 + size = random.randrange(30, 50, 15) + self.set_font(cover_font, '', size) + variable_x = margin+col + print("LETTER {}, POSITION Y {}".format(letter, self.get_y())) + print("VAR X {}".format(variable_x)) + self.set_xy(variable_x, self.get_y()) - self.cell(size, size, letter) - self.line(size, size, self.get_x(), self.get_y()) - if(size % 2 == 0): - var = "DF" - # r = 138, 43, 226 - R = random.randrange(30, 255, 40) - G = random.randrange(0, 55, 55) - B = random.randrange(0, 155, 50) - self.set_fill_color(R, G, B) - else: - var = "D" - print(var) - self.rect( - float(self.get_x()), float(self.get_y()), - float(size/2), float(size*4), style=var) - self.ln(size/2) + self.cell(size, size, letter) + self.line(size, size, self.get_x(), self.get_y()) + if(size % 2 == 0): + var = "DF" + R = random.randrange(30, 255, 40) + G = random.randrange(0, 55, 55) + B = random.randrange(0, 155, 50) + self.set_fill_color(R, G, B) + else: + var = "D" + print(var) + self.rect( + float(self.get_x()), float(self.get_y()), + float(size/2), float(size*4), style=var) + self.ln(size/2) - def colophon(self, text): + title.close() + + def colophon(self, text, cover_font): lines = open(text, 'r').readlines() top_margin = 20 margin = 25 - self.add_font( - 'CasaleNBP', '', r"/home/mara/.fonts/CasaletwoNbp-Bp4V.ttf", - uni=True) self.set_margins(margin, top_margin, margin) size = 13 - cover_font = 'CasaleNBP' self.set_font(cover_font, '', size) self.add_page() for line in lines: