[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#486933: bogl: should support enter_bold_mode



tags 486933 + patch
thanks

Here is a patch that does that (and actually fixes some missing colors
in the regular debian installer).

Samuel
diff -ur bogl-0.1.18/bogl-term.c bogl-0.1.18-mine/bogl-term.c
--- bogl-0.1.18/bogl-term.c	2003-11-05 04:38:22.000000000 +0000
+++ bogl-0.1.18-mine/bogl-term.c	2008-06-19 03:17:04.000000000 +0100
@@ -53,6 +53,7 @@
   term->fg = term->def_fg = 0;
   term->bg = term->def_bg = 7;
   term->rev = 0;
+  term->bold = 0;
   term->state = 0;
   term->cur_visible = 1;
   memset(&term->ps, 0, sizeof(&term->ps));
@@ -62,12 +63,14 @@
   term->screenfg = malloc(term->xsize * term->ysize * sizeof(int));
   term->screenbg = malloc(term->xsize * term->ysize * sizeof(int));
   term->screenul = malloc(term->xsize * term->ysize * sizeof(int));
+  term->screenbd = malloc(term->xsize * term->ysize * sizeof(int));
   term->cchars = malloc(term->xsize * term->ysize * sizeof(wchar_t *));
-  if (!term->screen || !term->screenfg || !term->screenbg || !term->screenul || !term->cchars || !term->dirty) {
+  if (!term->screen || !term->screenfg || !term->screenbg || !term->screenul || !term->screenbd || !term->cchars || !term->dirty) {
     free(term->screen);
     free(term->screenfg);
     free(term->screenbg);
     free(term->screenul);
+    free(term->screenbd);
     free(term->cchars);
     free(term->dirty);
     free(term);
@@ -78,6 +81,7 @@
     term->screenfg[i] = term->def_fg;
     term->screenbg[i] = term->def_bg;
     term->screenul[i] = 0;
+    term->screenbd[i] = 0;
     term->cchars[i] = 0;
     term->dirty[i] = 1;
   }
@@ -102,6 +106,8 @@
     	return 0;
     if(term->screenul[p1] != term->screenul[p2])
     	return 0;
+    if(term->screenbd[p1] != term->screenbd[p2])
+    	return 0;
     return 1;
 }
 
@@ -115,6 +121,8 @@
     	return 0;
     if(term->screenul[p1] != 0)
     	return 0;
+    if(term->screenbd[p1] != 0)
+    	return 0;
     return 1;
 }
 
@@ -190,6 +198,7 @@
         term->screenfg[p] = term->fg;
         term->screenbg[p] = term->bg;
         term->screenul[p] = 0;
+        term->screenbd[p] = 0;
         term->dirty[p] = 1;
         free (term->cchars[p]);
         term->cchars[p] = 0;
@@ -198,11 +207,14 @@
 
 static void
 put_char (struct bogl_term *term, int x, int y, wchar_t wc, wchar_t *cchars,
-	  int fg, int bg, int ul)
+	  int fg, int bg, int ul, int bd)
 {
     char buf[MB_LEN_MAX];
     int j, k, r, w;
 
+    if (bd)
+        fg += 8;
+
     wctomb(0, 0);
     if ((k = wctomb(buf, wc)) == -1)
         return;
@@ -247,7 +259,7 @@
             fg = term->screenbg[i], bg = term->screenfg[i];
         else
             fg = term->screenfg[i], bg = term->screenbg[i];
-        put_char(term, x, term->ypos, term->screen[i], term->cchars[i], fg, bg, term->screenul[i]);
+        put_char(term, x, term->ypos, term->screen[i], term->cchars[i], fg, bg, term->screenul[i], term->screenbd[i]);
         term->dirty[SCR(x, term->ypos)] = 1;
     }
 }
@@ -295,6 +307,7 @@
       term->screenfg[i] = term->fg;
       term->screenbg[i] = term->bg;
       term->screenul[i] = 0;
+      term->screenbd[i] = 0;
     }
   free (term->cchars[i]);
   term->cchars[i] = 0;
@@ -445,6 +458,7 @@
                         term->screenfg[i] = term->fg;
                         term->screenbg[i] = term->bg;
                         term->screenul[i] = 0;
+                        term->screenbd[i] = 0;
                         term->cchars[i] = 0;
                         term->dirty[i] = 1;
                     }
@@ -518,6 +532,7 @@
 	                    term->screenfg[i] = term->fg;
 	                    term->screenbg[i] = term->bg;
 	                    term->screenul[i] = 0;
+	                    term->screenbd[i] = 0;
 	                }
                         free (term->cchars[i]);
                         term->cchars[i] = 0;
@@ -551,6 +566,7 @@
                             term->screenfg[i] = term->fg;
                             term->screenbg[i] = term->bg;
                             term->screenul[i] = 0;
+                            term->screenbd[i] = 0;
                         }
                         free (term->cchars[i]);
                         term->cchars[i] = 0;
@@ -593,9 +609,12 @@
                     term->rev = 1;
                 else if (term->arg[0] == 27)
                     term->rev = 0;
+                else if (term->arg[0] == 1)
+                    term->bold = 1;
                 else if (term->arg[0] == 0)
                 {
                     term->rev = 0;
+                    term->bold = 0;
                     term->fg = term->def_fg;
                     term->bg = term->def_bg;
                 }
@@ -704,6 +723,7 @@
                             term->screenfg[i] = term->fg;
                             term->screenbg[i] = term->bg;
                             term->screenul[i] = 0;
+                            term->screenbd[i] = 0;
                         }
                         free (term->cchars[i]);
                         term->cchars[i] = NULL;
