From 55a2c4eaae521eabeee6c15cd17eb17de9b6afe5 Mon Sep 17 00:00:00 2001 From: Tianjie Xu Date: Thu, 29 Mar 2018 11:07:50 -0700 Subject: Remove the obsolete mkfont.c and font_10x18.h The font_10x18.h is used as a fall back for fonts if the $(recovery_font) under bootable/recovery/fonts failed to reload. This font looks very small on the screen and we haven't used it in a while. Plus, fonts in header doesn't have many benefits if we support only ascii characters. So we decide to remove this header along with the mkfont.c that generates the header. For reference, here's the steps to use mkfont: 1. Generate a picture of fonts with apps on host 2. Open the pic with GIMP 3. Export the pic as '.c' file, and rename it into '.h' file 4. Compile the generated '.h' file with mkfont.c Bug: 76420958 Test: build and check the recovery menu on angler Change-Id: I6c108aa43a07bf4994115ef764275bd84df725e1 --- minui/graphics.cpp | 37 +++++-------------------------------- 1 file changed, 5 insertions(+), 32 deletions(-) (limited to 'minui/graphics.cpp') diff --git a/minui/graphics.cpp b/minui/graphics.cpp index 56f471bce..202ce71fd 100644 --- a/minui/graphics.cpp +++ b/minui/graphics.cpp @@ -23,7 +23,6 @@ #include -#include "font_10x18.h" #include "graphics_adf.h" #include "graphics_drm.h" #include "graphics_fbdev.h" @@ -313,42 +312,16 @@ int gr_init_font(const char* name, GRFont** dest) { return 0; } -static void gr_init_font(void) { - int res = gr_init_font("font", &gr_font); - if (res == 0) { - return; - } - - printf("failed to read font: res=%d\n", res); - - // fall back to the compiled-in font. - gr_font = static_cast(calloc(1, sizeof(*gr_font))); - gr_font->texture = static_cast(malloc(sizeof(*gr_font->texture))); - gr_font->texture->width = font.width; - gr_font->texture->height = font.height; - gr_font->texture->row_bytes = font.width; - gr_font->texture->pixel_bytes = 1; - - unsigned char* bits = static_cast(malloc(font.width * font.height)); - gr_font->texture->data = bits; - - unsigned char data; - unsigned char* in = font.rundata; - while ((data = *in++)) { - memset(bits, (data & 0x80) ? 255 : 0, data & 0x7f); - bits += (data & 0x7f); - } - - gr_font->char_width = font.char_width; - gr_font->char_height = font.char_height; -} - void gr_flip() { gr_draw = gr_backend->Flip(); } int gr_init() { - gr_init_font(); + int ret = gr_init_font("font", &gr_font); + if (ret != 0) { + printf("Failed to init font: %d\n", ret); + return -1; + } auto backend = std::unique_ptr{ std::make_unique() }; gr_draw = backend->Init(); -- cgit v1.2.3