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 @@
#include <stdio.h>
#include <string.h>
#include <stdarg.h>
#include <locale.h>
#define NONAMELESSUNION
#define NONAMELESSSTRUCT
......@@ -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
down y-axis */
push_lc_numeric("C");
sprintf(buf, psarc, x, y, w, h, -ang2, -ang1);
pop_lc_numeric();
return PSDRV_WriteSpool(physDev, buf, strlen(buf));
}
......@@ -500,12 +503,16 @@ BOOL PSDRV_WriteSetColor(PSDRV_PDEVICE *physDev, PSCOLOR *color)
PSDRV_CopyColor(&physDev->inkColor, color);
switch(color->type) {
case PSCOLOR_RGB:
push_lc_numeric("C");
sprintf(buf, pssetrgbcolor, color->value.rgb.r, color->value.rgb.g,
color->value.rgb.b);
pop_lc_numeric();
return PSDRV_WriteSpool(physDev, buf, strlen(buf));
case PSCOLOR_GRAY:
push_lc_numeric("C");
sprintf(buf, pssetgray, color->value.gray.i);
pop_lc_numeric();
return PSDRV_WriteSpool(physDev, buf, strlen(buf));
default:
......@@ -604,7 +611,9 @@ BOOL PSDRV_WriteRotate(PSDRV_PDEVICE *physDev, float ang)
{
char buf[256];
push_lc_numeric("C");
sprintf(buf, psrotate, ang);
pop_lc_numeric();
return PSDRV_WriteSpool(physDev, buf, strlen(buf));
}
......
......@@ -549,4 +549,13 @@ extern void T42_free(TYPE42 *t42);
extern DWORD RLE_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
......@@ -26,6 +26,7 @@
#include <stdarg.h>
#include <stdio.h>
#include <assert.h>
#include <locale.h>
#include "windef.h"
#include "winbase.h"
......@@ -199,9 +200,11 @@ TYPE42 *T42_download_header(PSDRV_PDEVICE *physDev, char *ps_name,
buf = HeapAlloc(GetProcessHeap(), 0, sizeof(start) + strlen(ps_name) +
100);
push_lc_numeric("C");
sprintf(buf, start, ps_name,
(float)bbox->left / emsize, (float)bbox->bottom / emsize,
(float)bbox->right / emsize, (float)bbox->top / emsize);
pop_lc_numeric();
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