[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

gEDA-cvs: gaf.git: branch: master updated (1.6.1-20100214-97-g9aa23d8)



The branch, master has been updated
       via  9aa23d8ec9319639b505b30d8a7754af9311beca (commit)
      from  f1a4a40d964c7ea32404cd2ac888609ef89935a7 (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/include/libgeda/defines.h |    3 --
 libgeda/src/o_text_basic.c        |   46 +++++++++---------------------------
 2 files changed, 12 insertions(+), 37 deletions(-)


=================
 Commit Messages
=================

commit 9aa23d8ec9319639b505b30d8a7754af9311beca
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Commit: Peter Clifton <pcjc2@xxxxxxxxx>

    libgeda: Better match on-screen text height when printing

:100644 100644 d1f0422... cf7432a... M	libgeda/include/libgeda/defines.h
:100644 100644 709db67... c1e3858... M	libgeda/src/o_text_basic.c

=========
 Changes
=========

commit 9aa23d8ec9319639b505b30d8a7754af9311beca
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Commit: Peter Clifton <pcjc2@xxxxxxxxx>

    libgeda: Better match on-screen text height when printing

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 709db67..c1e3858 100644
--- a/libgeda/src/o_text_basic.c
+++ b/libgeda/src/o_text_basic.c
@@ -89,6 +89,14 @@
  */
 #define GEDA_FONT_FACTOR 1.3
 
+/*! \brief Scale factor font height and line-spacing (for print only)
+ *
+ *  \par Description
+ *  Specifies the scale factor between the nominal font size and the inter-
+ *  line spacing used to render it when printing.
+ */
+#define PRINT_LINE_SPACING 1.12
+
 /*! Default setting for text draw function. */
 void (*text_draw_func)() = NULL;
 
@@ -608,35 +616,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
@@ -659,7 +638,7 @@ void o_text_print(TOPLEVEL *toplevel, FILE *fp, OBJECT *o_current,
   char *output_string = NULL;
   char *name = NULL;
   char *value = NULL;
-  int x, y, angle, len, char_height;
+  int x, y, angle, len;
   float font_size;
 
 
@@ -764,8 +743,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 * PRINT_LINE_SPACING);
 
   /* split the line at each newline and print them */
   p = output_string;   /* Current point */
@@ -788,8 +768,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-cvs mailing list
geda-cvs@xxxxxxxxxxxxxx
http://www.seul.org/cgi-bin/mailman/listinfo/geda-cvs