From d85e485c5892f2d96e8c5d10828c13af154a5481 Mon Sep 17 00:00:00 2001 From: Paul Kocialkowski Date: Sun, 23 Jul 2017 16:05:47 +0300 Subject: libpayload: video: Add support for font scaling with a factor This introduces support for font scaling with a factor provided via Kconfig. In practice, the font itself is not scaled at any point in memory and only the logic to determine whether a pixel should be filled or not is changed. Thus, it should not significantly impact either the access time or memory use. Change-Id: Idff210617c9ec08c6034aef107cfdb34c7cdf029 Signed-off-by: Paul Kocialkowski Reviewed-on: https://review.coreboot.org/20709 Tested-by: build bot (Jenkins) Reviewed-by: Julius Werner --- payloads/libpayload/drivers/video/font.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'payloads/libpayload/drivers/video/font.c') diff --git a/payloads/libpayload/drivers/video/font.c b/payloads/libpayload/drivers/video/font.c index 59d476dacf..8758a9646e 100644 --- a/payloads/libpayload/drivers/video/font.c +++ b/payloads/libpayload/drivers/video/font.c @@ -27,14 +27,22 @@ * SUCH DAMAGE. */ +#include #include "font8x16.h" #include "font.h" +#define COLS_MIN 130 + int font_width; int font_height; +int font_scale; -void font_init(void) +void font_init(int width) { - font_width = FONT_WIDTH; - font_height = FONT_HEIGHT; + font_scale = CONFIG_LP_FONT_SCALE_FACTOR; + if (!font_scale) + font_scale = MAX(width / (FONT_WIDTH * COLS_MIN), 1); + + font_width = FONT_WIDTH * font_scale; + font_height = FONT_HEIGHT * font_scale; } -- cgit v1.2.3