diff --git a/cmake/Bitmaps.cmake b/cmake/Bitmaps.cmake index 48b16f5a9..41a8589b6 100644 --- a/cmake/Bitmaps.cmake +++ b/cmake/Bitmaps.cmake @@ -41,7 +41,7 @@ macro(add_truetype_font_target name size subset effect args) OUTPUT ${target}.png ${target}.specs ${target}.lbm COMMAND ${PYTHON_EXECUTABLE} ${TOOLS_DIR}/build-font-bitmap.py --subset ${subset} --size ${size} --font ${font} --output ${target} COMMAND ${PYTHON_EXECUTABLE} ${UTILS_DIR}/bin2lbm.py ${target}.png ${target}.lbm - DEPENDS ${TOOLS_DIR}/build-font-bitmap.py ${TOOLS_DIR}/charset.py ${LIBOPENUI_TOOLS_DIR}/encode-bitmap.py ${RADIO_SRC_DIR}/translations/cn.h.txt ${RADIO_SRC_DIR}/fonts/extra_${size}px.png + DEPENDS ${TOOLS_DIR}/build-font-bitmap.py ${TOOLS_DIR}/charset.py ${LIBOPENUI_TOOLS_DIR}/encode-bitmap.py ) add_custom_target(truetype_font_${name} DEPENDS ${target}.png ${target}.specs) set(truetype_fonts_targets ${truetype_fonts_targets} truetype_font_${name}) diff --git a/radio/src/fonts/extra_13px.png b/radio/src/fonts/extra_13px.png deleted file mode 100644 index cbeb4758e..000000000 Binary files a/radio/src/fonts/extra_13px.png and /dev/null differ diff --git a/radio/src/fonts/extra_15px.png b/radio/src/fonts/extra_15px.png deleted file mode 100644 index cbeb4758e..000000000 Binary files a/radio/src/fonts/extra_15px.png and /dev/null differ diff --git a/radio/src/fonts/extra_24px.png b/radio/src/fonts/extra_24px.png deleted file mode 100644 index cbeb4758e..000000000 Binary files a/radio/src/fonts/extra_24px.png and /dev/null differ diff --git a/radio/src/fonts/extra_32px.png b/radio/src/fonts/extra_32px.png deleted file mode 100644 index cbeb4758e..000000000 Binary files a/radio/src/fonts/extra_32px.png and /dev/null differ diff --git a/radio/src/fonts/extra_64px.png b/radio/src/fonts/extra_64px.png deleted file mode 100644 index cbeb4758e..000000000 Binary files a/radio/src/fonts/extra_64px.png and /dev/null differ diff --git a/radio/src/fonts/extra_9px.png b/radio/src/fonts/extra_9px.png deleted file mode 100644 index cbeb4758e..000000000 Binary files a/radio/src/fonts/extra_9px.png and /dev/null differ diff --git a/tools/build-font-bitmap.py b/tools/build-font-bitmap.py index 7ad1a7181..be9f6b236 100755 --- a/tools/build-font-bitmap.py +++ b/tools/build-font-bitmap.py @@ -7,6 +7,7 @@ import sys from PIL import Image, ImageDraw, ImageFont from charset import get_chars, special_chars, extra_chars, standard_chars, is_cjk_char +EXTRA_BITMAP_MAX_WIDTH = 297 class FontBitmap: def __init__(self, language, font_size, font_name, foreground, background): @@ -17,7 +18,9 @@ class FontBitmap: self.background = background self.font = self.load_font(font_name) self.extra_bitmap = self.load_extra_bitmap() - #self.extra_bitmap = None + self.extra_bitmap_width = EXTRA_BITMAP_MAX_WIDTH + if self.extra_bitmap is not None: + self.extra_bitmap_width = self.extra_bitmap.width def load_extra_bitmap(self): try: @@ -63,7 +66,7 @@ class FontBitmap: (_,baseline), (offset_x, offset_y) = self.font.font.getsize(self.chars) (text_width, text_height) = self.get_text_dimensions(self.chars) - img_width = text_width + self.extra_bitmap.width + img_width = text_width + self.extra_bitmap_width image = Image.new("RGB", (img_width, text_height), self.background) draw = ImageDraw.Draw(image)