From: Kevin Du Huanpeng <u74147@gmail.com>
To: barebox@lists.infradead.org
Subject: [vedio] support no-ascii fonts?
Date: Fri, 23 Oct 2015 15:28:18 +0800 [thread overview]
Message-ID: <20151023072818.GA11271@L64> (raw)
[-- Attachment #1: Type: text/plain, Size: 2190 bytes --]
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,
};
[-- Attachment #2: font.diff --]
[-- Type: text/x-diff, Size: 1350 bytes --]
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,
};
[-- Attachment #3: Type: text/plain, Size: 149 bytes --]
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next reply other threads:[~2015-10-23 7:28 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-23 7:28 Kevin Du Huanpeng [this message]
2015-10-26 6:39 ` Sascha Hauer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20151023072818.GA11271@L64 \
--to=u74147@gmail.com \
--cc=barebox@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox