Hi,
I have some prototype working code for the overbars (just to proof the
concept). As it is now, the overbars are put in all kind of text, not
only pinlabels (really should we limit it to pinlabels?), the PS output
is not fixed yet (I think I won't fix the PS code since I have very
little knowledge of postscript language), and there are no escape
characters implemented. As I said, it is very basic right now.

I would like to have some character to start and end the overbar. This
way I can label a pin like:
          _____
     READ/WRITE

I followed the Tragesym's rule to use the underscore '_' as overbar
delimiter. If I want to get the above pinlabel, I should write:
READ/_WRITE_ . I think the '_' character is commonly used, so maybe it
is not a right choice (the users will have to escape all those '_'
characters they really want. Maybe the character # is better?

There should be some free space between the overbar and the text. I left
a fixed quantity of 50 mils. I think it's better that it depends on the
font size (like 0.5*font_height, for example).

Regards,

Carlos

P.S. Attached patch (libgeda/noweb directory).
Index: o_text_basic.nw
===================================================================
RCS file: /home/cvspsrv/cvsroot/eda/geda/devel/libgeda/noweb/o_text_basic.nw,v
retrieving revision 1.24
diff -u -r1.24 o_text_basic.nw
--- o_text_basic.nw	14 Mar 2005 12:10:32 -0000	1.24
+++ o_text_basic.nw	26 Feb 2006 02:07:58 -0000
@@ -528,6 +528,9 @@
   int char_height;
   int line_start_x, line_start_y;
   int sign=1;
+  int overbar_startx=0, overbar_starty=0;
+  int overbar_endx=0, overbar_endy=0;
+  gboolean overbar_started = FALSE;
   gchar *ptr;
   OBJECT *o_font_set;
 
@@ -732,7 +735,7 @@
       size_of_tab_in_coord = tab_in_chars * 
                  o_text_width(w_current, TAB_CHAR_MODEL, size/2);
 
-      if (c != '\n' && c != '\t') {
+      if (c != '\n' && c != '\t' && c != '_') {
          /* only add the character if it is not a newline or tab character */
          temp_list = o_list_copy_all(w_current, 
 				     o_font_set->font_prim_objs->next, 
@@ -743,6 +746,70 @@
 
       /* if the character is a newline or tab, this code will "continue" */
       switch (c) {
+        case '_':
+	  if (!overbar_started) {
+	    /* Start point of the overbar */
+	    overbar_started = TRUE;
+	    printf("Overbar started with angle %i: %i,%i.\n", angle,
+		   x_offset, y_offset);
+	    switch (angle) {
+	      case 0:
+		overbar_startx = x_offset;
+		overbar_starty = y_offset + char_height + 50;
+		continue;
+		break;
+	      case 90:
+		overbar_startx = x_offset - char_height - 50;
+		overbar_starty = y_offset;
+		continue;
+		break;
+	      case 180:
+		overbar_startx = x_offset;
+		overbar_starty = y_offset - char_height - 50;
+		continue;
+		break;
+	      case 270:
+		overbar_startx = x_offset + char_height + 50;
+		overbar_starty = y_offset;
+		continue;
+		break;
+	      default:
+		fprintf(stderr, "o_text_create_string: Angle not supported\n");
+		break;	      	  
+	    }
+	  } else {
+	    /* Then this is the end point of the overbar */
+	    printf("Overbar ended with angle %i: %i,%i.\n", angle,
+		   x_offset, y_offset);
+	    switch (angle) {
+	      case 0:
+		overbar_endx = x_offset;
+		overbar_endy = y_offset + char_height + 50;
+		break;
+	      case 90:
+		overbar_endx = x_offset - char_height - 50;
+		overbar_endy = y_offset;
+		break;
+	      case 180:
+		overbar_endx = x_offset;
+		overbar_endy = y_offset - char_height - 50;
+		break;
+	      case 270:
+		overbar_endx = x_offset + char_height + 50;
+		overbar_endy = y_offset;
+		break;
+              default:
+		fprintf(stderr, "o_text_create_string: Angle not supported\n");
+		break;	      	  	  
+	    }
+	    /* Now it's time to add the overbar */
+	    temp_list = o_line_add(w_current, temp_list, OBJ_LINE, color,
+				   overbar_startx, overbar_starty,
+				   overbar_endx, overbar_endy);
+	    overbar_started = FALSE;
+	  }
+	  continue;
+	  break;
       case '\n':
         switch (angle) {
             case 0:

Reply via email to