summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBehdad Esfahbod <behdad@behdad.org>2016-09-27 10:02:01 +0200
committerBehdad Esfahbod <behdad@behdad.org>2016-09-27 10:02:01 +0200
commit5535fe88a785dd75c96171b989f310fcd80e479e (patch)
treeaae0461973440174afbf8e75e4ddf0f0c4dd1a9c
parent57b5b9d49ce7066f8a21e607889dbbcce57bb1ed (diff)
Add harfbuzz10years slidesHEADmaster
-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 @@
+name = harfbuzz10years
+ARGS = --geometry 1920x1024
+
+all: $(name)_slides.pdf
+
+view:
+ python slippy.py $(name)_slides.py -t $(name)_theme.py $(ARGS)
+
+%_slides.pdf: slippy.py %_slides.py %_theme.py
+ python slippy.py $*_slides.py -t $*_theme.py -o $@ $(ARGS)
+
+clean:
+ $(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 @@
+#!/usr/bin/python
+# -*- coding:utf8 -*-
+
+# Copyright 2016 Behdad Esfahbod <behdad@google.com>
+
+# A slides file should populate the variable slides with
+# a list of tuples. Each tuple should have:
+#
+# - Slide content
+# - User data
+# - Canvas width
+# - Canvas height
+#
+# Slide content can be a string, a list of strings,
+# a function returning one of those, or a generator
+# yielding strings. The user data should be a dictionary or
+# None, and is both used to communicate options to the
+# renderer and to pass extra options to the theme functions.
+#
+# A function-based slide content will be passed a renderer object.
+# Renderer is an object similar to a cairo.Context and
+# pangocairo.CairoContext but has its own methods too.
+# The more useful of them here are put_text, put_image, and
+# set_allocation. See their pydocs.
+
+title_font="Impact"
+head_font="noto sans bold" # "Oswald Bold"
+body_font="noto sans condensed 50" # "PT Sans"
+xbody_font="noto sans thin 200" # "PT Sans"
+mono_font="Consolas, monospace"
+
+slides = []
+def slide_add(f, data=None, width=1920, height=1024):
+ if data is None:
+ data = {}
+ if "desc" not in data:
+ data['desc'] = body_font
+ slides.append ((f, data, width, height))
+ return f
+
+import pango, pangocairo, cairo
+
+# And convenience functions to add a slide. Can be
+# used as a function decorator, or called directly.
+def slide(f, data=None, scale=None):
+ if data:
+ data = dict (data)
+ else:
+ data = {}
+ if not scale: scale = 1.
+ def slider(r):
+ r.move_to (50, 30)
+ r.scale(scale, scale)
+ r.put_text (f, valign=1, halign=1, desc=body_font)
+ #r.set_allocation (x, y, width, height)
+ if isinstance(f, basestring):
+ return slide_add (slider, data)
+ return slide_add (f, data)
+
+def slide_big(f, data=None, scale=None):
+ if data:
+ data = dict (data)
+ else:
+ data = {}
+ if not scale: scale = 1
+ def slider(r):
+ r.move_to (960, 512)
+ r.scale(scale, scale)
+ r.put_text (f, valign=0, halign=0, desc=xbody_font)
+ #r.set_allocation (x, y, width, height)
+ if isinstance(f, basestring):
+ return slide_add (slider, data)
+ return slide_add (f, data)
+
+def slide_title (title, text, scale=None):
+ ts = '' if not title else "<span font_desc='"+head_font+"'>"+title+"</span>\n\n"
+ ts = ts + text.strip()
+ #s.__name__ = title
+ data={'desc': body_font, 'align': pango.ALIGN_LEFT}
+ slide (ts, data, scale=scale)
+def bullet_list_slide (title, items):
+ ts = "<span font_desc='"+head_font+"'>"+title+"</span>\n\n"
+ ts = ts + '\n'.join ("- " + item for item in items)
+ #s.__name__ = title
+ data={'desc': body_font, 'align': pango.ALIGN_LEFT}
+ slide (ts, data)
+
+def image_slide (f, width=1920, height=1024, imgwidth=0, imgheight=0, xoffset=0, yoffset=0, data=None):
+ def s (r):
+ r.move_to (960+xoffset, 512+yoffset)
+ r.put_image (f, width=imgwidth, height=imgheight)
+ x = (1920 - width) * .5
+ y = (1024 - height) * .5
+ r.set_allocation (x, y, width, height)
+ s.__name__ = f
+ slide (s, data)
+ return s
+
+#
+# Slides start here
+#
+
+@slide
+def title_slide (r):
+ r.move_to (30, 1000)
+ r.save()
+ r.set_source_rgb(0xf6/255., 0x48/255., 0x48/255.)
+ r.put_text ("<span font_desc='"+title_font+"' font_size='large'>Ten\nYears\nof\n"+
+ "HarfBuzz</span>",
+ valign=-1, halign=1, desc=title_font+" 128")
+
+ r.restore()
+ r.move_to (1890, 1000)
+ r.scale(1.4, 1.4)
+ r.put_text ("Behdad Esfahbod\nGoogle", halign=-1, valign=-1)
+
+#slide_big("FontTools")
+
+slide_title("Pre History", '\n'.join([
+ "FreeType Layout",
+ '',
+ "Pango",
+ '',
+ "Qt",
+ ]))
+slide_title("Early Days", '\n'.join([
+ "<b>2006Q1</b> Import FTL code from Pango into HarfBuzz(old)",
+ '',
+ "<b>2006Q4</b> Start experimental rewrite, called harfbuzz-ng",
+ '',
+ "<b>2007Q1</b> Qt donated their shapers to HarfBuzz(old)",
+ ]))
+
+slide_title("harfbuzz-ng goals", '\n'.join([
+ "user-friendly",
+ '',
+ "robust",
+ '',
+ "efficient",
+ '',
+ "threadsafe",
+ '',
+ "portable",
+ '',
+ "featureful",
+ ]))
+
+slide_title("Slow Days", '\n'.join([
+ "<b>2007</b> 3 commits",
+ '',
+ "<b>2008</b> 25 commits",
+ ]))
+
+slide_title("Faster Days", '\n'.join([
+ "<b>2009</b> over 400 commits",
+ "",
+ "<b>2009Q4</b> HarfBuzz Hackfest at Mozilla Toronto",
+ '',
+ "<b>2009Q4</b> WebkitGTK+ Hackfest",
+ '',
+ '<b>2010Q2</b> HarfBuzz Hackfest in Reading, UK',
+ '',
+ '<b>2010</b> Firefox ships for Latin',
+ ]))
+
+slide_title("Slower then Even Faster Days", '\n'.join([
+ "<b>2012Q2</b> HarfBuzz Hackfest at Google Zurich",
+ "",
+ "<b>2012Q3</b> HarfBuzz Hackfest at Mozilla Toronto",
+ '',
+ "<b>2012Q3</b> Pango switches over",
+ '',
+ "<b>2012Q4</b> HarfBuzz Hackfest at Mozilla Vancouver",
+ '',
+ "<b>2012Q4</b> ChromeOS / Chrome Linux",
+ '',
+ "<b>2012Q4</b> ICU Layout port",
+ ]))
+
+slide_title("Taking off", '\n'.join([
+ "<b>2013Q1</b> HarfBuzz Hackfest at Google London / Mozilla London",
+ '',
+ "<b>2013Q2</b> Android switches",
+ "",
+ "<b>2013Q4</b> HarfBuzz Hackfest at Mozilla Paris / Google Paris",
+ '',
+ "<b>~2014</b> Firefox switches for all scripts",
+ '',
+ "<b>2014Q1</b> Chrome Windows switches",
+ ]))
+
+slide_title("Maturity", '\n'.join([
+ "<b>~2015</b> Chrome Mac switch",
+ '',
+ "<b>2015Q3</b> HarfBuzz Hackfest at Mozilla London: USE",
+ '',
+ "<b>2015Q3</b> HarfBuzz 1.0.0",
+ '',
+ "<b>2015Q4</b> HarfBuzz Hackfest at Mozilla London: Unicode 8.0",
+ '',
+ "<b>2016Q2</b> HarfBuzz Hackfest at Mozilla London: Unicode 9.0",
+ ]))
+
+slide_title("Future", '\n'.join([
+ "hb-ot-font",
+ '',
+ "OpenType MATH",
+ '',
+ "OpenType COLR/CPAL, SVG",
+ '',
+ "OpenType Variation Fonts (mutator?)",
+ ]))
+
+#image_slide("pipeline.png", imgwidth=1900, imgheight=1000)
+
+slide_big("Q&amp;A")
+
+if __name__ == "__main__":
+ import slippy
+ import harfbuzz10years_theme
+ 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 @@
+# vim: set fileencoding=utf-8 :
+# Written by Behdad Esfahbod, 2014
+# Not copyrighted, in public domain.
+
+# A theme file should define two functions:
+#
+# - prepare_page(renderer): should draw any background and return a tuple of
+# x,y,w,h that is the area to use for slide canvas.
+#
+# - draw_bubble(renderer, x, y, w, h, data=None): should setup canvas for the
+# slide to run. Can draw a speaking-bubble for example. x,y,w,h is the
+# actual extents that the slide will consume. Data will be the user-data
+# dictionary from the slide.
+#
+# Renderer is an object similar to a cairo.Context and pangocairo.CairoContext
+# but has its own methods too. The more useful of them here are put_text and
+# put_image. See their pydocs.
+
+import cairo
+
+avatar_margin = .10
+logo_margin = .01
+footer_margin = .03
+padding = .000
+bubble_rad = .25
+
+fg_color = (.3,.3,.3)
+bg_color = (0xf6/255., 0x48/255., 0x48/255.)
+
+def prepare_page (renderer):
+ cr = renderer.cr
+ width = renderer.width
+ height = renderer.height
+
+ a = avatar_margin * width
+ s = (logo_margin + footer_margin) * .5 * width
+ l = logo_margin * height
+ f = footer_margin * height
+ p = padding * min (width, height)
+ p2 = 2 * p
+
+ cr.set_source_rgb (1, 1, 1)
+ cr.paint ()
+ cr.set_source_rgb (*fg_color)
+
+ cr.move_to (.5 * width, height-p2)
+ text = unicode("Behdad Esfahbod | 10 Years of HarfBuzz | Web Engines Hackfest 2016 A Coruña")
+ renderer.save()
+ renderer.set_source_rgb (*bg_color)
+ renderer.put_text (text, height=f-p2, valign=-1, desc="")
+ renderer.restore()
+
+
+ # Compute rectangle available for slide content
+ w = width - s - s - p * 2
+ x = s + p
+ h = height - l - f - p * 2
+ y = l + p
+
+ # Adjust for bubble padding. the 8 comes from bezier calculations
+ d = min (w, h) * bubble_rad / 8.
+ x, y, w, h = x + d, y + d, w - d*2, h - d*2
+
+
+ return x, y, w, h
+
+def draw_bubble (cr, x, y, w, h, data={}):
+ 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