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