summaryrefslogtreecommitdiff
path: root/debian/patches/07_fix_pdf_floats.dpatch
blob: 6a659d1f1a8932e1d829e4b655abda238aca69b7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#! /bin/sh /usr/share/dpatch/dpatch-run
## 07_fix_pdf_floats.dpatch by  <jblache@debian.org>
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: Set LC_NUMERIC to POSIX before printing floats when building
## DP: PostScript of PDF output.

@DPATCH@
diff -urNad xsane-0.996~/src/xsane-save.c xsane-0.996/src/xsane-save.c
--- xsane-0.996~/src/xsane-save.c	2008-09-20 22:48:29.000000000 +0200
+++ xsane-0.996/src/xsane-save.c	2009-06-26 11:46:52.599585386 +0200
@@ -26,6 +26,8 @@
 #include "xsane-back-gtk.h"
 #include "xsane-front-gtk.h"
 #include "xsane-save.h"
+#include <locale.h>
+#include <string.h>
 #include <time.h>
 #include <sys/wait.h> 
 
@@ -2411,6 +2413,7 @@
                                               int flatedecode)
 {
  int depth; 
+ char *save_locale;
 
   depth = image_info->depth;
 
@@ -2428,8 +2431,15 @@
 
   fprintf(outfile, "%d rotate\n", degree);
   fprintf(outfile, "%d %d translate\n", position_left, position_bottom);
+
+  save_locale = strdup(setlocale(LC_NUMERIC, NULL));
+  setlocale(LC_NUMERIC, "POSIX");
+
   fprintf(outfile, "%f %f scale\n", width, height);
 
+  setlocale(LC_NUMERIC, save_locale);
+  free(save_locale);
+
   fprintf(outfile, "<<\n");
   fprintf(outfile, " /ImageType 1\n");
   fprintf(outfile, " /Width %d\n", image_info->image_width);
@@ -3889,6 +3899,7 @@
  int position_left, position_bottom, box_left, box_bottom, box_right, box_top, depth;
  int left, bottom;
  float rad;
+ char *save_locale;
 
   DBG(DBG_proc, "xsane_save_pdf_create_page_header\n");
 
@@ -4003,8 +4014,16 @@
 
   fprintf(outfile, "q\n");
   fprintf(outfile, "1 0 0 1 %d %d cm\n", position_left, position_bottom); /* translate */
+
+  save_locale = strdup(setlocale(LC_NUMERIC, NULL));
+  setlocale(LC_NUMERIC, "POSIX");
+
   fprintf(outfile, "%f %f -%f %f 0 0 cm\n", cos(rad), sin(rad), sin(rad), cos(rad)); /* rotate */
   fprintf(outfile, "%f 0 0 %f 0 0 cm\n", width, height); /* scale */
+
+  setlocale(LC_NUMERIC, save_locale);
+  free(save_locale);
+
   fprintf(outfile, "BI\n");
   fprintf(outfile, "  /W %d\n", image_info->image_width);
   fprintf(outfile, "  /H %d\n", image_info->image_height);