support no-ascii fonts?
Hi, How about add a index before get fontdata?
so, we will able to support non-ascii fonts.
like:
drivers/video/fbconsole.c
--> static void drawchar(struct fbc_priv *priv, int x, int y, char c)
{
...
- inbuf = &priv->fontdata[c * priv->font_height];
+ if(priv->index) {
+ inbuf = look up index in the table.
+ }
+ else {
+ inbuf = &priv->fontdata[c * priv->font_height];
+ }
the index table like:
struct font_index fontname_index = {
{ 0xXXXX, 0xYYYY }, /* where, 0xXXXX is the unioncode of the char */
{ 0xXXXX, 0xYYYY }, /* the 0xYYYY is the index of the fontdata array. */
{ 0xXXXX, 0xYYYY }, /* normally, we don't need a full char set. */
{ 0xXXXX, 0xYYYY }, /* just put the used chars in the table. */
{ 0xXXXX, 0xYYYY }, /* we also have a tool to generate fontdata array.*/
};include/linux/font.h +7 -0
@@ -12,11 +12,18 @@#define _VIDEO_FONT_H#include <param.h> +#include <wchar.h> + +struct font_index { +wchar_t wch; +short index; +};struct font_desc {const char *name;int width, height;const void *data; +const struct font_index *index; }; extern const struct font_desc font_vga_8x16,
lib/fonts/font_7x14.c +1 -0
@@ -4113,4 +4113,5 @@ const struct font_desc font_7x14 = { .width = 7, .height = 14, .data = fontdata_7x14, + .index = NULL, };
lib/fonts/font_8x16.c +1 -0
@@ -4626,5 +4626,6 @@ const struct font_desc font_vga_8x16 = { .width = 8, .height = 16, .data = fontdata_8x16, + .index = NULL, };EXPORT_SYMBOL (font_vga_8x16);
lib/fonts/font_mini_4x6.c +1 -0
@@ -2152,4 +2152,5 @@ const struct font_desc font_mini_4x6 = { .width = 4, .height = 6, .data = fontdata_mini_4x6, + .index = NULL, };
include/linux/font.h +7 -0
@@ -12,11 +12,18 @@#define _VIDEO_FONT_H#include <param.h> +#include <wchar.h> + +struct font_index { +wchar_t wch; +short index; +};struct font_desc {const char *name;int width, height;const void *data; +const struct font_index *index; }; extern const struct font_desc font_vga_8x16,
lib/fonts/font_7x14.c +1 -0
@@ -4113,4 +4113,5 @@ const struct font_desc font_7x14 = { .width = 7, .height = 14, .data = fontdata_7x14, + .index = NULL, };
lib/fonts/font_8x16.c +1 -0
@@ -4626,5 +4626,6 @@ const struct font_desc font_vga_8x16 = { .width = 8, .height = 16, .data = fontdata_8x16, + .index = NULL, };EXPORT_SYMBOL (font_vga_8x16);
lib/fonts/font_mini_4x6.c +1 -0
@@ -2152,4 +2152,5 @@ const struct font_desc font_mini_4x6 = { .width = 4, .height = 6, .data = fontdata_mini_4x6, + .index = NULL, };
_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
Hi Kevin,
Quoted 14 lines · Kevin Du Huanpeng
Hi, How about add a index before get fontdata?
so, we will able to support non-ascii fonts.
like:drivers/video/fbconsole.c --> static void drawchar(struct fbc_priv *priv, int x, int y, char c) { ... - inbuf = &priv->fontdata[c * priv->font_height]; + if(priv->index) { + inbuf = look up index in the table. + } + else { + inbuf = &priv->fontdata[c * priv->font_height]; + }
Quoted 8 lines
the index table like:
struct font_index fontname_index = { { 0xXXXX, 0xYYYY }, /* where, 0xXXXX is the unioncode of the char */ { 0xXXXX, 0xYYYY }, /* the 0xYYYY is the index of the fontdata array. */ { 0xXXXX, 0xYYYY }, /* normally, we don't need a full char set. */ { 0xXXXX, 0xYYYY }, /* just put the used chars in the table. */ { 0xXXXX, 0xYYYY }, /* we also have a tool to generate fontdata array.*/ };
If you want to support non-ascii fonts then why don't you simply add one? Or is your concern that too much binary size is used when you only need a small fraction of a font but you always have to provide 256 chars?
Sascha
Signature · 9 lines
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 | _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox