summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--harfbuzz10years/Makefile13
-rwxr-xr-xharfbuzz10years/harfbuzz10years_slides.py221
-rw-r--r--harfbuzz10years/harfbuzz10years_theme.py68
l---------harfbuzz10years/pangopygments.py1
l---------harfbuzz10years/slippy.py1
5 files changed, 304 insertions, 0 deletions
diff --git a/harfbuzz10years/Makefile b/harfbuzz10years/Makefile
new file mode 100644
index 0000000..ccdf8e7
--- /dev/null
+++ b/harfbuzz10years/Makefile
@@ -0,0 +1,13 @@
1name = harfbuzz10years
2ARGS = --geometry 1920x1024
3
4all: $(name)_slides.pdf
5
6view:
7 python slippy.py $(name)_slides.py -t $(name)_theme.py $(ARGS)
8
9%_slides.pdf: slippy.py %_slides.py %_theme.py
10 python slippy.py $*_slides.py -t $*_theme.py -o $@ $(ARGS)
11
12clean:
13 $(RM) $(name)_slides.pdf *.pyc
diff --git a/harfbuzz10years/harfbuzz10years_slides.py b/harfbuzz10years/harfbuzz10years_slides.py
new file mode 100755
index 0000000..de53327
--- /dev/null
+++ b/harfbuzz10years/harfbuzz10years_slides.py
@@ -0,0 +1,221 @@
1#!/usr/bin/python
2# -*- coding:utf8 -*-
3
4# Copyright 2016 Behdad Esfahbod <behdad@google.com>
5
6# A slides file should populate the variable slides with
7# a list of tuples. Each tuple should have:
8#
9# - Slide content
10# - User data
11# - Canvas width
12# - Canvas height
13#
14# Slide content can be a string, a list of strings,
15# a function returning one of those, or a generator
16# yielding strings. The user data should be a dictionary or
17# None, and is both used to communicate options to the
18# renderer and to pass extra options to the theme functions.
19#
20# A function-based slide content will be passed a renderer object.
21# Renderer is an object similar to a cairo.Context and
22# pangocairo.CairoContext but has its own methods too.
23# The more useful of them here are put_text, put_image, and
24# set_allocation. See their pydocs.
25
26title_font="Impact"
27head_font="noto sans bold" # "Oswald Bold"
28body_font="noto sans condensed 50" # "PT Sans"
29xbody_font="noto sans thin 200" # "PT Sans"
30mono_font="Consolas, monospace"
31
32slides = []
33def slide_add(f, data=None, width=1920, height=1024):
34 if data is None:
35 data = {}
36 if "desc" not in data:
37 data['desc'] = body_font
38 slides.append ((f, data, width, height))
39 return f
40
41import pango, pangocairo, cairo
42
43# And convenience functions to add a slide. Can be
44# used as a function decorator, or called directly.
45def slide(f, data=None, scale=None):
46 if data:
47 data = dict (data)
48 else:
49 data = {}
50 if not scale: scale = 1.
51 def slider(r):
52 r.move_to (50, 30)
53 r.scale(scale, scale)
54 r.put_text (f, valign=1, halign=1, desc=body_font)
55 #r.set_allocation (x, y, width, height)
56 if isinstance(f, basestring):
57 return slide_add (slider, data)
58 return slide_add (f, data)
59
60def slide_big(f, data=None, scale=None):
61 if data:
62 data = dict (data)
63 else:
64 data = {}
65 if not scale: scale = 1
66 def slider(r):
67 r.move_to (960, 512)
68 r.scale(scale, scale)
69 r.put_text (f, valign=0, halign=0, desc=xbody_font)
70 #r.set_allocation (x, y, width, height)
71 if isinstance(f, basestring):
72 return slide_add (slider, data)
73 return slide_add (f, data)
74
75def slide_title (title, text, scale=None):
76 ts = '' if not title else "<span font_desc='"+head_font+"'>"+title+"</span>\n\n"
77 ts = ts + text.strip()
78 #s.__name__ = title
79 data={'desc': body_font, 'align': pango.ALIGN_LEFT}
80 slide (ts, data, scale=scale)
81def bullet_list_slide (title, items):
82 ts = "<span font_desc='"+head_font+"'>"+title+"</span>\n\n"
83 ts = ts + '\n'.join ("- " + item for item in items)
84 #s.__name__ = title
85 data={'desc': body_font, 'align': pango.ALIGN_LEFT}
86 slide (ts, data)
87
88def image_slide (f, width=1920, height=1024, imgwidth=0, imgheight=0, xoffset=0, yoffset=0, data=None):
89 def s (r):
90 r.move_to (960+xoffset, 512+yoffset)
91 r.put_image (f, width=imgwidth, height=imgheight)
92 x = (1920 - width) * .5
93 y = (1024 - height) * .5
94 r.set_allocation (x, y, width, height)
95 s.__name__ = f
96 slide (s, data)
97 return s
98
99#
100# Slides start here
101#
102
103@slide
104def title_slide (r):
105 r.move_to (30, 1000)
106 r.save()
107 r.set_source_rgb(0xf6/255., 0x48/255., 0x48/255.)
108 r.put_text ("<span font_desc='"+title_font+"' font_size='large'>Ten\nYears\nof\n"+
109 "HarfBuzz</span>",
110 valign=-1, halign=1, desc=title_font+" 128")
111
112 r.restore()
113 r.move_to (1890, 1000)
114 r.scale(1.4, 1.4)
115 r.put_text ("Behdad Esfahbod\nGoogle", halign=-1, valign=-1)
116
117#slide_big("FontTools")
118
119slide_title("Pre History", '\n'.join([
120 "FreeType Layout",
121 '',
122 "Pango",
123 '',
124 "Qt",
125 ]))
126slide_title("Early Days", '\n'.join([
127 "<b>2006Q1</b> Import FTL code from Pango into HarfBuzz(old)",
128 '',
129 "<b>2006Q4</b> Start experimental rewrite, called harfbuzz-ng",
130 '',
131 "<b>2007Q1</b> Qt donated their shapers to HarfBuzz(old)",
132 ]))
133
134slide_title("harfbuzz-ng goals", '\n'.join([
135 "user-friendly",
136 '',
137 "robust",
138 '',
139 "efficient",
140 '',
141 "threadsafe",
142 '',
143 "portable",
144 '',
145 "featureful",
146 ]))
147
148slide_title("Slow Days", '\n'.join([
149 "<b>2007</b> 3 commits",
150 '',
151 "<b>2008</b> 25 commits",
152 ]))
153
154slide_title("Faster Days", '\n'.join([
155 "<b>2009</b> over 400 commits",
156 "",
157 "<b>2009Q4</b> HarfBuzz Hackfest at Mozilla Toronto",
158 '',
159 "<b>2009Q4</b> WebkitGTK+ Hackfest",
160 '',
161 '<b>2010Q2</b> HarfBuzz Hackfest in Reading, UK',
162 '',
163 '<b>2010</b> Firefox ships for Latin',
164 ]))
165
166slide_title("Slower then Even Faster Days", '\n'.join([
167 "<b>2012Q2</b> HarfBuzz Hackfest at Google Zurich",
168 "",
169 "<b>2012Q3</b> HarfBuzz Hackfest at Mozilla Toronto",
170 '',
171 "<b>2012Q3</b> Pango switches over",
172 '',
173 "<b>2012Q4</b> HarfBuzz Hackfest at Mozilla Vancouver",
174 '',
175 "<b>2012Q4</b> ChromeOS / Chrome Linux",
176 '',
177 "<b>2012Q4</b> ICU Layout port",
178 ]))
179
180slide_title("Taking off", '\n'.join([
181 "<b>2013Q1</b> HarfBuzz Hackfest at Google London / Mozilla London",
182 '',
183 "<b>2013Q2</b> Android switches",
184 "",
185 "<b>2013Q4</b> HarfBuzz Hackfest at Mozilla Paris / Google Paris",
186 '',
187 "<b>~2014</b> Firefox switches for all scripts",
188 '',
189 "<b>2014Q1</b> Chrome Windows switches",
190 ]))
191
192slide_title("Maturity", '\n'.join([
193 "<b>~2015</b> Chrome Mac switch",
194 '',
195 "<b>2015Q3</b> HarfBuzz Hackfest at Mozilla London: USE",
196 '',
197 "<b>2015Q3</b> HarfBuzz 1.0.0",
198 '',
199 "<b>2015Q4</b> HarfBuzz Hackfest at Mozilla London: Unicode 8.0",
200 '',
201 "<b>2016Q2</b> HarfBuzz Hackfest at Mozilla London: Unicode 9.0",
202 ]))
203
204slide_title("Future", '\n'.join([
205 "hb-ot-font",
206 '',
207 "OpenType MATH",
208 '',
209 "OpenType COLR/CPAL, SVG",
210 '',
211 "OpenType Variation Fonts (mutator?)",
212 ]))
213
214#image_slide("pipeline.png", imgwidth=1900, imgheight=1000)
215
216slide_big("Q&amp;A")
217
218if __name__ == "__main__":
219 import slippy
220 import harfbuzz10years_theme
221 slippy.main (slides, harfbuzz10years_theme, args=['--geometry', '1920x1024'])
diff --git a/harfbuzz10years/harfbuzz10years_theme.py b/harfbuzz10years/harfbuzz10years_theme.py
new file mode 100644
index 0000000..58f5fc5
--- /dev/null
+++ b/harfbuzz10years/harfbuzz10years_theme.py
@@ -0,0 +1,68 @@
1# vim: set fileencoding=utf-8 :
2# Written by Behdad Esfahbod, 2014
3# Not copyrighted, in public domain.
4
5# A theme file should define two functions:
6#
7# - prepare_page(renderer): should draw any background and return a tuple of
8# x,y,w,h that is the area to use for slide canvas.
9#
10# - draw_bubble(renderer, x, y, w, h, data=None): should setup canvas for the
11# slide to run. Can draw a speaking-bubble for example. x,y,w,h is the
12# actual extents that the slide will consume. Data will be the user-data
13# dictionary from the slide.
14#
15# Renderer is an object similar to a cairo.Context and pangocairo.CairoContext
16# but has its own methods too. The more useful of them here are put_text and
17# put_image. See their pydocs.
18
19import cairo
20
21avatar_margin = .10
22logo_margin = .01
23footer_margin = .03
24padding = .000
25bubble_rad = .25
26
27fg_color = (.3,.3,.3)
28bg_color = (0xf6/255., 0x48/255., 0x48/255.)
29
30def prepare_page (renderer):
31 cr = renderer.cr
32 width = renderer.width
33 height = renderer.height
34
35 a = avatar_margin * width
36 s = (logo_margin + footer_margin) * .5 * width
37 l = logo_margin * height
38 f = footer_margin * height
39 p = padding * min (width, height)
40 p2 = 2 * p
41
42 cr.set_source_rgb (1, 1, 1)
43 cr.paint ()
44 cr.set_source_rgb (*fg_color)
45
46 cr.move_to (.5 * width, height-p2)
47 text = unicode("Behdad Esfahbod | 10 Years of HarfBuzz | Web Engines Hackfest 2016 A Coruña")
48 renderer.save()
49 renderer.set_source_rgb (*bg_color)
50 renderer.put_text (text, height=f-p2, valign=-1, desc="")
51 renderer.restore()
52
53
54 # Compute rectangle available for slide content
55 w = width - s - s - p * 2
56 x = s + p
57 h = height - l - f - p * 2
58 y = l + p
59
60 # Adjust for bubble padding. the 8 comes from bezier calculations
61 d = min (w, h) * bubble_rad / 8.
62 x, y, w, h = x + d, y + d, w - d*2, h - d*2
63
64
65 return x, y, w, h
66
67def draw_bubble (cr, x, y, w, h, data={}):
68 cr.set_source_rgb (*fg_color)
diff --git a/harfbuzz10years/pangopygments.py b/harfbuzz10years/pangopygments.py
new file mode 120000
index 0000000..3a5bcdd
--- /dev/null
+++ b/harfbuzz10years/pangopygments.py
@@ -0,0 +1 @@
../pangopygments.py \ No newline at end of file
diff --git a/harfbuzz10years/slippy.py b/harfbuzz10years/slippy.py
new file mode 120000
index 0000000..8eb5363
--- /dev/null
+++ b/harfbuzz10years/slippy.py
@@ -0,0 +1 @@
../slippy.py \ No newline at end of file