Browse Source

Fix argument name, botchar -> firstchar

James Bowman 6 years ago
parent
commit
8d43a4087f
3 changed files with 9 additions and 9 deletions
  1. 5 5
      gameduino2/prep.py
  2. 2 2
      scripts/gd2asset
  3. 2 2
      scripts/gd3asset

+ 5 - 5
gameduino2/prep.py

@@ -343,13 +343,13 @@ class AssetBin(gameduino2.base.GD2):
         self.alldata += dblock
         self.cmd_setfont(h, p1)
 
-    def load_ttf(self, name, ttfname, size, format, botchar = 32, topchar = 127, charset = None):
+    def load_ttf(self, name, ttfname, size, format, firstchar = 32, topchar = 127, charset = None):
         font = ImageFont.truetype(ttfname, size)
         if charset is not None:
-            topchar = botchar + len(charset)
+            topchar = firstchar + len(charset)
             rr = [ord(c) for c in charset]
         else:
-            rr = range(botchar, topchar + 1)
+            rr = range(firstchar, topchar + 1)
         sizes = {c:font.getsize(chr(c)) for c in rr}
         fw = max([w for (w, _) in sizes.values()])
         fh = max([h for (_, h) in sizes.values()])
@@ -362,7 +362,7 @@ class AssetBin(gameduino2.base.GD2):
         alle = gd2.prep.extents(im)
 
         # render and crop the characters to the extents
-        ims = [None] * botchar
+        ims = [None] * firstchar
         for i in rr:
             im = Image.new("L", (fw+16, fh+16))
             dr = ImageDraw.Draw(im)
@@ -371,7 +371,7 @@ class AssetBin(gameduino2.base.GD2):
         widths = [sizes.get(c, (0,0))[0] for c in range(128)]
         if charset is not None:
             for i,c in enumerate(charset):
-                widths[botchar + i] = sizes.get(ord(c), (0,0))[0]
+                widths[firstchar + i] = sizes.get(ord(c), (0,0))[0]
         self.load_font(name, ims, widths, format)
 
     def load_tiles(self, name, file_name, scale = None, preview = False):

+ 2 - 2
scripts/gd2asset

@@ -55,10 +55,10 @@ class GD2Assets(gd2.prep.AssetBin):
                          self.parse_format(format),
                          dither = '-d' in self.opts)
 
-    def ttf(self, suffix, f, size = '12', format = 'L4', botchar = '32', topchar = '127', charset = None):
+    def ttf(self, suffix, f, size = '12', format = 'L4', firstchar = '32', topchar = '127', charset = None):
         name = cname(os.path.basename(f[0])[:-1 - len(suffix)])
         self.load_ttf(name, f[0], int(size), self.parse_format(format),
-                      botchar = int(botchar, 0),
+                      firstchar = int(firstchar, 0),
                       topchar = int(topchar, 0),
                       charset = charset)
 

+ 2 - 2
scripts/gd3asset

@@ -55,10 +55,10 @@ class GD2Assets(gd2.prep.AssetBin):
                          self.parse_format(format),
                          dither = '-d' in self.opts)
 
-    def ttf(self, suffix, f, size = '12', format = 'L4', botchar = '32', topchar = '127', charset = None):
+    def ttf(self, suffix, f, size = '12', format = 'L4', firstchar = '32', topchar = '127', charset = None):
         name = cname(os.path.basename(f[0])[:-1 - len(suffix)])
         self.load_ttf(name, f[0], int(size), self.parse_format(format),
-                      botchar = int(botchar, 0),
+                      firstchar = int(firstchar, 0),
                       topchar = int(topchar, 0),
                       charset = charset)