[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
gEDA-cvs: gaf.git: branch: master updated (1.5.0-20080706-137-gb215d13)
The branch, master has been updated
via b215d134d1271c6a1723e406f1a0b67be8f59bc6 (commit)
via 6e8e2e48d54fa3e121d540d86ba1aabf322d3d95 (commit)
from 73a73cd0cb54d0f9430075aa00359b7840bd8d2c (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
=========
Summary
=========
libgeda/share/prolog.ps | 75 ++++++++++++++++++++++++++++++++------------
libgeda/src/o_text_basic.c | 18 +++++-----
2 files changed, 64 insertions(+), 29 deletions(-)
=================
Commit Messages
=================
commit b215d134d1271c6a1723e406f1a0b67be8f59bc6
Author: Peter TB Brett <peter@xxxxxxxxxxxxx>
Date: Sun Aug 17 02:36:35 2008 +0100
libgeda: Clean PostScript strings.
Tools like PSTricks override the PostScript 'show' command to do
magic. The existing text code only called 'show' for one character at
a time, making such tools very hard to use.
This patch draws the overbars for each line, and then calls show for
the line as a whole. It also lets overbars be applied over multiple
lines of text.
:100644 100644 ce84599... b8bb242... M libgeda/share/prolog.ps
commit 6e8e2e48d54fa3e121d540d86ba1aabf322d3d95
Author: Peter TB Brett <peter@xxxxxxxxxxxxx>
Date: Sun Aug 17 02:36:35 2008 +0100
libgeda: Unbreak text accessors.
Tests added in 4ad986d333e12980f92325d1a66884bc5b5388fe should have
had opposite logic.
:100644 100644 3f25423... b75c24e... M libgeda/src/o_text_basic.c
=========
Changes
=========
commit b215d134d1271c6a1723e406f1a0b67be8f59bc6
Author: Peter TB Brett <peter@xxxxxxxxxxxxx>
Date: Sun Aug 17 02:36:35 2008 +0100
libgeda: Clean PostScript strings.
Tools like PSTricks override the PostScript 'show' command to do
magic. The existing text code only called 'show' for one character at
a time, making such tools very hard to use.
This patch draws the overbars for each line, and then calls show for
the line as a whole. It also lets overbars be applied over multiple
lines of text.
diff --git a/libgeda/share/prolog.ps b/libgeda/share/prolog.ps
index ce84599..b8bb242 100644
--- a/libgeda/share/prolog.ps
+++ b/libgeda/share/prolog.ps
@@ -251,23 +251,40 @@
/drawoverbar false def
/fontsize 0.0 def
-% Show a string, with an overbar over it
-% string charshow -
-/charshow {
+%string1 string2 append -
+/append {
+ 2 copy length exch length add % find new length
+ string dup % string1 string2 string string
+ 4 2 roll % string string string1 string2
+ 2 index 0 3 index
+ % string string string1 string2 string 0 string1
+ putinterval % string string string1 string2
+ exch length exch putinterval
+} bind def
+
+% If drawoverbar is set, draw a line of the same length as the given string
+% string overbarshowline -
+/overbarshowline {
+ % print overbar if necessary
+ stringwidth pop 0
drawoverbar {
- % draw an overbar for the character
- gsave
- fontsize 10.0 div setlinewidth
- 0 fontsize rmoveto % move to (0,overbarheight)
- dup stringwidth pop 0 rlineto % draw line to
- stroke
- grestore
- } if
- show
+ rlineto
+ gsave stroke grestore
+ } {
+ rmoveto
+ } ifelse
} bind def
+% Draws overbars for the given string, then shows the string itself
+% string overbarshow
/overbarshow {
- /drawoverbar false def % start by not drawing overbars
+ /overbarshowacc () def
+ /overbarshowtxt () def
+
+ gsave
+ fontsize 10.0 div setlinewidth
+ 0 fontsize rmoveto % move to (0,overbarheight)
+
{ % work through string
escaped {
% the last character was the escape
@@ -275,12 +292,21 @@
% is it an _ = 95?
dup 95 eq {
pop % we don't need the character anymore
- % toggle drawing overbars
+ overbarshowacc overbarshowline
+ % toggle drawing overbars
/drawoverbar drawoverbar not def
+
+ % Append the contents off the accumulator to the text
+ % string we're eventually going to show
+ /overbarshowtxt overbarshowtxt overbarshowacc append def
+
+ % clear accumulator
+ /overbarshowacc () def
} {
- % otherwise render the character
- (\\ ) dup 1 4 -1 roll put % draw a \ and the character
- charshow % render the string
+ % add to accumulator
+ (\\ ) dup 1 4 -1 roll put
+ overbarshowacc exch append
+ /overbarshowacc exch def
} ifelse
% and reset the flag
/escaped false def
@@ -291,13 +317,21 @@
/escaped true def
pop % drop character
} {
- % no, reset flag and draw character
- ( ) dup 0 4 -1 roll put % create one character string
- charshow
+ % add to accumulator
+ ( ) dup 0 4 -1 roll put
+ overbarshowacc exch append
+ /overbarshowacc exch def
} ifelse
} ifelse
} forall
+ % Catch any leftovers
+ overbarshowacc overbarshowline
+ overbarshowtxt overbarshowacc append
+
+ grestore
+ show
} bind def
+
%
% hcenter rjustify vcenter vjustify spacing [(line1) (line2) ... ] rot x y size text -
/stringw 0.0 def
@@ -310,6 +344,7 @@
/text {
gsave % save state for later
+ /drawoverbar false def % start by not drawing overbars
dup /fontsize exch def % save font size for corrections later
% do font selection
commit 6e8e2e48d54fa3e121d540d86ba1aabf322d3d95
Author: Peter TB Brett <peter@xxxxxxxxxxxxx>
Date: Sun Aug 17 02:36:35 2008 +0100
libgeda: Unbreak text accessors.
Tests added in 4ad986d333e12980f92325d1a66884bc5b5388fe should have
had opposite logic.
diff --git a/libgeda/src/o_text_basic.c b/libgeda/src/o_text_basic.c
index 3f25423..b75c24e 100644
--- a/libgeda/src/o_text_basic.c
+++ b/libgeda/src/o_text_basic.c
@@ -1871,11 +1871,11 @@ gdouble o_text_shortest_distance(TEXT *text, gint x, gint y)
void o_text_set_string (TOPLEVEL *toplevel, OBJECT *obj,
const gchar *new_string)
{
- g_return_if_fail (toplevel == NULL);
- g_return_if_fail (obj == NULL);
- g_return_if_fail (obj->type != OBJ_TEXT);
- g_return_if_fail (obj->text == NULL);
- g_return_if_fail (new_string == NULL);
+ g_return_if_fail (toplevel != NULL);
+ g_return_if_fail (obj != NULL);
+ g_return_if_fail (obj->type == OBJ_TEXT);
+ g_return_if_fail (obj->text != NULL);
+ g_return_if_fail (new_string != NULL);
g_free (obj->text->string);
obj->text->string = g_strdup (new_string);
@@ -1894,10 +1894,10 @@ void o_text_set_string (TOPLEVEL *toplevel, OBJECT *obj,
*/
const gchar *o_text_get_string (TOPLEVEL *toplevel, OBJECT *obj)
{
- g_return_val_if_fail (toplevel == NULL, NULL);
- g_return_val_if_fail (obj == NULL, NULL);
- g_return_val_if_fail (obj->type != OBJ_TEXT, NULL);
- g_return_val_if_fail (obj->text == NULL, NULL);
+ g_return_val_if_fail (toplevel != NULL, NULL);
+ g_return_val_if_fail (obj != NULL, NULL);
+ g_return_val_if_fail (obj->type == OBJ_TEXT, NULL);
+ g_return_val_if_fail (obj->text != NULL, NULL);
return obj->text->string;
}
_______________________________________________
geda-cvs mailing list
geda-cvs@xxxxxxxxxxxxxx
http://www.seul.org/cgi-bin/mailman/listinfo/geda-cvs