Denys Vlasenko ha scritto:
I think one line per char would be better:static const char fontmap[95][12] = { + //space (32) +{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
ok, done.
+#else + static FILE *fontmap_fd = NULL; +#endif +#endif Well, this forces you to handle FONTMAP_HARDCODED and not-HARDCODED very differently. Can you just define a pointer to char[12]? - +#else static char (*fontmap)[12]; +#endifThen you can just fontmap = xzalloc(sizeof(fontmap[0]) * 95),read font file into it, and use it exactly as you would use FONTMAP_HARDCODED one.
ok, done.
Redraw code which restores picture when new text is being printed is not elegant. Not that I have an ideal solution either.
I think that would not elegant redraw the entire background. I have only drawn the area affected by previous writing and this is simply necessary.
What's wrong in restoring the background?
I think non-controversial initial version may be one which simpy prints text WITHOUT restoring background. Just overwriting pixels which form letters. It will be more limited in functionality, yes. We can decide how to do "clean" rewrites later. It makes sense to start a thread about that with conceptual description how you'd implement it.
Suppose you want write two consecutive strings, the first "abcdefghilm" and the second "nopq". For the second write operation you get on the screen "nopqefghilm" which is not what you want.
If you deny the restoring of the background, this new functionality is completely useless.
Please, apply the attached patch to svn so the users can try it.
Regards.
--
Michele Sanges
diff -urP /tmp/acroread_0_0/busybox-1.12.0/include/usage.h
busybox-1.12.0/include/usage.h
--- /tmp/acroread_0_0/busybox-1.12.0/include/usage.h 2008-08-20
00:05:31.000000000 +0200
+++ busybox-1.12.0/include/usage.h 2008-09-21 23:58:08.000000000 +0200
@@ -128,7 +128,7 @@
"bar"
#define fbsplash_trivial_usage \
- "-s IMGFILE [-c] [-d DEV] [-i INIFILE] [-f CMD]"
+ "-s IMGFILE [-c] [-d DEV] [-i INIFILE] [-f CMD] [-m FONTMAPFILE]"
#define fbsplash_full_usage "\n\n" \
"Options:\n" \
"\n -s Image" \
@@ -137,8 +137,10 @@
"\n -i Config file (var=value):" \
"\n BAR_LEFT,BAR_TOP,BAR_WIDTH,BAR_HEIGHT" \
"\n BAR_R,BAR_G,BAR_B" \
+ "\n
TEXT_LEFT,TEXT_TOP,TEXT_R,TEXT_G,TEXT_B,TEXT_SIZE" \
"\n -f Control pipe (else exit after drawing image)" \
- "\n commands: 'NN' (% for progress bar) or 'exit'" \
+ "\n -m Font map file" \
+ "\n commands: 'NN' (% for progress bar),
'write:string to print' or 'exit'"
#define brctl_trivial_usage \
"COMMAND [BRIDGE [INTERFACE]]"
diff -urP /tmp/acroread_0_0/busybox-1.12.0/miscutils/Config.in
busybox-1.12.0/miscutils/Config.in
--- /tmp/acroread_0_0/busybox-1.12.0/miscutils/Config.in 2008-08-06
00:56:08.000000000 +0200
+++ busybox-1.12.0/miscutils/Config.in 2008-09-24 22:21:32.000000000 +0200
@@ -223,6 +223,34 @@
"NN" (ASCII decimal number) - percentage to show on progress bar
"exit" - well you guessed it
+config FBSPLASH_TEXT_RENDERING
+ bool "text rendering"
+ default n
+ depends on FBSPLASH
+ help
+ This option adds the ability to print text messages on the
+ image displayed by the fbsplash applet.
+ - command for fifo:
+ "write:string to print" - print the string after the word "write:"
+
+choice
+ prompt "Choose the font map"
+ depends on FBSPLASH_TEXT_RENDERING
+ default FONTMAP_HARDCODED
+
+config FONTMAP_HARDCODED
+ bool "hardcoded"
+ help
+ The font map is hard-coded to use the default font map.
+ Adds about 1.6Kb.
+
+config FONTMAP_DINAMICALLY_LOADED
+ bool "dinamically loaded"
+ help
+ The font map is dinamically loaded from a file.
+ Adds about 700 byte.
+endchoice
+
config INOTIFYD
bool "inotifyd"
default n
diff -urP /tmp/acroread_0_0/busybox-1.12.0/miscutils/fbsplash.c
busybox-1.12.0/miscutils/fbsplash.c
--- /tmp/acroread_0_0/busybox-1.12.0/miscutils/fbsplash.c 2008-08-06
00:56:08.000000000 +0200
+++ busybox-1.12.0/miscutils/fbsplash.c 2008-09-24 23:09:21.000000000 +0200
@@ -1,7 +1,6 @@
/* vi: set sw=4 ts=4: */
/*
- * Copyright (C) 2008 Michele Sanges <[EMAIL PROTECTED]>,
- * <[EMAIL PROTECTED]>
+ * Copyright (C) 2008 Michele Sanges <[EMAIL PROTECTED]>
*
* Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
*
@@ -14,11 +13,13 @@
* -s path_to_image_file (can be "-" for stdin)
* -i path_to_cfg_file
* -f path_to_fifo (can be "-" for stdin)
+ * -m font map file
* - if you want to run it only in presence of a kernel parameter
* (for example fbsplash=on), use:
* grep -q "fbsplash=on" </proc/cmdline && setsid fbsplash [params]
* - commands for fifo:
* "NN" (ASCII decimal number) - percentage to show on progress bar.
+ * "write:string to print" - print the string after the word "write:"
* "exit" (or just close fifo) - well you guessed it.
*/
@@ -38,7 +39,7 @@
FILE *logfile_fd; // log file
#endif
unsigned char *addr; // pointer to framebuffer memory
- unsigned ns[7]; // n-parameters
+ unsigned ns[13]; // n-parameters
const char *image_filename;
struct fb_var_screeninfo scr_var;
struct fb_fix_screeninfo scr_fix;
@@ -55,6 +56,12 @@
#define nbar_colr ns[4] // progress bar color red component
#define nbar_colg ns[5] // progress bar color green component
#define nbar_colb ns[6] // progress bar color blue component
+#define text_posx ns[7] // text horizontal position
+#define text_posy ns[8] // text vertical position
+#define text_colr ns[9] // text color red component
+#define text_colg ns[10] // text color green component
+#define text_colb ns[11] // text color blue component
+#define text_size ns[12] // text size (1 to 4)
#if DEBUG
#define DEBUG_MESSAGE(strMessage, args...) \
@@ -66,6 +73,206 @@
#define DEBUG_MESSAGE(...) ((void)0)
#endif
+#if ENABLE_FBSPLASH_TEXT_RENDERING
+
+#if ENABLE_FONTMAP_HARDCODED
+static char fontmap[95][12] = {
+ //space (32)
+{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
+ // ! (33)
+{0x00,0x80,0x80,0x80,0x80,0x80,0x00,0x80,0x00,0x00,0x00,0x00},
+ //" (34)
+{0x00,0xA0,0xA0,0xA0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
+ //# (35)
+{0x00,0x24,0x24,0x7E,0x28,0xFC,0x48,0x48,0x00,0x00,0x00,0x00},
+ //$ (36)
+{0x00,0x20,0x78,0xA0,0x60,0x30,0x28,0xF0,0x20,0x20,0x00,0x00},
+ //% (37)
+{0x00,0x64,0x98,0x98,0x7E,0x19,0x19,0x26,0x00,0x00,0x00,0x00},
+ //& (38)
+{0x00,0x60,0x90,0x90,0x68,0x90,0x98,0x64,0x00,0x00,0x00,0x00},
+ //' (39)
+{0x00,0x80,0x80,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
+ //( (40)
+{0x00,0x20,0x40,0x80,0x80,0x80,0x80,0x80,0x80,0x40,0x20,0x00},
+ //) (41)
+{0x00,0x80,0x40,0x20,0x20,0x20,0x20,0x20,0x20,0x40,0x80,0x00},
+ //* (42)
+{0x00,0x20,0xA8,0x70,0xA8,0x20,0x00,0x00,0x00,0x00,0x00,0x00},
+ //+ (43)
+{0x00,0x00,0x20,0x20,0xF8,0x20,0x20,0x00,0x00,0x00,0x00,0x00},
+ //, (44)
+{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x40,0x80,0x00},
+ //- (45)
+{0x00,0x00,0x00,0x00,0x00,0xC0,0x00,0x00,0x00,0x00,0x00,0x00},
+ //. (112)
+{0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x80,0x00,0x00,0x00,0x00},
+ // / (47)
+{0x00,0x20,0x20,0x40,0x40,0x40,0x40,0x40,0x80,0x80,0x00,0x00},
+ //0 (48)
+{0x00,0x60,0x90,0x90,0x90,0x90,0x90,0x60,0x00,0x00,0x00,0x00},
+ //1 (49)
+{0x00,0x40,0xC0,0x40,0x40,0x40,0x40,0xE0,0x00,0x00,0x00,0x00},
+ //2 (50)
+{0x00,0xE0,0x10,0x10,0x20,0x40,0x80,0xF0,0x00,0x00,0x00,0x00},
+ //3 (51)
+{0x00,0xE0,0x10,0x10,0x60,0x10,0x10,0xE0,0x00,0x00,0x00,0x00},
+ //4 (52)
+{0x00,0x10,0x30,0x50,0x90,0xF8,0x10,0x10,0x00,0x00,0x00,0x00},
+ //5 (53)
+{0x00,0xF0,0x80,0x80,0xE0,0x10,0x10,0xE0,0x00,0x00,0x00,0x00},
+ //6 (54)
+{0x00,0x60,0x80,0x80,0xE0,0x90,0x90,0x60,0x00,0x00,0x00,0x00},
+ //7 (55)
+{0x00,0xF0,0x10,0x20,0x20,0x40,0x40,0x80,0x00,0x00,0x00,0x00},
+ //8 (56)
+{0x00,0x60,0x90,0x90,0x60,0x90,0x90,0x60,0x00,0x00,0x00,0x00},
+ //9 (57)
+{0x00,0x60,0x90,0x90,0x70,0x10,0x10,0x60,0x00,0x00,0x00,0x00},
+ //: (58)
+{0x00,0x00,0x00,0x80,0x80,0x00,0x80,0x80,0x00,0x00,0x00,0x00},
+ //; (59)
+{0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x40,0x00,0x40,0x40,0x80},
+ //< (60)
+{0x00,0x00,0x00,0x08,0x70,0x80,0x70,0x08,0x00,0x00,0x00,0x00},
+ //= (61)
+{0x00,0x00,0x00,0x00,0xFC,0x00,0xFC,0x00,0x00,0x00,0x00,0x00},
+ //> (62)
+{0x00,0x00,0x00,0x80,0x70,0x08,0x70,0x80,0x00,0x00,0x00,0x00},
+ //? (63)
+{0x00,0xE0,0x10,0x10,0x20,0x40,0x00,0x40,0x00,0x00,0x00,0x00},
+ //@ (64)
+{0x00,0x38,0x44,0x9A,0xAA,0xAA,0x9C,0x40,0x38,0x00,0x00,0x00},
+ //A (65)
+{0x00,0x30,0x30,0x48,0x48,0xFC,0x84,0x84,0x00,0x00,0x00,0x00},
+ //B (66)
+{0x00,0xE0,0x90,0x90,0xF0,0x88,0x88,0xF0,0x00,0x00,0x00,0x00},
+ //C (67)
+{0x00,0x38,0x44,0x80,0x80,0x80,0x44,0x38,0x00,0x00,0x00,0x00},
+ //D (68)
+{0x00,0xF0,0x88,0x84,0x84,0x84,0x88,0xF0,0x00,0x00,0x00,0x00},
+ //E (69)
+{0x00,0xF8,0x80,0x80,0xF0,0x80,0x80,0xF8,0x00,0x00,0x00,0x00},
+ //F (70)
+{0x00,0xF8,0x80,0x80,0xF0,0x80,0x80,0x80,0x00,0x00,0x00,0x00},
+ //G (71)
+{0x00,0x38,0x44,0x80,0x9C,0x84,0x44,0x3C,0x00,0x00,0x00,0x00},
+ //H (72)
+{0x00,0x84,0x84,0x84,0xFC,0x84,0x84,0x84,0x00,0x00,0x00,0x00},
+ //I (73)
+{0x00,0xE0,0x40,0x40,0x40,0x40,0x40,0xE0,0x00,0x00,0x00,0x00},
+ //J (74)
+{0x00,0x60,0x20,0x20,0x20,0x20,0x20,0xC0,0x00,0x00,0x00,0x00},
+ //K (75)
+{0x00,0x88,0x90,0xA0,0xC0,0xA0,0x90,0x88,0x00,0x00,0x00,0x00},
+ //L (76)
+{0x00,0x80,0x80,0x80,0x80,0x80,0x80,0xF0,0x00,0x00,0x00,0x00},
+ //M (77)
+{0x00,0xC6,0xC6,0xAA,0xAA,0x92,0x92,0x82,0x00,0x00,0x00,0x00},
+ //N (78)
+{0x00,0x84,0xC4,0xA4,0x94,0x8C,0x84,0x84,0x00,0x00,0x00,0x00},
+ //O (79)
+{0x00,0x38,0x44,0x82,0x82,0x82,0x44,0x38,0x00,0x00,0x00,0x00},
+ //P (80)
+{0x00,0xF0,0x88,0x88,0x88,0xF0,0x80,0x80,0x00,0x00,0x00,0x00},
+ //Q (81)
+{0x00,0x38,0x44,0x82,0x82,0x82,0x44,0x38,0x08,0x06,0x00,0x00},
+ //R (82)
+{0x00,0xF0,0x88,0x88,0xF0,0xA0,0x90,0x88,0x00,0x00,0x00,0x00},
+ //S (83)
+{0x00,0x78,0x80,0x80,0x70,0x08,0x08,0xF0,0x00,0x00,0x00,0x00},
+ //T (84)
+{0x00,0xF8,0x20,0x20,0x20,0x20,0x20,0x20,0x00,0x00,0x00,0x00},
+ //U (85)
+{0x00,0x84,0x84,0x84,0x84,0x84,0x84,0x78,0x00,0x00,0x00,0x00},
+ //V (86)
+{0x00,0x84,0x84,0x84,0x48,0x48,0x30,0x30,0x00,0x00,0x00,0x00},
+ //W (87)
+{0x00,0x92,0x92,0xAA,0xAA,0xAA,0x44,0x44,0x00,0x00,0x00,0x00},
+ //X (88)
+{0x00,0x90,0x90,0x60,0x60,0x60,0x90,0x90,0x00,0x00,0x00,0x00},
+ //Y (89)
+{0x00,0x88,0x50,0x50,0x20,0x20,0x20,0x20,0x00,0x00,0x00,0x00},
+ //Z (90)
+{0x00,0xF0,0x10,0x20,0x40,0x40,0x80,0xF0,0x00,0x00,0x00,0x00},
+ //[ (91)
+{0x00,0xC0,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0xC0,0x00},
+ //\ (92)
+{0x00,0x80,0x80,0x40,0x40,0x40,0x40,0x40,0x20,0x20,0x00,0x00},
+ //] (93)
+{0x00,0xC0,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0xC0,0x00},
+ //^ (94)
+{0x00,0x20,0x50,0x88,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
+ //_ (95)
+{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF0,0x00,0x00},
+ // (32)
+{0x00,0x80,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
+ //a (97)
+{0x00,0x00,0x00,0x60,0x10,0x70,0x90,0x70,0x00,0x00,0x00,0x00},
+ //b (98)
+{0x80,0x80,0x80,0xE0,0x90,0x90,0x90,0xE0,0x00,0x00,0x00,0x00},
+ //c (99)
+{0x00,0x00,0x00,0x60,0x80,0x80,0x80,0x60,0x00,0x00,0x00,0x00},
+ //d (100)
+{0x10,0x10,0x10,0x70,0x90,0x90,0x90,0x70,0x00,0x00,0x00,0x00},
+ //e (101)
+{0x00,0x00,0x00,0x60,0x90,0xF0,0x80,0x70,0x00,0x00,0x00,0x00},
+ //f (102)
+{0x60,0x80,0x80,0xE0,0x80,0x80,0x80,0x80,0x00,0x00,0x00,0x00},
+ //g (103)
+{0x00,0x00,0x00,0x70,0x90,0x90,0x90,0x70,0x10,0x60,0x00,0x00},
+ //h (104)
+{0x80,0x80,0x80,0xE0,0x90,0x90,0x90,0x90,0x00,0x00,0x00,0x00},
+ //i (105)
+{0x00,0x80,0x00,0x80,0x80,0x80,0x80,0x80,0x00,0x00,0x00,0x00},
+ //j (106)
+{0x00,0x40,0x00,0xC0,0x40,0x40,0x40,0x40,0x40,0x80,0x00,0x00},
+ //k (107)
+{0x80,0x80,0x80,0x90,0xA0,0xC0,0xA0,0x90,0x00,0x00,0x00,0x00},
+ //l (108)
+{0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x00,0x00,0x00,0x00},
+ //m (109)
+{0x00,0x00,0x00,0xEC,0x92,0x92,0x92,0x92,0x00,0x00,0x00,0x00},
+ //n (110)
+{0x00,0x00,0x00,0xE0,0x90,0x90,0x90,0x90,0x00,0x00,0x00,0x00},
+ //o (111)
+{0x00,0x00,0x00,0x60,0x90,0x90,0x90,0x60,0x00,0x00,0x00,0x00},
+ //p (112)
+{0x00,0x00,0x00,0xE0,0x90,0x90,0x90,0xE0,0x80,0x80,0x00,0x00},
+ //q (113)
+{0x00,0x00,0x00,0x70,0x90,0x90,0x90,0x70,0x10,0x10,0x00,0x00},
+ //r (114)
+{0x00,0x00,0x00,0xA0,0xC0,0x80,0x80,0x80,0x00,0x00,0x00,0x00},
+ //s (115)
+{0x00,0x00,0x00,0xE0,0x80,0x40,0x20,0xE0,0x00,0x00,0x00,0x00},
+ //t (116)
+{0x00,0x00,0x80,0xC0,0x80,0x80,0x80,0x40,0x00,0x00,0x00,0x00},
+ //u (117)
+{0x00,0x00,0x00,0x90,0x90,0x90,0x90,0x70,0x00,0x00,0x00,0x00},
+ //v (118)
+{0x00,0x00,0x00,0x88,0x50,0x50,0x50,0x20,0x00,0x00,0x00,0x00},
+ //w (119)
+{0x00,0x00,0x00,0x92,0x92,0xAA,0x6C,0x44,0x00,0x00,0x00,0x00},
+ //x (120)
+{0x00,0x00,0x00,0xA0,0x40,0x40,0x40,0xA0,0x00,0x00,0x00,0x00},
+ //y (121)
+{0x00,0x00,0x00,0x88,0x50,0x50,0x50,0x20,0x20,0x40,0x00,0x00},
+ //z (122)
+{0x00,0x00,0x00,0xE0,0x20,0x40,0x80,0xE0,0x00,0x00,0x00,0x00},
+ //{ (123)
+{0x00,0x20,0x40,0x40,0x40,0x40,0x80,0x40,0x40,0x40,0x20,0x00},
+ //| (124)
+{0x00,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x00},
+ //} (125)
+{0x00,0x80,0x40,0x40,0x40,0x40,0x20,0x40,0x40,0x40,0x80,0x00},
+ //~ (126)
+{0x00,0x60,0x90,0x90,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00}};
+
+#else
+ static char (*fontmap)[12];
+#endif
+#endif
+
/**
* Open and initialize the framebuffer device
@@ -213,9 +420,13 @@
/**
- * Draw image from PPM file
+ * Draws a PPM image.
+ * \param nXPos horizontal position from which draw the image.
+ * \param nYPos vertical position from which draw the image. With nXPos=-1 and
nYPos=-1, draws the full image.
+ * \param nXDim horizontal dimension of the image section to draw.
+ * \param nYDim vertical dimension of the image section to draw.
*/
-static void fb_drawimage(void)
+static void fb_drawimage(int nXPos, int nYPos, int nXDim, int nYDim)
{
char head[256];
char s[80];
@@ -254,13 +465,29 @@
height = G.scr_var.yres;
pixline = xmalloc(line_size);
- for (j = 0; j < height; j++) {
- unsigned char *pixel = pixline;
- DATA *src = (DATA *)(G.addr + j * G.scr_fix.line_length);
+
+ if (nYPos == -1) {
+ nYPos = 0;
+ }
+ else {
+ fseek(theme_file, line_size * nYPos, SEEK_CUR);
+ height = nYPos + nYDim;
+ }
+
+ if (nXPos == -1) {
+ nXPos = 0;
+ }
+ else {
+ width = nXPos + nXDim;
+ }
+
+ for (j = nYPos; j < height; j++) {
+ unsigned char *pixel = pixline + 3 * nXPos;
+ DATA *src = (DATA *)(G.addr + (j * G.scr_var.xres + nXPos) *
BYTES_PER_PIXEL);
if (fread(pixline, 1, line_size, theme_file) != line_size)
bb_error_msg_and_die("bad PPM file '%s'",
G.image_filename);
- for (i = 0; i < width; i++) {
+ for (i = nXPos; i < width; i++) {
unsigned thispix;
thispix = (((unsigned)pixel[0] << 8) & 0xf800)
| (((unsigned)pixel[1] << 3) & 0x07e0)
@@ -274,6 +501,73 @@
}
+#if ENABLE_FBSPLASH_TEXT_RENDERING
+/**
+ * Draws a single character on framebuffer.
+ * \param nXPos horizontal position from which draw the character.
+ * \param nYPos vertical position from which draw the character.
+ * \param nCharSize character scale factor [1..4].
+ * \param nChar character to draw.
+ */
+static void fb_drawchar(int nXPos, int nYPos, int nCharSize, int nChar)
+{
+ unsigned char nred, ngreen, nblue;
+ DATA *ptr, thispix;
+
+ nred = G.text_colr;
+ ngreen = G.text_colg;
+ nblue = G.text_colb;
+
+ nred >>= 3; // 5-bit red
+ ngreen >>= 2; // 6-bit green
+ nblue >>= 3; // 5-bit blue
+ thispix = nblue + (ngreen << 5) + (nred << (5+6));
+
+ for (int nHeight = 0; nHeight < 12 * nCharSize; nHeight++) {
+ for (int nWidth = 0; nWidth < 8 * nCharSize; nWidth++) {
+ if ((fontmap[nChar - 32][nHeight / nCharSize] & (0x80
>> (nWidth / nCharSize))) != 0) {
+ ptr = (DATA*)(G.addr + ((nYPos + nHeight) *
G.scr_var.xres + (nXPos + nWidth)) * BYTES_PER_PIXEL);
+ *ptr = thispix;
+ }
+ }
+ }
+}
+
+
+/**
+ * Draws a string on framebuffer.
+ * \param *strString pointer to the string.
+ */
+static void fb_drawstring(char *strString)
+{
+ int nCharSize;
+ static int nOldCharSize = -1;
+ static int nOldStringSize = -1; // in pixel
+
+ // size check
+ nCharSize = G.text_size;
+ if (nCharSize < 1)
+ nCharSize = 1;
+ else if (nCharSize > 4)
+ nCharSize = 4;
+
+ // redraws the portion of image interested to the old write operation
+ if (nOldStringSize != -1) {
+ fb_drawimage(G.text_posx, G.text_posy, nOldStringSize, 12 *
nCharSize);
+ }
+
+ // new write operation
+ for (int nCharNum = 0; nCharNum < strlen(strString); nCharNum++) {
+ char c = *(strString + nCharNum);
+ fb_drawchar(G.text_posx + 8 * nCharSize * nCharNum,
G.text_posy, nCharSize, c);
+ }
+
+ nOldCharSize = nCharSize;
+ nOldStringSize = 8 * nCharSize * strlen(strString);
+}
+
+#endif
+
/**
* Parse configuration file
* \param *cfg_filename name of the configuration file
@@ -284,6 +578,7 @@
"BAR_WIDTH\0" "BAR_HEIGHT\0"
"BAR_LEFT\0" "BAR_TOP\0"
"BAR_R\0" "BAR_G\0" "BAR_B\0"
+ "TEXT_LEFT\0" "TEXT_TOP\0" "TEXT_R\0" "TEXT_G\0" "TEXT_B\0"
"TEXT_SIZE\0"
#if DEBUG
"DEBUG\0"
#endif
@@ -296,10 +591,10 @@
int i = index_in_strings(param_names, token[0]);
if (i < 0)
bb_error_msg_and_die("syntax error: '%s'", token[0]);
- if (i >= 0 && i < 7)
+ if (i >= 0 && i < 13)
G.ns[i] = val;
#if DEBUG
- if (i == 7) {
+ if (i == 13) {
G.bdebug_messages = val;
if (G.bdebug_messages)
G.logfile_fd =
xfopen_for_write("/tmp/fbsplash.log");
@@ -313,7 +608,11 @@
int fbsplash_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
int fbsplash_main(int argc UNUSED_PARAM, char **argv)
{
+#if ENABLE_FONTMAP_DINAMICALLY_LOADED
+ const char *fontmap_filename = NULL;
+#endif
const char *fb_device, *cfg_filename, *fifo_filename;
+
FILE *fp = fp; // for compiler
char *num_buf;
unsigned num;
@@ -325,9 +624,21 @@
fb_device = "/dev/fb0";
cfg_filename = NULL;
fifo_filename = NULL;
+
+#if ENABLE_FONTMAP_DINAMICALLY_LOADED
+ bCursorOff = 1 & getopt32(argv, "cs:d:i:f:m:",
+ &G.image_filename, &fb_device, &cfg_filename,
&fifo_filename, &fontmap_filename);
+
+ if (fontmap_filename) {
+ FILE *fontmap_fd = xfopen_stdin(fontmap_filename);
+ fontmap = xzalloc(sizeof(fontmap[0]) * 95);
+ fread(fontmap[0], 1, sizeof(fontmap[0]) * 95, fontmap_fd);
+ fclose_if_not_stdin(fontmap_fd);
+ }
+#else
bCursorOff = 1 & getopt32(argv, "cs:d:i:f:",
&G.image_filename, &fb_device, &cfg_filename,
&fifo_filename);
-
+#endif
// parse configuration file
if (cfg_filename)
init(cfg_filename);
@@ -343,7 +654,7 @@
full_write(STDOUT_FILENO, "\x1b" "[?25l", 6);
}
- fb_drawimage();
+ fb_drawimage(-1, -1, -1, -1);
if (!fifo_filename)
return EXIT_SUCCESS;
@@ -374,6 +685,12 @@
DEBUG_MESSAGE("exit");
break;
}
+#if ENABLE_FBSPLASH_TEXT_RENDERING
+ else if (strncmp(num_buf, "write:", 6) == 0) {
+ fb_drawstring(num_buf + 6);
+ continue;
+ }
+#endif
num = atoi(num_buf);
if (isdigit(num_buf[0]) && (num <= 100)) {
#if DEBUG
@@ -386,6 +703,10 @@
free(num_buf);
}
+#if ENABLE_FONTMAP_DINAMICALLY_LOADED
+ free(fontmap);
+#endif
+
if (bCursorOff) // restore cursor
full_write(STDOUT_FILENO, "\x1b" "[?25h", 6);
diff -urP /tmp/acroread_0_0/busybox-1.12.0/miscutils/fbsplash.cfg
busybox-1.12.0/miscutils/fbsplash.cfg
--- /tmp/acroread_0_0/busybox-1.12.0/miscutils/fbsplash.cfg 2008-08-06
00:56:08.000000000 +0200
+++ busybox-1.12.0/miscutils/fbsplash.cfg 2008-09-21 15:35:41.000000000
+0200
@@ -7,3 +7,13 @@
BAR_R=80
BAR_G=80
BAR_B=130
+# the below settings are active only if you enable the option
FBSPLASH_TEXT_RENDERING
+# text position
+TEXT_LEFT=100
+TEXT_TOP=350
+# text color
+TEXT_R=80
+TEXT_G=80
+TEXT_B=130
+# text size (1 to 4)
+TEXT_SIZE=2
fbsplash_fontmap
Description: Binary data
_______________________________________________ busybox mailing list [email protected] http://busybox.net/cgi-bin/mailman/listinfo/busybox
