From 42996a9acdf891255def162a35ad8bfc1b30f17e Mon Sep 17 00:00:00 2001 From: camilo Date: Mon, 12 Oct 2020 11:37:08 +0200 Subject: [PATCH] Upload files to '' --- quilt.ipynb | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/quilt.ipynb b/quilt.ipynb index a02602f..32fc0d2 100644 --- a/quilt.ipynb +++ b/quilt.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "code", - "execution_count": 34, + "execution_count": 10, "metadata": {}, "outputs": [], "source": [ @@ -16,7 +16,7 @@ }, { "cell_type": "code", - "execution_count": 35, + "execution_count": 11, "metadata": {}, "outputs": [ { @@ -31,7 +31,7 @@ " ['louisa-patch-update', 'number-patch', 'Camilo', 'kendalpatch']]" ] }, - "execution_count": 35, + "execution_count": 11, "metadata": {}, "output_type": "execute_result" } @@ -42,7 +42,7 @@ }, { "cell_type": "code", - "execution_count": 36, + "execution_count": 12, "metadata": { "collapsed": true, "jupyter": { @@ -1248,7 +1248,7 @@ " for linenumber in range(74):\n", " for patch in row:\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", " print(line, file=output, end='')\n", " print(file=output)\n", @@ -1257,17 +1257,27 @@ }, { "cell_type": "code", - "execution_count": 37, + "execution_count": 13, "metadata": {}, "outputs": [], "source": [ "from reportlab.pdfgen.canvas import Canvas\n", "from reportlab.lib.pagesizes import A4,A0\n", "from reportlab.lib.units import mm\n", + "from reportlab.pdfbase.ttfonts import TTFont, pdfmetrics\n", + "\n", "pagewidth, pageheight = A0\n", "\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", "y = start_y\n", "lineheight = 4*mm\n",