Commit 2f4b33c9 authored by Marcus Meissner's avatar Marcus Meissner Committed by Alexandre Julliard

Make sure PostScript floats are printed with LC_NUMERIC="C".

parent 7a9e8005
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include <stdarg.h> #include <stdarg.h>
#include <locale.h>
#define NONAMELESSUNION #define NONAMELESSUNION
#define NONAMELESSSTRUCT #define NONAMELESSSTRUCT
...@@ -469,7 +470,9 @@ BOOL PSDRV_WriteArc(PSDRV_PDEVICE *physDev, INT x, INT y, INT w, INT h, double a ...@@ -469,7 +470,9 @@ BOOL PSDRV_WriteArc(PSDRV_PDEVICE *physDev, INT x, INT y, INT w, INT h, double a
/* Make angles -ve and swap order because we're working with an upside /* Make angles -ve and swap order because we're working with an upside
down y-axis */ down y-axis */
push_lc_numeric("C");
sprintf(buf, psarc, x, y, w, h, -ang2, -ang1); sprintf(buf, psarc, x, y, w, h, -ang2, -ang1);
pop_lc_numeric();
return PSDRV_WriteSpool(physDev, buf, strlen(buf)); return PSDRV_WriteSpool(physDev, buf, strlen(buf));
} }
...@@ -500,12 +503,16 @@ BOOL PSDRV_WriteSetColor(PSDRV_PDEVICE *physDev, PSCOLOR *color) ...@@ -500,12 +503,16 @@ BOOL PSDRV_WriteSetColor(PSDRV_PDEVICE *physDev, PSCOLOR *color)
PSDRV_CopyColor(&physDev->inkColor, color); PSDRV_CopyColor(&physDev->inkColor, color);
switch(color->type) { switch(color->type) {
case PSCOLOR_RGB: case PSCOLOR_RGB:
push_lc_numeric("C");
sprintf(buf, pssetrgbcolor, color->value.rgb.r, color->value.rgb.g, sprintf(buf, pssetrgbcolor, color->value.rgb.r, color->value.rgb.g,
color->value.rgb.b); color->value.rgb.b);
pop_lc_numeric();
return PSDRV_WriteSpool(physDev, buf, strlen(buf)); return PSDRV_WriteSpool(physDev, buf, strlen(buf));
case PSCOLOR_GRAY: case PSCOLOR_GRAY:
push_lc_numeric("C");
sprintf(buf, pssetgray, color->value.gray.i); sprintf(buf, pssetgray, color->value.gray.i);
pop_lc_numeric();
return PSDRV_WriteSpool(physDev, buf, strlen(buf)); return PSDRV_WriteSpool(physDev, buf, strlen(buf));
default: default:
...@@ -604,7 +611,9 @@ BOOL PSDRV_WriteRotate(PSDRV_PDEVICE *physDev, float ang) ...@@ -604,7 +611,9 @@ BOOL PSDRV_WriteRotate(PSDRV_PDEVICE *physDev, float ang)
{ {
char buf[256]; char buf[256];
push_lc_numeric("C");
sprintf(buf, psrotate, ang); sprintf(buf, psrotate, ang);
pop_lc_numeric();
return PSDRV_WriteSpool(physDev, buf, strlen(buf)); return PSDRV_WriteSpool(physDev, buf, strlen(buf));
} }
......
...@@ -549,4 +549,13 @@ extern void T42_free(TYPE42 *t42); ...@@ -549,4 +549,13 @@ extern void T42_free(TYPE42 *t42);
extern DWORD RLE_encode(BYTE *in_buf, DWORD len, BYTE *out_buf); extern DWORD RLE_encode(BYTE *in_buf, DWORD len, BYTE *out_buf);
extern DWORD ASCII85_encode(BYTE *in_buf, DWORD len, BYTE *out_buf); extern DWORD ASCII85_encode(BYTE *in_buf, DWORD len, BYTE *out_buf);
#define push_lc_numeric(x) do { \
const char *tmplocale = setlocale(LC_NUMERIC,NULL); \
setlocale(LC_NUMERIC,x);
#define pop_lc_numeric() \
setlocale(LC_NUMERIC,tmplocale); \
} while (0)
#endif #endif
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
#include <stdarg.h> #include <stdarg.h>
#include <stdio.h> #include <stdio.h>
#include <assert.h> #include <assert.h>
#include <locale.h>
#include "windef.h" #include "windef.h"
#include "winbase.h" #include "winbase.h"
...@@ -199,9 +200,11 @@ TYPE42 *T42_download_header(PSDRV_PDEVICE *physDev, char *ps_name, ...@@ -199,9 +200,11 @@ TYPE42 *T42_download_header(PSDRV_PDEVICE *physDev, char *ps_name,
buf = HeapAlloc(GetProcessHeap(), 0, sizeof(start) + strlen(ps_name) + buf = HeapAlloc(GetProcessHeap(), 0, sizeof(start) + strlen(ps_name) +
100); 100);
push_lc_numeric("C");
sprintf(buf, start, ps_name, sprintf(buf, start, ps_name,
(float)bbox->left / emsize, (float)bbox->bottom / emsize, (float)bbox->left / emsize, (float)bbox->bottom / emsize,
(float)bbox->right / emsize, (float)bbox->top / emsize); (float)bbox->right / emsize, (float)bbox->top / emsize);
pop_lc_numeric();
PSDRV_WriteSpool(physDev, buf, strlen(buf)); PSDRV_WriteSpool(physDev, buf, strlen(buf));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment