#!/usr/bin/env python # Code modified from the original WRITINGPAPER.PY by Trevor Keller # Source of original code is http://www.carcosa.net/jason/software/utilities/writingpaper/ # Original author's comments: # Programatically generate writing paper with guidelines for italic handwriting. Copyright (C) 2007, Jason F. McBrayer # This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. # # You can choose the paper size, line height, x-height, output file name, and # page orientation by setting the parameters near the beginning of the # file. # # This program requires reportlab (http://www.reportlab.org/) for Python. # # This modified code generates guidelines for copperplate handrwiting. # Slope, waistline, t-line, and ascender line dimensions found on The Fountain Pen Network: # http://www.fountainpennetwork.com/forum/index.php?/topic/43421-copperplate-guidelines-for-download/ # http://www.fountainpennetwork.com/forum/index.php?/topic/46264-there-is-tremendous-gratification/ # # Imports from reportlab.pdfgen.canvas import Canvas from reportlab.lib.styles import getSampleStyleSheet from reportlab.platypus import * from reportlab.lib.pagesizes import letter, A4, landscape, portrait from reportlab.lib.units import cm, mm, inch, pica from reportlab.lib import colors # Parameters OUTPUTFILE = "copperplatepaper.pdf" PAGESIZE = (8.5 * 72, 11 * 72) # x, y in dots: 72 × dimensions in inches GUIDEGRID = 0 # turn sub-grid for letter shapes on & off. On = 1 # PAGESIZE = letter # --- ascender: 0.00 mm # - - t ascender: -0.85 x mm # === waistline: -1.50 x mm # # === baseline: -2.50 x mm # # --- descender: -4.00 x mm XHEIGHT = 3.75 # mm # angle = 54 degrees --> tan 35 = 0.7 # Convert x-height from mm to 72nds of an inch XHEIGHT *= 72/25.4 ORIENTATION = portrait LEFTMARGIN = True GUIDETHICKNESS_MAIN = 0.50 GUIDETHICKNESS_SMALL = 0.25 THKBENCH = 0.1 def main(): LINEHEIGHT = 4 * XHEIGHT currpos = PAGESIZE[1] - 36 # top of page - 0.5" border pdf = Canvas(OUTPUTFILE, pagesize = ORIENTATION(PAGESIZE)) pdf.setFillGray(1) pdf.setLineWidth(GUIDETHICKNESS_MAIN) while currpos > LINEHEIGHT: # Loop until we reach one line from bottom of page # Draw horizontal guidelines if GUIDEGRID > 0: pdf.setLineWidth(GUIDETHICKNESS_SMALL) pdf.setStrokeGray(1 - THKBENCH - 0.05) for i in range(1,16): pdf.line( 36, currpos - 0.25 * i * XHEIGHT, PAGESIZE[0]-36, currpos - 0.25 * i * XHEIGHT) # guideline # Draw slanted guidelines if LEFTMARGIN: LINEPOS = 36+ 1.5 * XHEIGHT pdf.setLineWidth(GUIDETHICKNESS_SMALL) while LINEPOS < PAGESIZE[0] - 37 - (2 * 1.2208 * XHEIGHT): pdf.setStrokeGray(1 - THKBENCH - 0.10) pdf.line( LINEPOS, currpos - 4 * XHEIGHT + GUIDETHICKNESS_SMALL / 3, LINEPOS + 4 * 0.7 * XHEIGHT, currpos - GUIDETHICKNESS_SMALL / 3 ) if GUIDEGRID > 0: for i in range (1,3): pdf.line( LINEPOS, currpos - 4 * XHEIGHT + GUIDETHICKNESS_SMALL / 3, LINEPOS + 4 * 0.7 * XHEIGHT, currpos - GUIDETHICKNESS_SMALL / 3 ) LINEPOS += 0.3052 * XHEIGHT else: LINEPOS += 1.2208 * XHEIGHT # Draw full ascender line pdf.setLineWidth(GUIDETHICKNESS_SMALL) pdf.setStrokeGray(1 - THKBENCH - 0.15) pdf.line( 36, currpos, PAGESIZE[0]-36, currpos) # Draw mid ascender line, descender line, waistline, and baseline pdf.setStrokeGray(1 - THKBENCH - 0.10) pdf.setLineWidth(GUIDETHICKNESS_SMALL) pdf.line( 36, currpos - 0.75 * XHEIGHT, PAGESIZE[0]-36, currpos - 0.75 * XHEIGHT) # short ascender pdf.line( 36, currpos - 4.00 * XHEIGHT, PAGESIZE[0]-36, currpos - 4.00 * XHEIGHT) # descender pdf.setStrokeGray(1 - THKBENCH - 0.15) pdf.setLineWidth(GUIDETHICKNESS_MAIN) pdf.line( 36, currpos - 1.50 * XHEIGHT, PAGESIZE[0]-36, currpos - 1.50 * XHEIGHT) # waist line pdf.line(36+XHEIGHT, currpos - 1.50 * XHEIGHT, 36+XHEIGHT, currpos - 2.50 * XHEIGHT) # x-height line pdf.line(36+ 0.25 * XHEIGHT, currpos - 1.75 * XHEIGHT, 36+0.75 * XHEIGHT, currpos - 2.25 * XHEIGHT) # x-height line pdf.line(36+0.25 * XHEIGHT, currpos - 2.25 * XHEIGHT, 36+0.75 * XHEIGHT, currpos - 1.75 * XHEIGHT) # x-height line pdf.line(36, currpos - 1.50 * XHEIGHT, 36, currpos - 2.50 * XHEIGHT) # x-height line pdf.line( 36, currpos - 2.50 * XHEIGHT, PAGESIZE[0]-36, currpos - 2.50 * XHEIGHT) # base line # Next row currpos -= 4 * XHEIGHT # close up. pdf.showPage() pdf.save() if __name__ == "__main__": main()