From 2a9414f3c640ba4c04256eb014da01fba677eb02 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Wed, 11 May 2016 15:40:27 +0200 Subject: [fonttools2016] Remove unused bits --- fonttools2016/fonttools2016_slides.py | 95 +---------------------------------- fonttools2016/fonttools2016_theme.py | 2 +- 2 files changed, 3 insertions(+), 94 deletions(-) diff --git a/fonttools2016/fonttools2016_slides.py b/fonttools2016/fonttools2016_slides.py index ca09143..95f447f 100755 --- a/fonttools2016/fonttools2016_slides.py +++ b/fonttools2016/fonttools2016_slides.py @@ -24,7 +24,6 @@ # set_allocation. See their pydocs. title_font="Impact" -subtitle_font="Oswald Bold" head_font="sans Bold" # "Oswald Bold" body_font="sans" # "PT Sans" mono_font="Consolas, monospace" @@ -38,25 +37,15 @@ def slide_add(f, data=None, width=1920, height=1200): slides.append ((f, data, width, height)) return f -import pango, pangocairo, cairo, os, signal -from pangopygments import highlight - -# We use slide data to tell the theme who's speaking. -# That is, which side the bubble should point to. -behdad = -1 -whois = 0 -def who(name): - global whois - whois = name +import pango, pangocairo, cairo # And convenience functions to add a slide. Can be # used as a function decorator, or called directly. -def slide_who(f, who, data=None, scale=None): +def slide(f, data=None, scale=None): if data: data = dict (data) else: data = {} - data['who'] = who if not scale: scale = 1.4 def slider(r): r.move_to (100, 80) @@ -67,19 +56,6 @@ def slide_who(f, who, data=None, scale=None): return slide_add (slider, data) return slide_add (f, data) -def slide(f, data=None, scale=None): - return slide_who (f, whois, data=data, scale=scale) - -def slide_heading(f, data=None): - if data is None: - data = {} - if 'desc' not in data: - data['desc'] = head_font - if data and 'who' in data: - return slide_who (f, data['who'], data=data) - else: - return slide_who (f, 0, data=data) - def slide_title (title, text, scale=None): ts = '' if not title else ""+title+"\n\n" ts = ts + text.strip() @@ -104,68 +80,10 @@ def image_slide (f, width=1920, height=1200, imgwidth=0, imgheight=0, xoffset=0, slide (s, data) return s -def draw_image (r, f, width=600, height=600, imgwidth=0, imgheight=0, xoffset=0, yoffset=0, data=None): - r.move_to (400+xoffset, 300+yoffset) - r.put_image (f, width=imgwidth, height=imgheight) - x = (800 - width) * .5 - y = (600 - height) * .5 - r.set_allocation (x, y, width, height) - -def source_slide(s, lang): - s = highlight(s, lang) - s = "" + s + "" - slide_heading (s, data={'align': pango.ALIGN_LEFT}) - -def python_slide(s): - source_slide(s, lang="py") - -def xml_slide(s): - source_slide(s, lang="xml") - -def patch_slide(s): - lines = s.split ("\n") - new_lines = [] - for s in lines: - s = s.replace("&", "&").replace("<", "<") - if not s: s = ' ' - if s[0] == '-': - s = "%s" % s - elif s[0] == '+': - s = "%s" % s - elif s[0] != ' ': - s = "%s" % s - - new_lines.append (s) - - s = '\n'.join (new_lines) - s = "" + s + "" - slide_heading (s, data={'align': pango.ALIGN_LEFT}) - -def commit_slide(s, who=None): - lines = s.split ("\n") - new_lines = [] - for s in lines: - s = s.replace("&", "&").replace("<", "<") - if not s: s = ' ' - if s[0] != ' ': - s = "%s" % s - - new_lines.append (s) - - s = '\n'.join (new_lines) - s = "" + s + "" - if who: - slide_heading (s, data={'align': pango.ALIGN_LEFT, 'who': who}) - else: - slide_heading (s, data={'align': pango.ALIGN_LEFT}) - - # # Slides start here # -who (behdad) - @slide def title_slide (r): r.move_to (50, 100) @@ -177,15 +95,6 @@ def title_slide (r): r.scale(1.4, 1.4) r.put_text ("Part 1: Just van Rossum\nPart 2: Behdad Esfahbod\nPart 3: Q&A\n\ngithub.com/behdad/fonttools", halign=1, valign=+1) -def agenda(i=None): - items = [ - ] - if i is not None: - i = items.index(i) - items[i] = "%s" % items[i] - bullet_list_slide("Agenda", items) - - bullet_list_slide("Background: 2003", [ "FarsiWeb days", ]) diff --git a/fonttools2016/fonttools2016_theme.py b/fonttools2016/fonttools2016_theme.py index 0275688..2ba7b9f 100644 --- a/fonttools2016/fonttools2016_theme.py +++ b/fonttools2016/fonttools2016_theme.py @@ -57,7 +57,7 @@ def prepare_page (renderer): cr.set_source_rgb (*fg_color) cr.move_to (.5 * width, height-p2) - text = unicode("Behdad Esfahbod | FontTools/TTX|TYPO Labs Berlin | 11 may 2016") + text = unicode("Behdad Esfahbod | FontTools/TTX | TYPO Labs Berlin | 11 may 2016") letters = [] global j for i,c in enumerate(text): -- cgit v1.2.3