Skip to content

Commit

Permalink
center between header and footer
Browse files Browse the repository at this point in the history
  • Loading branch information
nimarion committed May 15, 2024
1 parent 80f5a88 commit 02d4315
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion bib.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,17 @@ def generate_image(txt, header_file, footer_file, font_file):
_, _, w, h = draw.textbbox((0, 0), txt, font=font)

#print('Fontsize:',fontsize)
draw.text(((W-w)/2,(H-h)/2), txt, font=font, fill="black", align="center", stroke_width=1, stroke_fill="black")

#draw text between header and footer
x = (W - w) // 2
y = header.size[1] + ((blank_height - h) // 2)
draw.text((x, y), txt, font=font, fill="black", align="center", stroke_width=1, stroke_fill="black")

# draw.rectangle([0, 0, blank.size[0] - 1, blank.size[1] - 1], outline="red", width=10)

# draw rectanble around text area with blank size
# draw.rectangle([0, header.size[1], W - 1, H - footer.size[1] - 1], outline="red", width=10)

#draw.text((2100, 442), "150", font=font, fill="black", align="center", stroke_width=1, stroke_fill="black")

# draw text on top right of text area
Expand Down

0 comments on commit 02d4315

Please sign in to comment.