Blame SOURCES/paps-cpilpi.patch

78523c
diff -pruN paps-0.6.8.orig/src/paps.c paps-0.6.8/src/paps.c
78523c
--- paps-0.6.8.orig/src/paps.c	2008-11-07 08:27:54.000000000 +0900
78523c
+++ paps-0.6.8/src/paps.c	2008-11-07 08:29:08.000000000 +0900
78523c
@@ -92,8 +92,8 @@ typedef struct {
78523c
   gchar *filename;
78523c
   gchar *header_font_desc;
78523c
   gchar *owner;
78523c
-  gint lpi;
78523c
-  gint cpi;
78523c
+  gdouble lpi;
78523c
+  gdouble cpi;
78523c
 } page_layout_t;
78523c
 
78523c
 typedef struct {
78523c
@@ -378,6 +378,7 @@ int main(int argc, char *argv[])
78523c
 		page_height = 792;
78523c
 		font = g_strdup(MAKE_FONT_NAME ("Courier", DEFAULT_FONT_SIZE));
78523c
 		header_font_desc = g_strdup(MAKE_FONT_NAME ("Courier", HEADER_FONT_SCALE));
78523c
+		do_stretch_chars = TRUE;
78523c
 
78523c
 		if (argc < 6 || argc > 7) {
78523c
 			fprintf(stderr, "ERROR: %s job-id user title copies options [file]\n", prgname);
78523c
@@ -595,7 +596,8 @@ int main(int argc, char *argv[])
78523c
   /* calculate x-coordinate scale */
78523c
   if (page_layout.cpi > 0.0L)
78523c
     {
78523c
-      double scale;
78523c
+      gint font_size;
78523c
+
78523c
       fontmap = pango_ft2_font_map_new ();
78523c
       fontset = pango_font_map_load_fontset (fontmap, pango_context, font_description, get_language ());
78523c
       metrics = pango_fontset_get_metrics (fontset);
78523c
@@ -607,13 +609,10 @@ int main(int argc, char *argv[])
78523c
       pango_font_metrics_unref (metrics);
78523c
       g_object_unref (G_OBJECT (fontmap));
78523c
 
78523c
-      // Now figure out how to scale the font to get that size
78523c
-      scale = 1 / page_layout.cpi * 72.0 * PANGO_SCALE / max_width;
78523c
-
78523c
+      font_size = pango_font_description_get_size (font_description);
78523c
       // update the font size to that width
78523c
-      pango_font_description_set_size (font_description, (int)(atoi(DEFAULT_FONT_SIZE) * PANGO_SCALE * scale));
78523c
+      pango_font_description_set_size (font_description, font_size * page_layout.scale_x);
78523c
       pango_context_set_font_description (pango_context, font_description);
78523c
-      
78523c
     }
78523c
 
78523c
   page_layout.scale_x = page_layout.scale_y = 1.0;
78523c
@@ -1001,6 +1000,7 @@ output_pages(FILE          *OUT,
78523c
   int column_y_pos = 0;
78523c
   int page_idx = 1;
78523c
   int pango_column_height = page_layout->column_height * page_layout->pt_to_pixel * PANGO_SCALE;
78523c
+  int height = 0;
78523c
   LineLink *prev_line_link = NULL;
78523c
 
78523c
   start_page(OUT, page_idx);
78523c
@@ -1038,17 +1038,17 @@ output_pages(FILE          *OUT,
78523c
                            );
78523c
             }
78523c
         }
78523c
+      if (page_layout->lpi > 0.0L)
78523c
+        height = (int)(1.0 / page_layout->lpi * 72.0 * page_layout->pt_to_pixel * PANGO_SCALE);
78523c
+      else
78523c
+        height = line_link->logical_rect.height;
78523c
       draw_line_to_page(OUT,
78523c
                         column_idx,
78523c
-                        column_y_pos+line_link->logical_rect.height,
78523c
+                        column_y_pos+height,
78523c
                         page_layout,
78523c
                         line);
78523c
 
78523c
-      if (page_layout->lpi > 0.0L)
78523c
-        column_y_pos += (int)(1.0 / page_layout->lpi * 72.0 * page_layout->pt_to_pixel * PANGO_SCALE);
78523c
-      else
78523c
-        column_y_pos += line_link->logical_rect.height;
78523c
-      
78523c
+      column_y_pos += height;
78523c
       pango_lines = pango_lines->next;
78523c
       prev_line_link = line_link;
78523c
     }