junglejourney
changeset 150:71a391aac085
Merged font and alignment information.
| author | David Boddie <david@boddie.org.uk> |
|---|---|
| date | Tue Sep 13 20:36:35 2011 +0200 |
| parents | f1cd55ab1be2 |
| children | 4eab1c5c40e1 |
| files | materials/make_packaging.py |
| diffstat | 1 files changed, 18 insertions(+), 17 deletions(-) [+] |
line diff
1.1 --- a/materials/make_packaging.py Tue Sep 13 20:32:50 2011 +0200 1.2 +++ b/materials/make_packaging.py Tue Sep 13 20:36:35 2011 +0200 1.3 @@ -61,11 +61,10 @@ 1.4 1.5 class Text: 1.6 1.7 - def __init__(self, font, text, align = "left"): 1.8 + def __init__(self, font, text): 1.9 1.10 self.font = font 1.11 self.text = text 1.12 - self.align = align 1.13 1.14 self.parse_text() 1.15 1.16 @@ -128,7 +127,7 @@ 1.17 1.18 if len(words) == 0: 1.19 spacing = 0 1.20 - elif self.align == "justify" and not last: 1.21 + elif self.font.get("align", "left") == "justify" and not last: 1.22 # Full justify the text. 1.23 total_width = sum(map(lambda word: word.width(), words)) 1.24 spacing = (width - total_width)/float(len(words)) 1.25 @@ -211,19 +210,22 @@ 1.26 os.mkdir(output_dir) 1.27 1.28 regular = {"family": "FreeSerif", 1.29 - "size": 24} 1.30 + "size": 24, 1.31 + "align": "justify"} 1.32 1.33 - title = regular.copy() 1.34 - title["weight"] = "bold" 1.35 + title = {"family": "FreeSerif", 1.36 + "size": 24, 1.37 + "weight": "bold"} 1.38 1.39 - italic = regular.copy() 1.40 - italic["style"] = "italic" 1.41 + italic_quote = {"family": "FreeSerif", 1.42 + "size": 24, 1.43 + "style": "italic"} 1.44 1.45 - quote = regular.copy() 1.46 - quote["size"] = 22 1.47 + quote = {"family": "FreeSerif", 1.48 + "size": 22} 1.49 1.50 - monospace = regular.copy() 1.51 - monospace["family"] = "FreeMono" 1.52 + monospace = {"family": "FreeMono", 1.53 + "size": 24} 1.54 1.55 pages = [ 1.56 Page((750, 1000), 1.57 @@ -236,9 +238,9 @@ 1.58 "sweep the cold face of the moon and I perceive the clicks, whistles and " 1.59 "cries of creatures in the hot air that cloaks this place. Desperately, I " 1.60 "try to stay my panic and remember those fragments of wilderness craft " 1.61 - "learned and unlearned many years ago.\n", align = "justify")]), 1.62 + "learned and unlearned many years ago.\n")]), 1.63 TextBox((90, 5, 570, 0), 1.64 - [Text(italic, 1.65 + [Text(italic_quote, 1.66 "Choose your weapon carefully,\n" 1.67 "Get ready for a fight.\n" 1.68 "The jungle can be dangerous\n" 1.69 @@ -254,7 +256,7 @@ 1.70 "Struggling through the dense undergrowth, I search for signs of a track or " 1.71 "trail. At first glance, paths that seemed to lead to safety turn out to be " 1.72 "impassable, overgrown by tangled and twisted vines. I remember the words of " 1.73 - "an old teacher:\n", align = "justify")], 1.74 + "an old teacher:\n")], 1.75 follow = True), 1.76 TextBox((90, 5, 570, 0), 1.77 [Text(quote, 1.78 @@ -269,8 +271,7 @@ 1.79 "Sensing my presence, obscene creatures emerge from the darkness, hungry " 1.80 "for prey. Only through skill and luck am I able to dispatch them back " 1.81 "into the shadows. Even though I know I must journey deeper into this " 1.82 - "uncharted land to find the way home, the thought of vengeance drives me on.", 1.83 - align = "justify")], 1.84 + "uncharted land to find the way home, the thought of vengeance drives me on.")], 1.85 follow = True) 1.86 ]), 1.87 Page((750, 1000),
