paps/paps-cpilpi.patch

81 lines
2.9 KiB
Diff
Raw Normal View History

diff -pruN -x .libs -x '*o' -x '*ps' ../paps-0.6.8.orig/src/paps.c ../paps-0.6.8/src/paps.c
--- paps-0.6.8.orig/src/paps.c 2007-11-28 16:20:56.000000000 +0900
+++ paps-0.6.8/src/paps.c 2007-11-30 17:53:06.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 {
@@ -376,6 +376,7 @@ int main(int argc, char *argv[])
bottom_margin = 36;
page_width = 612;
page_height = 792;
+ do_stretch_chars = TRUE;
if (argc < 6 || argc > 7) {
fprintf(stderr, "ERROR: %s job-id user title copies options [file]\n", prgname);
@@ -596,7 +597,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);
@@ -608,13 +610,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;
@@ -1002,6 +1001,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);
@@ -1039,17 +1039,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;
}