Репозиторий Sisyphus
Последнее обновление: 1 октября 2023 | Пакетов: 18631 | Посещений: 37768020
en ru br
Репозитории ALT

Группа :: Издательство
Пакет: paps

 Главная   Изменения   Спек   Патчи   Sources   Загрузить   Gear   Bugs and FR  Repocop 

Патч: FC-cpilpi.patch
Скачать


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