[vedio] support no-ascii fonts?
Kevin Du Huanpeng
u74147 at gmail.com
Fri Oct 23 00:28:18 PDT 2015
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.*/
};
diff --git a/include/linux/font.h b/include/linux/font.h
index 62b1879..885935f 100644
--- a/include/linux/font.h
+++ b/include/linux/font.h
@@ -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,
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,
};
diff --git a/lib/fonts/font_8x16.c b/lib/fonts/font_8x16.c
index 4717ead..0ba2921 100644
--- a/lib/fonts/font_8x16.c
+++ b/lib/fonts/font_8x16.c
@@ -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);
diff --git a/lib/fonts/font_mini_4x6.c b/lib/fonts/font_mini_4x6.c
index 3ecb4fb..733d20a 100644
--- a/lib/fonts/font_mini_4x6.c
+++ b/lib/fonts/font_mini_4x6.c
@@ -2152,4 +2152,5 @@ const struct font_desc font_mini_4x6 = {
.width = 4,
.height = 6,
.data = fontdata_mini_4x6,
+ .index = NULL,
};
-------------- next part --------------
A non-text attachment was scrubbed...
Name: font.diff
Type: text/x-diff
Size: 1350 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/barebox/attachments/20151023/1e12966e/attachment.bin>
More information about the barebox
mailing list