1
0
Fork 0
mirror of https://github.com/EdgeTX/edgetx.git synced 2025-07-15 12:25:11 +03:00

Cosmetics

This commit is contained in:
Bertrand Songis 2019-12-09 17:28:35 +01:00
parent eb927f4be2
commit d4e7058b12
No known key found for this signature in database
GPG key ID: F189F79290FEC50F
2 changed files with 9 additions and 11 deletions

@ -1 +1 @@
Subproject commit 88e88841555a6e105e973b8666288999928fb290 Subproject commit 08ebd5c62e8968e9bad2a73a6511113b0fb35cbb

View file

@ -88,28 +88,26 @@ class FontBitmap:
def generate(self, filename, generate_coords_file=True): def generate(self, filename, generate_coords_file=True):
coords = [] coords = []
image = Image.new("RGB", (len(self.chars) * self.font_size, self.font_size + 10), self.background) image = Image.new("RGB", (len(self.chars) * self.font_size + 200, self.font_size + 20), self.background)
width = 0 width = 0
for c in self.chars: for c in self.chars:
coords.append(width) coords.append(width)
if c in extra_chars: if c == " ":
if self.extra_bitmap and c == extra_chars[0]:
if self.font_size == 16:
offset = 1
else:
offset = self.font_size % 2
image.paste(self.extra_bitmap.copy(), (width, offset))
elif c == " ":
width += 4 width += 4
elif c in special_chars["cn"]: elif c in special_chars["cn"]:
width += self.draw_char(image, width, c, self.cjk_font) width += self.draw_char(image, width, c, self.cjk_font)
else: elif c not in extra_chars:
width += self.draw_char(image, width, c, self.font) width += self.draw_char(image, width, c, self.font)
coords.append(width) coords.append(width)
_, top, _, bottom = self.get_real_size(image) _, top, _, bottom = self.get_real_size(image)
if self.extra_bitmap:
image.paste(self.extra_bitmap.copy(), (width, top))
width += self.extra_bitmap.width
image = image.crop((0, top, width, bottom)) image = image.crop((0, top, width, bottom))
coords.insert(0, bottom - top) coords.insert(0, bottom - top)