mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [vedio] support no-ascii fonts?
@ 2015-10-23  7:28 Kevin Du Huanpeng
  2015-10-26  6:39 ` Sascha Hauer
  0 siblings, 1 reply; 2+ messages in thread
From: Kevin Du Huanpeng @ 2015-10-23  7:28 UTC (permalink / raw)
  To: barebox

[-- 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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-10-26  6:39 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-23  7:28 [vedio] support no-ascii fonts? Kevin Du Huanpeng
2015-10-26  6:39 ` Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox