[PATCH] font: fbconsole: add custom font support

Sascha Hauer s.hauer at pengutronix.de
Fri Nov 13 00:36:36 PST 2015


Hi,

On Thu, Nov 12, 2015 at 02:13:25AM -0800, Du Huanpeng wrote:
> add custom font and charset support. useful for
> non ascii chars, e.g. Chinese and others.
> 
> Signed-off-by: Du Huanpeng <u74147 at gmail.com>
> ---
>  drivers/video/fbconsole.c   |  5 +++--
>  include/linux/font.h        | 11 ++++++++++-
>  lib/fonts/Kconfig           |  5 +++++
>  lib/fonts/Makefile          |  1 +
>  lib/fonts/font_7x14.c       |  1 +
>  lib/fonts/font_8x16.c       |  1 +
>  lib/fonts/font_custom_16x.c | 44 ++++++++++++++++++++++++++++++++++++++++++++
>  lib/fonts/font_mini_4x6.c   |  1 +
>  lib/fonts/fonts.c           | 32 ++++++++++++++++++++++++++++++++
>  9 files changed, 98 insertions(+), 3 deletions(-)
>  create mode 100644 lib/fonts/font_custom_16x.c

I just sent a patch to the list which makes it possible to register the
fonts during runtime rather than putting them into an array during
compile time. Could you rebase your patch on this one?
It will allow you to register your (real) custom font more easily.

> diff --git a/lib/fonts/font_7x14.c b/lib/fonts/font_7x14.c
> index fe99871..60cb57e 100644
> --- a/lib/fonts/font_7x14.c
> +++ b/lib/fonts/font_7x14.c
> @@ -4113,4 +4113,5 @@ const struct font_desc font_7x14 = {
>  	.width	= 7,
>  	.height	= 14,
>  	.data	= fontdata_7x14,
> +	.index	= NULL,
>  };

No need to do that. Uninitialized members will be NULL anyway.

> +#include <linux/font.h>
> +#include <common.h>
> +
> +/* place real font data here or set fontdata_custom_16x points to
> + * the address of font data and also setup the index.
> + */
> +
> +static const unsigned char fontdata_custom_16x[] = {
> +	0xFF, 0xFF,	/*OOOOOOOOOOOOOOOO*/
> +	0x80, 0x01,	/*O______________O*/
> +	0x80, 0x01,	/*O______________O*/
> +	0x80, 0x01,	/*O______________O*/
> +	0x80, 0x01,	/*O______________O*/
> +	0x80, 0x01,	/*O______________O*/
> +	0x80, 0x01,	/*O______________O*/
> +	0x80, 0x01,	/*O______________O*/
> +	0x80, 0x01,	/*O______________O*/
> +	0x80, 0x01,	/*O______________O*/
> +	0x80, 0x01,	/*O______________O*/
> +	0x80, 0x01,	/*O______________O*/
> +	0x80, 0x01,	/*O______________O*/
> +	0x80, 0x01,	/*O______________O*/
> +	0x80, 0x01,	/*O______________O*/
> +	0xFF, 0xFF,	/*OOOOOOOOOOOOOOOO*/
> +};

Instead of a completely dummy font maybe we could add some example
characters. Something enough for a chinese hello world maybe? Or some
emoticons.

Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



More information about the barebox mailing list