@@ -720,6 +740,7 @@
                 term->screenfg[i] = f;
                 term->screenbg[i] = b;
                 term->screenul[i] = term->ul;
+                term->screenbd[i] = term->bold;
                 free (term->cchars[i]);
                 term->cchars[i] = NULL;
 
@@ -730,6 +751,7 @@
                     term->screenfg[i + j] = f;
                     term->screenbg[i + j] = b;
                     term->screenul[i + j] = 0;
+                    term->screenbd[i + j] = 0;
                 }
 
                 if (bogl_in_font (term->font, wc))
@@ -757,12 +779,12 @@
             if (txp >= 0)
             {
                 term->xp = txp;
-//                bogl_text (XPOS (term->xp), YPOS (term->yp), buf, kk, f, -1, term->ul, term->font);
+//                bogl_text (XPOS (term->xp), YPOS (term->yp), buf, kk, f + (term->bd ? 8 : 0), -1, term->ul, term->font);
             }
             else
             {
                 clear_left (term);
-//                bogl_text (XPOS (term->xpos), YPOS (term->ypos), buf, kk, f, b, term->ul, term->font);
+//                bogl_text (XPOS (term->xpos), YPOS (term->ypos), buf, kk, f + (term->bd ? 8 : 0), b, term->ul, term->font);
                 term->xp = term->xpos, term->yp = term->ypos;
                 term->xpos += 1;
                 clear_right (term);
@@ -788,7 +810,7 @@
             i = SCR(x, y);
             if (term->screen[i] && term->dirty[i])
             {
-                put_char(term, x, y, term->screen[i], term->cchars[i], term->screenfg[i], term->screenbg[i], term->screenul[i]);
+                put_char(term, x, y, term->screen[i], term->cchars[i], term->screenfg[i], term->screenbg[i], term->screenul[i], term->screenbd[i]);
                 term->dirty[i] = 0;
             }
         }
diff -ur bogl-0.1.18/bogl-term.h bogl-0.1.18-mine/bogl-term.h
--- bogl-0.1.18/bogl-term.h	2003-11-05 03:01:47.000000000 +0000
+++ bogl-0.1.18-mine/bogl-term.h	2008-06-19 02:30:30.000000000 +0100
@@ -13,13 +13,14 @@
   int def_fg, def_bg;
   int fg, bg, ul;
   int rev;
+  int bold;
   int state;
   int cur_visible;
   int xp, yp;
   int arg[2];
   mbstate_t ps;
   wchar_t *screen; /* character in cell, or 0 */
-  int *screenfg, *screenbg, *screenul; /* colours in cell */
+  int *screenfg, *screenbg, *screenul, *screenbd; /* colours in cell */
   char *dirty; /* bitmask of dirty chars */
   wchar_t **cchars; /* combining chars in cell, or 0 */
   int yorig; /* increment this to scroll */
diff -ur bogl-0.1.18/bterm.c bogl-0.1.18-mine/bterm.c
--- bogl-0.1.18/bterm.c	2008-03-08 15:15:25.000000000 +0000
+++ bogl-0.1.18-mine/bterm.c	2008-06-19 03:17:50.000000000 +0100
@@ -47,19 +47,19 @@
     {0x00, 0x00, 0x00},	/* 0: Black. */
     {0xaa, 0x00, 0x00},	/* 1: Red. */
     {0x00, 0xaa, 0x00},	/* 2: Green. */
-    {0xaa, 0xaa, 0x00},	/* 3: Yellow. */
+    {0xaa, 0xaa, 0x00},	/* 3: Brown. */
     {0x00, 0x00, 0xaa},	/* 4: Blue. */
     {0xaa, 0x00, 0xaa},	/* 5: Magenta. */
     {0x00, 0xaa, 0xaa},	/* 6: Cyan. */
-    {0xaa, 0xaa, 0xaa},	/* 7: White. */
-    {0xff, 0x00, 0x00},	/* 8: Bright red (unused). */
-    {0x00, 0x00, 0xff},	/* 9: Bright blue (unused). */
-    {0xa9, 0x99, 0x75},	/* A: Tux #1. */
-    {0xec, 0xc9, 0x39},	/* B: Tux #2. */
-    {0x61, 0x52, 0x39},	/* C: Tux #3. */
-    {0xe4, 0xa8, 0x10},	/* D: Tux #4. */
-    {0xa0, 0x6d, 0x0c},	/* E: Tux #5. */
-    {0x38, 0x2e, 0x1e},	/* F: Tux #6. */
+    {0xaa, 0xaa, 0xaa},	/* 7: Light gray. */
+    {0x44, 0x44, 0x44},	/* 0: Light Gray. */
+    {0xff, 0x00, 0x00},	/* 1: Light Red. */
+    {0x00, 0xff, 0x00},	/* 2: Light Green. */
+    {0xff, 0xff, 0x00},	/* 3: Yellow. */
+    {0x00, 0x00, 0xff},	/* 4: Light Blue. */
+    {0xff, 0x00, 0xff},	/* 5: Light Magenta. */
+    {0x00, 0xff, 0xff},	/* 6: Light Cyan. */
+    {0xff, 0xff, 0xff},	/* 7: White. */
   };
 
 static int child_pid = 0;
diff -ur bogl-0.1.18/bterm.ti bogl-0.1.18-mine/bterm.ti
--- bogl-0.1.18/bterm.ti	2002-03-18 06:34:00.000000000 +0000
+++ bogl-0.1.18-mine/bterm.ti	2008-06-19 02:25:41.000000000 +0100
@@ -26,3 +26,4 @@
   khome=\E[1~, kich1=\E[2~, kmous=\E[M, knp=\E[6~, kpp=\E[5~, 
   kspd=^Z,
   ri=\EM,
+  bold=\E[1m,

Reply to: