mirror of
https://github.com/zint/zint
synced 2024-11-16 20:57:25 +13:00
Make locale aware
This commit is contained in:
parent
91251fbc26
commit
f8b6fb20aa
@ -19,6 +19,7 @@
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
#include <locale.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
@ -45,6 +46,7 @@ int ps_plot(struct zint_symbol *symbol)
|
||||
float scaler = symbol->scale;
|
||||
float default_text_posn;
|
||||
int plot_text = 1;
|
||||
const char *locale = NULL;
|
||||
|
||||
row_height=0;
|
||||
textdone = 0;
|
||||
@ -85,6 +87,7 @@ int ps_plot(struct zint_symbol *symbol)
|
||||
strcpy(symbol->errtxt, "Malformed background colour target");
|
||||
return ERROR_INVALID_OPTION;
|
||||
}
|
||||
locale = setlocale(LC_ALL, "C");
|
||||
|
||||
fgred = (16 * ctoi(symbol->fgcolour[0])) + ctoi(symbol->fgcolour[1]);
|
||||
fggrn = (16 * ctoi(symbol->fgcolour[2])) + ctoi(symbol->fgcolour[3]);
|
||||
@ -767,6 +770,9 @@ int ps_plot(struct zint_symbol *symbol)
|
||||
|
||||
fclose(feps);
|
||||
|
||||
if (locale)
|
||||
setlocale(LC_ALL, locale);
|
||||
|
||||
return error_number;
|
||||
}
|
||||
|
||||
|
@ -19,6 +19,7 @@
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
#include <locale.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
@ -41,6 +42,7 @@ int svg_plot(struct zint_symbol *symbol)
|
||||
float scaler = symbol->scale;
|
||||
float default_text_posn;
|
||||
int plot_text = 1;
|
||||
const char *locale = NULL;
|
||||
|
||||
row_height=0;
|
||||
textdone = 0;
|
||||
@ -81,6 +83,7 @@ int svg_plot(struct zint_symbol *symbol)
|
||||
strcpy(symbol->errtxt, "Malformed background colour target");
|
||||
return ERROR_INVALID_OPTION;
|
||||
}
|
||||
locale = setlocale(LC_ALL, "C");
|
||||
|
||||
fgred = (16 * ctoi(symbol->fgcolour[0])) + ctoi(symbol->fgcolour[1]);
|
||||
fggrn = (16 * ctoi(symbol->fgcolour[2])) + ctoi(symbol->fgcolour[3]);
|
||||
@ -614,6 +617,9 @@ int svg_plot(struct zint_symbol *symbol)
|
||||
|
||||
fclose(fsvg);
|
||||
|
||||
if (locale)
|
||||
setlocale(LC_ALL, locale);
|
||||
|
||||
return error_number;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user