Add fonts, text, img, output folders
This commit is contained in:
parent
5b507017a6
commit
65e2860b65
24 changed files with 56 additions and 69 deletions
BIN
body/images.pdf
Normal file
BIN
body/images.pdf
Normal file
Binary file not shown.
BIN
body/oulipo.pdf
Normal file
BIN
body/oulipo.pdf
Normal file
Binary file not shown.
BIN
body/oulipo1.pdf
Normal file
BIN
body/oulipo1.pdf
Normal file
Binary file not shown.
11
colophon.py
11
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()
|
||||
|
|
|
|||
BIN
colophones/colophon.pdf
Normal file
BIN
colophones/colophon.pdf
Normal file
Binary file not shown.
25
cover.py
25
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()
|
||||
|
|
|
|||
BIN
covers/cover.pdf
Normal file
BIN
covers/cover.pdf
Normal file
Binary file not shown.
16
doc_pdf.py
16
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()
|
||||
|
|
|
|||
BIN
fonts/CasaletwoAlternatesNbp-RgRM.pkl
Normal file
BIN
fonts/CasaletwoAlternatesNbp-RgRM.pkl
Normal file
Binary file not shown.
BIN
fonts/CasaletwoAlternatesNbp-RgRM.ttf
Normal file
BIN
fonts/CasaletwoAlternatesNbp-RgRM.ttf
Normal file
Binary file not shown.
BIN
fonts/CasaletwoNbp-Bp4V.pkl
Normal file
BIN
fonts/CasaletwoNbp-Bp4V.pkl
Normal file
Binary file not shown.
BIN
fonts/CasaletwoNbp-Bp4V.ttf
Normal file
BIN
fonts/CasaletwoNbp-Bp4V.ttf
Normal file
Binary file not shown.
BIN
fonts/KpProgrammerAlternatesNbp-Zg1q.cw127.pkl
Normal file
BIN
fonts/KpProgrammerAlternatesNbp-Zg1q.cw127.pkl
Normal file
Binary file not shown.
BIN
fonts/KpProgrammerAlternatesNbp-Zg1q.pkl
Normal file
BIN
fonts/KpProgrammerAlternatesNbp-Zg1q.pkl
Normal file
Binary file not shown.
BIN
fonts/KpProgrammerAlternatesNbp-Zg1q.ttf
Normal file
BIN
fonts/KpProgrammerAlternatesNbp-Zg1q.ttf
Normal file
Binary file not shown.
BIN
fonts/KpProgrammerNbp-3M3X.ttf
Normal file
BIN
fonts/KpProgrammerNbp-3M3X.ttf
Normal file
Binary file not shown.
|
|
@ -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)
|
||||
|
||||
|
|
|
|||
BIN
thumbs/compiler.png
Normal file
BIN
thumbs/compiler.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 16 KiB |
BIN
thumbs/libs-black.png
Normal file
BIN
thumbs/libs-black.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 64 KiB |
BIN
thumbs/libs-green.png
Normal file
BIN
thumbs/libs-green.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 54 KiB |
BIN
thumbs/mailman-config.png
Normal file
BIN
thumbs/mailman-config.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 106 KiB |
BIN
thumbs/system-config.png
Normal file
BIN
thumbs/system-config.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 43 KiB |
BIN
thumbs/venv.png
Normal file
BIN
thumbs/venv.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 35 KiB |
|
|
@ -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:
|
||||
|
|
|
|||
Loading…
Reference in a new issue