8000 Merge pull request #1979 from pewpew-game/font-boundingbox · losingrose/circuitpython@f76021e · GitHub
[go: up one dir, main page]

Skip to content

Commit f76021e

Browse files
authored
Merge pull request adafruit#1979 from pewpew-game/font-boundingbox
Use FONTBOUNDINGBOX for font metrics
2 parents f0a112e + 7c908b0 commit f76021e

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

tools/gen_display_resources.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ def _load_row(self, y, row):
2929
self.rows[y] = bytes(row)
3030

3131
f = bitmap_font.load_font(args.font, BitmapStub)
32-
real_bb = [0, 0]
3332

3433
# Load extra characters from the sample file.
3534
sample_characters = set()
@@ -61,13 +60,11 @@ def _load_row(self, y, row):
6160
print("Font missing character:", c, ord(c))
6261
filtered_characters = filtered_characters.replace(c, "")
6362
continue
64-
x, y, dx, dy = g["bounds"]
6563
if g["shift"][1] != 0:
6664
raise RuntimeError("y shift")
67-
real_bb[0] = max(real_bb[0], x - dx)
68-
real_bb[1] = max(real_bb[1], y - dy)
6965

70-
tile_x, tile_y = real_bb
66+
x, y, dx, dy = f.get_bounding_box()
67+
tile_x, tile_y = x - dx, y - dy
7168
total_bits = tile_x * len(all_characters)
7269
total_bits += 32 - total_bits % 32
7370
bytes_per_row = total_bits // 8

0 commit comments

Comments
 (0)
0