Here's a much better patch to fix the same thing. It temporarily sets
LC_NUMERIC to "C" locale and then back to the original setting.
--- abi-0.7.8/src/af/xap/unix/xap_UnixPSGraphics.cpp.orig Thu May 25 17:26:41 2000
+++ abi-0.7.8/src/af/xap/unix/xap_UnixPSGraphics.cpp Fri May 26 15:30:18 2000
@@ -19,6 +19,7 @@
#include <stdio.h>
#include <string.h>
+#include <locale.h>
#include "ut_types.h"
#include "ut_assert.h"
@@ -735,10 +736,11 @@
char buf[128];
// used for any averaging
unsigned char newclr;
+ char *old_locale = setlocale (LC_NUMERIC, "C");
switch(m_cs)
{
case GR_Graphics::GR_COLORSPACE_COLOR:
- sprintf(buf,"%.8f %.8f %.8f setrgbcolor\n", // TODO do we need to deal with locale for PS
+ sprintf(buf,"%.8f %.8f %.8f setrgbcolor\n",
((float) m_currentColor.m_red / (float) 255.0),
((float) m_currentColor.m_grn / (float) 255.0),
((float) m_currentColor.m_blu / (float) 255.0));
@@ -748,7 +750,7 @@
(float) m_currentColor.m_grn +
(float) m_currentColor.m_blu ) /
(float) 3.0);
- sprintf(buf,"%.8f setgray\n", // TODO do we need to deal with locale for PS
+ sprintf(buf,"%.8f setgray\n",
(float) newclr / (float) 255.0);
break;
case GR_Graphics::GR_COLORSPACE_BW:
@@ -761,6 +763,7 @@
}
m_ps->writeBytes(buf);
+ setlocale (LC_NUMERIC, old_locale);
}
GR_Image* PS_Graphics::createNewImage(const char* pszName, const UT_ByteBuf* pBBPNG, UT_sint32 iDisplayWidth, UT_sint32 iDisplayHeight)
>>>>> "Me" == Kenneth MacDonald <[EMAIL PROTECTED]> writes:
>>>>> "Me" == Kenneth MacDonald <[EMAIL PROTECTED]> writes:
Me> When printing with LANG=pt I cannot get good PostScript, as
Me> sprintf puts in commas as the radix character into the
Me> "setrgb" command. The patch below fixes this by hard wiring a
Me> "0." and then writes a number without a radix character. I
Me> can now print out coloured text!
Me> I forgot to mention that the patch is against 0.7.8.
Me> -- Kenny
Me> ADML Support, EUCS, The University of Edinburgh, Scotland.
--
Kenny
ADML Support, EUCS, The University of Edinburgh, Scotland.