[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
Re: gEDA-user: gschem text line spacing in postscript
The attached patch should make things a little closer between on-screen
and print-out.
Apparently this isn't the whole story though, on my box at least, Pango
seems to be using a little inter-line spacing. The calculations with
this patch assume that a "12 point" font has 12/72 inches between each
baseline.
--
Peter Clifton
Electrical Engineering Division,
Engineering Department,
University of Cambridge,
9, JJ Thomson Avenue,
Cambridge
CB3 0FA
Tel: +44 (0)7729 980173 - (No signal in the lab!)
diff --git a/libgeda/include/libgeda/defines.h b/libgeda/include/libgeda/defines.h
index d1f0422..cf7432a 100644
--- a/libgeda/include/libgeda/defines.h
+++ b/libgeda/include/libgeda/defines.h
@@ -121,9 +121,6 @@
/* Warning: it MUST be a string. */
#define TAB_CHAR_MODEL "b"
-/* multi text line spacing (multipled times character height) */
-#define LINE_SPACING 2.0
-
/* The conn modes for type */
#define CONN_NULL 0
#define CONN_ENDPOINT 1
diff --git a/libgeda/src/o_text_basic.c b/libgeda/src/o_text_basic.c
index cd6bac8..e7f79b8 100644
--- a/libgeda/src/o_text_basic.c
+++ b/libgeda/src/o_text_basic.c
@@ -610,35 +610,6 @@ void o_text_print_text_string(FILE *fp, char *string, int unicode_count,
}
-/*! \brief calculates the height of a text string
- * \par Function Description
- * This function calculates the height of a \a string depending
- * on it's text \a size. The number of lines and the spacing
- * between the lines are taken into account.
- *
- * \param [in] string the text string
- * \param [in] size the text size of the character
- * \return the total height of the text string
- */
-static int o_text_height(const char *string, int size)
-{
- int line_count = 0;
-
- if (string == NULL) {
- return 0;
- }
-
- /* Get the number of lines in the string */
- line_count = o_text_num_lines(string);
-
- /* 26 is the height of a single char (in mils) */
- /* which represents a character which is 2 pts high */
- /* So size has to be divided in half */
- /* and it's added the LINE_SPACING*character_height of each line */
- return(26*size/2*(1+LINE_SPACING*(line_count-1)));
-}
-
-
/*! \brief print a text object into a postscript file
* \par Function Description
* This function writes the postscript representation of the text object
@@ -766,8 +737,9 @@ void o_text_print(TOPLEVEL *toplevel, FILE *fp, OBJECT *o_current,
break;
}
- char_height = o_text_height("a", o_current->text->size);
- fprintf(fp,"%s %f [",centering_control,(float)(char_height*LINE_SPACING));
+ font_size = o_text_get_font_size_in_points (toplevel, o_current)
+ / 72.0 * 1000.0;
+ fprintf(fp,"%s %f [",centering_control, font_size);
/* split the line at each newline and print them */
p = output_string; /* Current point */
@@ -790,8 +762,6 @@ void o_text_print(TOPLEVEL *toplevel, FILE *fp, OBJECT *o_current,
/* Collect pertinent info about the text location */
x = o_current->text->x;
y = o_current->text->y;
- font_size = o_text_get_font_size_in_points (toplevel, o_current)
- / 72.0 * 1000.0;
fprintf(fp,"] %d %d %d %f text\n",angle,x,y,font_size);
_______________________________________________
geda-user mailing list
geda-user@xxxxxxxxxxxxxx
http://www.seul.org/cgi-bin/mailman/listinfo/geda-user