Upload files to ''

master
camilo 4 years ago
parent a6327efa92
commit 42996a9acd

@ -2,7 +2,7 @@
"cells": [ "cells": [
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 34, "execution_count": 10,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@ -16,7 +16,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 35, "execution_count": 11,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@ -31,7 +31,7 @@
" ['louisa-patch-update', 'number-patch', 'Camilo', 'kendalpatch']]" " ['louisa-patch-update', 'number-patch', 'Camilo', 'kendalpatch']]"
] ]
}, },
"execution_count": 35, "execution_count": 11,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
@ -42,7 +42,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 36, "execution_count": 12,
"metadata": { "metadata": {
"collapsed": true, "collapsed": true,
"jupyter": { "jupyter": {
@ -1248,7 +1248,7 @@
" for linenumber in range(74):\n", " for linenumber in range(74):\n",
" for patch in row:\n", " for patch in row:\n",
" print(f\"line {linenumber} {patch}\")\n", " print(f\"line {linenumber} {patch}\")\n",
" line = open(f\"patterns/{patch}.txt\").readlines()[linenumber]\n", " line = open(f\"patches/{patch}.txt\").readlines()[linenumber]\n",
" line = line.rstrip(\"\\n\")\n", " line = line.rstrip(\"\\n\")\n",
" print(line, file=output, end='')\n", " print(line, file=output, end='')\n",
" print(file=output)\n", " print(file=output)\n",
@ -1257,17 +1257,27 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 37, "execution_count": 13,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
"from reportlab.pdfgen.canvas import Canvas\n", "from reportlab.pdfgen.canvas import Canvas\n",
"from reportlab.lib.pagesizes import A4,A0\n", "from reportlab.lib.pagesizes import A4,A0\n",
"from reportlab.lib.units import mm\n", "from reportlab.lib.units import mm\n",
"from reportlab.pdfbase.ttfonts import TTFont, pdfmetrics\n",
"\n",
"pagewidth, pageheight = A0\n", "pagewidth, pageheight = A0\n",
"\n", "\n",
"c = Canvas(\"quilt2.pdf\", pagesize=(pagewidth, pageheight), bottomup=0) \n", "c = Canvas(\"quilt2.pdf\", pagesize=(pagewidth, pageheight), bottomup=0) \n",
"c.setFont('Courier', 12)\n", "\n",
"\n",
"fontpath = \"fonts/mplus-1m-regular.ttf\"\n",
"font = TTFont('1mregular', fontpath)\n",
"pdfmetrics.registerFont(font)\n",
"\n",
"# To set a font in the PDF\n",
"c.setFont('1mregular', 14.4)\n",
"\n",
"start_y = 5*mm\n", "start_y = 5*mm\n",
"y = start_y\n", "y = start_y\n",
"lineheight = 4*mm\n", "lineheight = 4*mm\n",

Loading…
Cancel
Save