junglejourney

changeset 149:f1cd55ab1be2

Refactored font usage.
author David Boddie <david@boddie.org.uk>
date Tue Sep 13 20:32:50 2011 +0200
parents b7c0ad00dfa3
children 71a391aac085
files materials/make_packaging.py
diffstat 1 files changed, 41 insertions(+), 28 deletions(-) [+]
line diff
     1.1 --- a/materials/make_packaging.py	Tue Sep 13 20:19:54 2011 +0200
     1.2 +++ b/materials/make_packaging.py	Tue Sep 13 20:32:50 2011 +0200
     1.3 @@ -61,11 +61,9 @@
     1.4  
     1.5  class Text:
     1.6  
     1.7 -    def __init__(self, font, font_size, text, align = "left", style = None,
     1.8 -                       weight = None):
     1.9 +    def __init__(self, font, text, align = "left"):
    1.10      
    1.11 -        self.font = {"family": font, "size": font_size, "weight": weight,
    1.12 -                     "style": style}
    1.13 +        self.font = font
    1.14          self.text = text
    1.15          self.align = align
    1.16          
    1.17 @@ -155,11 +153,11 @@
    1.18      
    1.19      def line_height(self):
    1.20      
    1.21 -        font = QFont(self.font["family"])
    1.22 -        font.setPixelSize(self.font["size"])
    1.23 -        if self.font["weight"] == "bold":
    1.24 +        font = QFont(self.font.get("family"))
    1.25 +        font.setPixelSize(self.font.get("size"))
    1.26 +        if self.font.get("weight") == "bold":
    1.27              font.setWeight(QFont.Bold)
    1.28 -        if self.font["style"] == "italic":
    1.29 +        if self.font.get("style") == "italic":
    1.30              font.setItalic(True)
    1.31          
    1.32          metrics = QFontMetrics(font)
    1.33 @@ -174,11 +172,11 @@
    1.34      
    1.35      def font(self):
    1.36      
    1.37 -        font = QFont(self._font["family"])
    1.38 -        font.setPixelSize(self._font["size"])
    1.39 -        if self._font["weight"] == "bold":
    1.40 +        font = QFont(self._font.get("family"))
    1.41 +        font.setPixelSize(self._font.get("size"))
    1.42 +        if self._font.get("weight") == "bold":
    1.43              font.setWeight(QFont.Bold)
    1.44 -        if self._font["style"] == "italic":
    1.45 +        if self._font.get("style") == "italic":
    1.46              font.setItalic(True)
    1.47          return font
    1.48      
    1.49 @@ -212,11 +210,26 @@
    1.50      if not os.path.exists(output_dir):
    1.51          os.mkdir(output_dir)
    1.52      
    1.53 +    regular = {"family": "FreeSerif",
    1.54 +               "size": 24}
    1.55 +    
    1.56 +    title = regular.copy()
    1.57 +    title["weight"] = "bold"
    1.58 +    
    1.59 +    italic = regular.copy()
    1.60 +    italic["style"] = "italic"
    1.61 +    
    1.62 +    quote = regular.copy()
    1.63 +    quote["size"] = 22
    1.64 +    
    1.65 +    monospace = regular.copy()
    1.66 +    monospace["family"] = "FreeMono"
    1.67 +    
    1.68      pages = [
    1.69          Page((750, 1000),
    1.70               [TextBox((50, 40, 650, 0), 
    1.71 -                      [Text("FreeSerif", 24, "Jungle Journey\n", weight = "bold"),
    1.72 -                       Text("FreeSerif", 24,
    1.73 +                      [Text(title, "Jungle Journey\n"),
    1.74 +                       Text(regular,
    1.75                              "The last flames of the campfire fade to glowing embers and I am alone. "
    1.76                              "My recent acquaintances, their packs and paraphernalia have gone, leaving "
    1.77                              "me stranded deep in the heart of this jungle realm. Clouds momentarily "
    1.78 @@ -225,7 +238,7 @@
    1.79                              "try to stay my panic and remember those fragments of wilderness craft "
    1.80                              "learned and unlearned many years ago.\n", align = "justify")]),
    1.81                TextBox((90, 5, 570, 0),
    1.82 -                      [Text("FreeSerif", 24,
    1.83 +                      [Text(italic,
    1.84                              "Choose your weapon carefully,\n"
    1.85                              "Get ready for a fight.\n"
    1.86                              "The jungle can be dangerous\n"
    1.87 @@ -233,10 +246,10 @@
    1.88                              "There's time to pick up treasure,\n"
    1.89                              "But no time to stop and stare.\n"
    1.90                              "If you don't find the hidden gate\n"
    1.91 -                            "You won't get out of there.\n", style = "italic")],
    1.92 +                            "You won't get out of there.\n")],
    1.93                        follow = True),
    1.94                TextBox((50, 5, 650, 0),
    1.95 -                      [Text("FreeSerif", 24,
    1.96 +                      [Text(regular,
    1.97                              "Hopeless, I scramble to my feet, reaching for any weapon still left to me. "
    1.98                              "Struggling through the dense undergrowth, I search for signs of a track or "
    1.99                              "trail. At first glance, paths that seemed to lead to safety turn out to be "
   1.100 @@ -244,7 +257,7 @@
   1.101                              "an old teacher:\n", align = "justify")],
   1.102                        follow = True),
   1.103                TextBox((90, 5, 570, 0),
   1.104 -                      [Text("FreeSerif", 22,
   1.105 +                      [Text(quote,
   1.106                              u'\u201cDo not be tempted to use fire to make your way. '
   1.107                              'Many a traveller has strayed from the path, using fire to blaze a trail, '
   1.108                              'only to reach a dead end. Trying to return, they find that the jungle '
   1.109 @@ -252,7 +265,7 @@
   1.110                              u'forgotten routes when the way home is in sight.\u201d\n')],
   1.111                        follow = True),
   1.112                TextBox((50, 5, 650, 0),
   1.113 -                      [Text("FreeSerif", 24,
   1.114 +                      [Text(regular,
   1.115                              "Sensing my presence, obscene creatures emerge from the darkness, hungry "
   1.116                              "for prey. Only through skill and luck am I able to dispatch them back "
   1.117                              "into the shadows. Even though I know I must journey deeper into this "
   1.118 @@ -262,32 +275,32 @@
   1.119               ]),
   1.120          Page((750, 1000),
   1.121               [TextBox((50, 40, 650, 0),
   1.122 -                      [Text("FreeSerif", 24, "Loading the Game\n", weight = "bold")]),
   1.123 +                      [Text(title, "Loading the Game\n")]),
   1.124                TextBox((50, 5, 640, 0),
   1.125 -                      [Text("FreeSerif", 24, "Insert the cassette or disk and type\n")],
   1.126 +                      [Text(regular, "Insert the cassette or disk and type\n")],
   1.127                        follow = True),
   1.128                TextBox((90, 5, 570, 0),
   1.129 -                      [Text("FreeMono", 24, "*RUN JUNGLE\n")], follow = True),
   1.130 +                      [Text(monospace, "*RUN JUNGLE\n")], follow = True),
   1.131                TextBox((50, 0, 640, 0),
   1.132 -                      [Text("FreeSerif", 24,
   1.133 +                      [Text(regular,
   1.134                              "then press Return. If you are loading the game from cassette, press play on the "
   1.135                              "cassette recorder. The game should now load.\n")],
   1.136                        follow = True),
   1.137                TextBox((50, 15, 640, 0),
   1.138 -                      [Text("FreeSerif", 24, "Playing the Game\n", weight = "bold")],
   1.139 +                      [Text(title, "Playing the Game\n")],
   1.140                        follow = True),
   1.141                TextBox((50, 5, 640, 0),
   1.142 -                      [Text("FreeSerif", 24,
   1.143 +                      [Text(regular,
   1.144                              "Your character can be moved around the screen by using four control keys:\n")],
   1.145                        follow = True),
   1.146                TextBox((90, 5, 570, 0),
   1.147 -                      [Text("FreeSerif", 24,
   1.148 +                      [Text(regular,
   1.149                              "Z     left\n"
   1.150                              "X     right\n"
   1.151                              ":     up\n"
   1.152                              "/     down\n")], follow = True),
   1.153                TextBox((50, 5, 640, 0),
   1.154 -                      [Text("FreeSerif", 24,
   1.155 +                      [Text(regular,
   1.156                              "Enemies can be destroying by the projectiles fired by the player's weapon. "
   1.157                              "To fire a weapon, press the Return key. There are four different types of "
   1.158                              "weapon available in the game.\n\n"
   1.159 @@ -297,7 +310,7 @@
   1.160                              "Other keys can be used to control the game:\n")],
   1.161                        follow = True),
   1.162                TextBox((90, 5, 570, 0),
   1.163 -                      [Text("FreeSerif", 24,
   1.164 +                      [Text(regular,
   1.165                              "S         enable sound effects\n"
   1.166                              "Q         disable sound effects\n"
   1.167                              "P         pause the game\n"