2008-07-14 09:15:55 +12:00
|
|
|
/* ps.c - Post Script output */
|
|
|
|
/*
|
|
|
|
libzint - the open source barcode library
|
RMQR: update to ISO/IEC 23941:2022 - R13x77 numeric cclens change 8 -> 7
QRCODE: use stricter interpretation of ZINT_FULL_MULTIBYTE, excluding
certain trailing bytes
libzint: fix some confusing error messages introduced by segment stuff
general: new escape chars \U, \d and \o
backend_qt: fudge rendering of border rectangles due to scaling/translation
rounding errors TODO: better fudge
GUI: foreground/background colours -> text boxes and icon buttons, add swap
button, independently movable picker (NULL parent), preview colour changes,
preview Data Window changes, add clear data (del) buttons, add zap button
and Factory Reset menu option, various other fixes
libzint: remove STATIC_UNLESS_ZINT_TEST, use wrappers
CMake: add find package QtSvg, remove QtXml
manual: split symbology and general specs and sort, move DAFT to 4-state,
UPC/EAN -> EAN/UPC, DataBar -> GS1 DataBar always, expand MAILMARK info,
various other fiddlings
man page: options or -> |, expand MSI Plessey check digit options
README.linux: add packages info
license: add SPDX-License-Identifier to touched files
2022-06-10 08:52:02 +12:00
|
|
|
Copyright (C) 2009-2022 Robin Stuart <rstuart114@gmail.com>
|
2013-05-17 05:26:38 +12:00
|
|
|
|
|
|
|
Redistribution and use in source and binary forms, with or without
|
|
|
|
modification, are permitted provided that the following conditions
|
|
|
|
are met:
|
|
|
|
|
2016-02-21 00:29:19 +13:00
|
|
|
1. Redistributions of source code must retain the above copyright
|
|
|
|
notice, this list of conditions and the following disclaimer.
|
2013-05-17 05:26:38 +12:00
|
|
|
2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
notice, this list of conditions and the following disclaimer in the
|
2016-02-21 00:29:19 +13:00
|
|
|
documentation and/or other materials provided with the distribution.
|
2013-05-17 05:26:38 +12:00
|
|
|
3. Neither the name of the project nor the names of its contributors
|
|
|
|
may be used to endorse or promote products derived from this software
|
2016-02-21 00:29:19 +13:00
|
|
|
without specific prior written permission.
|
2013-05-17 05:26:38 +12:00
|
|
|
|
|
|
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
|
|
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
|
|
|
|
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
|
|
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
|
|
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
|
|
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
|
|
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
2016-02-21 00:29:19 +13:00
|
|
|
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
2013-05-17 05:26:38 +12:00
|
|
|
SUCH DAMAGE.
|
2016-02-21 00:29:19 +13:00
|
|
|
*/
|
RMQR: update to ISO/IEC 23941:2022 - R13x77 numeric cclens change 8 -> 7
QRCODE: use stricter interpretation of ZINT_FULL_MULTIBYTE, excluding
certain trailing bytes
libzint: fix some confusing error messages introduced by segment stuff
general: new escape chars \U, \d and \o
backend_qt: fudge rendering of border rectangles due to scaling/translation
rounding errors TODO: better fudge
GUI: foreground/background colours -> text boxes and icon buttons, add swap
button, independently movable picker (NULL parent), preview colour changes,
preview Data Window changes, add clear data (del) buttons, add zap button
and Factory Reset menu option, various other fixes
libzint: remove STATIC_UNLESS_ZINT_TEST, use wrappers
CMake: add find package QtSvg, remove QtXml
manual: split symbology and general specs and sort, move DAFT to 4-state,
UPC/EAN -> EAN/UPC, DataBar -> GS1 DataBar always, expand MAILMARK info,
various other fiddlings
man page: options or -> |, expand MSI Plessey check digit options
README.linux: add packages info
license: add SPDX-License-Identifier to touched files
2022-06-10 08:52:02 +12:00
|
|
|
/* SPDX-License-Identifier: BSD-3-Clause */
|
2008-07-14 09:15:55 +12:00
|
|
|
|
2021-06-10 22:15:39 +12:00
|
|
|
#include <errno.h>
|
2010-05-23 17:02:08 +12:00
|
|
|
#include <locale.h>
|
2016-03-03 10:12:38 +13:00
|
|
|
#include <math.h>
|
2022-07-15 03:01:30 +12:00
|
|
|
#include <stdio.h>
|
2008-07-14 09:15:55 +12:00
|
|
|
#include "common.h"
|
- API: add new zint_symbol `dpmm` field for output resolution (BMP/
EMF/PCX/PNG/TIF only, i.e. excluding EPS, GIF & SVG)
- Add support for specifying scale by X-dimension and resolution
with new option `--scalexdimdp` for CLI/Tcl & new API function
`ZBarcode_Scale_From_XdimDp()` (+ `ZBarcode_XdimDp_From_Scale()`
& `ZBarcode_Default_Xdim()`) and new GUI popup; manual: document
- BMP/EMF/PCX/PNG/TIF: use new `dpmm` resolution field (for EMF
following Inkscape)
- backend_qt: add `dpmm()`, `vectorWidth()`, `vectorHeight()`,
`noPng()`, `getVersion()`, `takesGS1AIData()`, & `XdimDp` stuff
incl. new `QZintXdimDp` struct for passing around scale vars &
use in `getAsCLI()`; add comments
- Raise `scale` limit to 200 (from 100) to allow for large dpmm
- output: create directories & subdirectories as necessary for
output path using new function `out_fopen()` and use in BMP/EMF/
EPS/GIF/PCX/PNG/SVG/TIF
- DPLEIT/DPIDENT: format HRT according to (incomplete)
documentation, and set default height to 72X (from 50X)
- CODE128B renamed to CODE128AB as can use subsets A and/or B
- CODABAR: fix minimum height calc
- EMF: fix indexing of handles (zero-based not 1-based)
- GUI: fix symbology zap (previous technique of clearing and
re-loading settings without doing a sync no longer works);
fix UPCEAN guard descent enable
- MAILMARK: better error message if input < 14 characters
- GUI: add "Default" button for DAFT tracker ratio & enable/disable
various default buttons; use new `takesGS1AIData()` to
enable/disable GS1-specific checkboxes
- CLI: use new `validate_float()` to parse float options (7
significant digits allowed only, no scientific notation)
- DATAMATRIX/GRIDMATRIX/PDF417/QR/ULTRA: micro-optimize structapp
ID parse
- library/CLI: fiddle with static asserts (make CHAR_BIT sensitive,
supposedly)
- win32/README: update building libpng (assembly removed)
- README.linux: document incompatibility of Qt6 >= 6.3
- manual: expand Barcode Studio waffle
- test suite: change range separator to hyphen and allow multiple
excludes
2022-12-03 10:39:01 +13:00
|
|
|
#include "output.h"
|
2008-07-14 09:15:55 +12:00
|
|
|
|
2021-07-27 02:29:05 +12:00
|
|
|
static void colour_to_pscolor(int option, int colour, char *output) {
|
|
|
|
*output = '\0';
|
2020-01-07 07:00:43 +13:00
|
|
|
if ((option & CMYK_COLOUR) == 0) {
|
2022-07-15 03:01:30 +12:00
|
|
|
/* Use RGB colour space */
|
2021-06-10 22:15:39 +12:00
|
|
|
switch (colour) {
|
2022-07-15 03:01:30 +12:00
|
|
|
case 1: /* Cyan */
|
2020-01-07 07:00:43 +13:00
|
|
|
strcat(output, "0.00 1.00 1.00");
|
|
|
|
break;
|
2022-07-15 03:01:30 +12:00
|
|
|
case 2: /* Blue */
|
2020-01-07 07:00:43 +13:00
|
|
|
strcat(output, "0.00 0.00 1.00");
|
|
|
|
break;
|
2022-07-15 03:01:30 +12:00
|
|
|
case 3: /* Magenta */
|
2020-01-07 07:00:43 +13:00
|
|
|
strcat(output, "1.00 0.00 1.00");
|
|
|
|
break;
|
2022-07-15 03:01:30 +12:00
|
|
|
case 4: /* Red */
|
2020-01-07 07:00:43 +13:00
|
|
|
strcat(output, "1.00 0.00 0.00");
|
|
|
|
break;
|
2022-07-15 03:01:30 +12:00
|
|
|
case 5: /* Yellow */
|
2020-01-07 07:00:43 +13:00
|
|
|
strcat(output, "1.00 1.00 0.00");
|
|
|
|
break;
|
2022-07-15 03:01:30 +12:00
|
|
|
case 6: /* Green */
|
2020-01-07 07:00:43 +13:00
|
|
|
strcat(output, "0.00 1.00 0.00");
|
|
|
|
break;
|
2022-07-15 03:01:30 +12:00
|
|
|
case 8: /* White */
|
2020-08-12 23:19:26 +12:00
|
|
|
strcat(output, "1.00 1.00 1.00");
|
|
|
|
break;
|
2022-07-15 03:01:30 +12:00
|
|
|
default: /* Black */
|
2020-01-07 07:00:43 +13:00
|
|
|
strcat(output, "0.00 0.00 0.00");
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
strcat(output, " setrgbcolor");
|
|
|
|
} else {
|
2022-07-15 03:01:30 +12:00
|
|
|
/* Use CMYK colour space */
|
2021-06-10 22:15:39 +12:00
|
|
|
switch (colour) {
|
2022-07-15 03:01:30 +12:00
|
|
|
case 1: /* Cyan */
|
2020-01-07 07:00:43 +13:00
|
|
|
strcat(output, "1.00 0.00 0.00 0.00");
|
|
|
|
break;
|
2022-07-15 03:01:30 +12:00
|
|
|
case 2: /* Blue */
|
2020-01-07 07:00:43 +13:00
|
|
|
strcat(output, "1.00 1.00 0.00 0.00");
|
|
|
|
break;
|
2022-07-15 03:01:30 +12:00
|
|
|
case 3: /* Magenta */
|
2020-01-07 07:00:43 +13:00
|
|
|
strcat(output, "0.00 1.00 0.00 0.00");
|
|
|
|
break;
|
2022-07-15 03:01:30 +12:00
|
|
|
case 4: /* Red */
|
2020-01-07 07:00:43 +13:00
|
|
|
strcat(output, "0.00 1.00 1.00 0.00");
|
|
|
|
break;
|
2022-07-15 03:01:30 +12:00
|
|
|
case 5: /* Yellow */
|
2020-01-07 07:00:43 +13:00
|
|
|
strcat(output, "0.00 0.00 1.00 0.00");
|
|
|
|
break;
|
2022-07-15 03:01:30 +12:00
|
|
|
case 6: /* Green */
|
2020-01-07 07:00:43 +13:00
|
|
|
strcat(output, "1.00 0.00 1.00 0.00");
|
|
|
|
break;
|
2022-07-15 03:01:30 +12:00
|
|
|
case 8: /* White */
|
2020-08-12 23:19:26 +12:00
|
|
|
strcat(output, "0.00 0.00 0.00 0.00");
|
|
|
|
break;
|
2022-07-15 03:01:30 +12:00
|
|
|
default: /* Black */
|
2020-01-07 07:00:43 +13:00
|
|
|
strcat(output, "0.00 0.00 0.00 1.00");
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
strcat(output, " setcmykcolor");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
RMQR: update to ISO/IEC 23941:2022 - R13x77 numeric cclens change 8 -> 7
QRCODE: use stricter interpretation of ZINT_FULL_MULTIBYTE, excluding
certain trailing bytes
libzint: fix some confusing error messages introduced by segment stuff
general: new escape chars \U, \d and \o
backend_qt: fudge rendering of border rectangles due to scaling/translation
rounding errors TODO: better fudge
GUI: foreground/background colours -> text boxes and icon buttons, add swap
button, independently movable picker (NULL parent), preview colour changes,
preview Data Window changes, add clear data (del) buttons, add zap button
and Factory Reset menu option, various other fixes
libzint: remove STATIC_UNLESS_ZINT_TEST, use wrappers
CMake: add find package QtSvg, remove QtXml
manual: split symbology and general specs and sort, move DAFT to 4-state,
UPC/EAN -> EAN/UPC, DataBar -> GS1 DataBar always, expand MAILMARK info,
various other fiddlings
man page: options or -> |, expand MSI Plessey check digit options
README.linux: add packages info
license: add SPDX-License-Identifier to touched files
2022-06-10 08:52:02 +12:00
|
|
|
static void ps_convert(const unsigned char *string, unsigned char *ps_string) {
|
2020-10-01 00:19:12 +13:00
|
|
|
const unsigned char *s;
|
|
|
|
unsigned char *p = ps_string;
|
|
|
|
|
|
|
|
for (s = string; *s; s++) {
|
|
|
|
switch (*s) {
|
|
|
|
case '(':
|
|
|
|
case ')':
|
|
|
|
case '\\':
|
|
|
|
*p++ = '\\';
|
|
|
|
*p++ = *s;
|
|
|
|
break;
|
|
|
|
case 0xC2: /* See `to_iso8859_1()` in raster.c */
|
|
|
|
*p++ = *++s;
|
|
|
|
break;
|
|
|
|
case 0xC3:
|
|
|
|
*p++ = *++s + 64;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
if (*s < 0x80) {
|
|
|
|
*p++ = *s;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
*p = '\0';
|
|
|
|
}
|
|
|
|
|
RMQR: update to ISO/IEC 23941:2022 - R13x77 numeric cclens change 8 -> 7
QRCODE: use stricter interpretation of ZINT_FULL_MULTIBYTE, excluding
certain trailing bytes
libzint: fix some confusing error messages introduced by segment stuff
general: new escape chars \U, \d and \o
backend_qt: fudge rendering of border rectangles due to scaling/translation
rounding errors TODO: better fudge
GUI: foreground/background colours -> text boxes and icon buttons, add swap
button, independently movable picker (NULL parent), preview colour changes,
preview Data Window changes, add clear data (del) buttons, add zap button
and Factory Reset menu option, various other fixes
libzint: remove STATIC_UNLESS_ZINT_TEST, use wrappers
CMake: add find package QtSvg, remove QtXml
manual: split symbology and general specs and sort, move DAFT to 4-state,
UPC/EAN -> EAN/UPC, DataBar -> GS1 DataBar always, expand MAILMARK info,
various other fiddlings
man page: options or -> |, expand MSI Plessey check digit options
README.linux: add packages info
license: add SPDX-License-Identifier to touched files
2022-06-10 08:52:02 +12:00
|
|
|
#ifdef ZINT_TEST /* Wrapper for direct testing */
|
|
|
|
INTERNAL void ps_convert_test(const unsigned char *string, unsigned char *ps_string) {
|
|
|
|
ps_convert(string, ps_string);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2019-12-19 13:37:55 +13:00
|
|
|
INTERNAL int ps_plot(struct zint_symbol *symbol) {
|
2016-02-21 00:29:19 +13:00
|
|
|
FILE *feps;
|
|
|
|
int fgred, fggrn, fgblu, bgred, bggrn, bgblu;
|
|
|
|
float red_ink, green_ink, blue_ink, red_paper, green_paper, blue_paper;
|
2016-06-20 01:14:30 +12:00
|
|
|
float cyan_ink, magenta_ink, yellow_ink, black_ink;
|
|
|
|
float cyan_paper, magenta_paper, yellow_paper, black_paper;
|
2016-02-21 00:29:19 +13:00
|
|
|
int error_number = 0;
|
2018-06-10 20:16:18 +12:00
|
|
|
float ax, ay, bx, by, cx, cy, dx, dy, ex, ey, fx, fy;
|
2020-10-27 01:21:43 +13:00
|
|
|
float previous_diameter;
|
|
|
|
float radius, half_radius, half_sqrt3_radius;
|
2021-07-27 02:29:05 +12:00
|
|
|
int colour_index, colour_rect_flag;
|
|
|
|
char ps_color[33]; /* max "1.00 0.00 0.00 0.00 setcmykcolor" = 32 + 1 */
|
2020-08-03 18:37:27 +12:00
|
|
|
int draw_background = 1;
|
2018-06-10 20:16:18 +12:00
|
|
|
struct zint_vector_rect *rect;
|
|
|
|
struct zint_vector_hexagon *hex;
|
|
|
|
struct zint_vector_circle *circle;
|
|
|
|
struct zint_vector_string *string;
|
2016-02-21 00:29:19 +13:00
|
|
|
const char *locale = NULL;
|
2020-10-01 00:19:12 +13:00
|
|
|
const char *font;
|
|
|
|
int i, len;
|
|
|
|
int ps_len = 0;
|
|
|
|
int iso_latin1 = 0;
|
2021-08-23 00:59:01 +12:00
|
|
|
int have_circles_with_width = 0, have_circles_without_width = 0;
|
2021-07-27 02:29:05 +12:00
|
|
|
const int output_to_stdout = symbol->output_options & BARCODE_STDOUT;
|
2020-10-01 00:19:12 +13:00
|
|
|
unsigned char *ps_string;
|
2016-02-21 00:29:19 +13:00
|
|
|
|
2021-07-27 02:29:05 +12:00
|
|
|
if (symbol->vector == NULL) {
|
|
|
|
strcpy(symbol->errtxt, "646: Vector header NULL");
|
|
|
|
return ZINT_ERROR_INVALID_DATA;
|
|
|
|
}
|
|
|
|
|
2020-08-05 01:49:25 +12:00
|
|
|
if (strlen(symbol->bgcolour) > 6) {
|
|
|
|
if ((ctoi(symbol->bgcolour[6]) == 0) && (ctoi(symbol->bgcolour[7]) == 0)) {
|
|
|
|
draw_background = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-07-27 02:29:05 +12:00
|
|
|
if (output_to_stdout) {
|
2016-02-21 00:29:19 +13:00
|
|
|
feps = stdout;
|
|
|
|
} else {
|
- API: add new zint_symbol `dpmm` field for output resolution (BMP/
EMF/PCX/PNG/TIF only, i.e. excluding EPS, GIF & SVG)
- Add support for specifying scale by X-dimension and resolution
with new option `--scalexdimdp` for CLI/Tcl & new API function
`ZBarcode_Scale_From_XdimDp()` (+ `ZBarcode_XdimDp_From_Scale()`
& `ZBarcode_Default_Xdim()`) and new GUI popup; manual: document
- BMP/EMF/PCX/PNG/TIF: use new `dpmm` resolution field (for EMF
following Inkscape)
- backend_qt: add `dpmm()`, `vectorWidth()`, `vectorHeight()`,
`noPng()`, `getVersion()`, `takesGS1AIData()`, & `XdimDp` stuff
incl. new `QZintXdimDp` struct for passing around scale vars &
use in `getAsCLI()`; add comments
- Raise `scale` limit to 200 (from 100) to allow for large dpmm
- output: create directories & subdirectories as necessary for
output path using new function `out_fopen()` and use in BMP/EMF/
EPS/GIF/PCX/PNG/SVG/TIF
- DPLEIT/DPIDENT: format HRT according to (incomplete)
documentation, and set default height to 72X (from 50X)
- CODE128B renamed to CODE128AB as can use subsets A and/or B
- CODABAR: fix minimum height calc
- EMF: fix indexing of handles (zero-based not 1-based)
- GUI: fix symbology zap (previous technique of clearing and
re-loading settings without doing a sync no longer works);
fix UPCEAN guard descent enable
- MAILMARK: better error message if input < 14 characters
- GUI: add "Default" button for DAFT tracker ratio & enable/disable
various default buttons; use new `takesGS1AIData()` to
enable/disable GS1-specific checkboxes
- CLI: use new `validate_float()` to parse float options (7
significant digits allowed only, no scientific notation)
- DATAMATRIX/GRIDMATRIX/PDF417/QR/ULTRA: micro-optimize structapp
ID parse
- library/CLI: fiddle with static asserts (make CHAR_BIT sensitive,
supposedly)
- win32/README: update building libpng (assembly removed)
- README.linux: document incompatibility of Qt6 >= 6.3
- manual: expand Barcode Studio waffle
- test suite: change range separator to hyphen and allow multiple
excludes
2022-12-03 10:39:01 +13:00
|
|
|
if (!(feps = out_fopen(symbol->outfile, "w"))) {
|
2021-07-27 02:29:05 +12:00
|
|
|
sprintf(symbol->errtxt, "645: Could not open output file (%d: %.30s)", errno, strerror(errno));
|
|
|
|
return ZINT_ERROR_FILE_ACCESS;
|
|
|
|
}
|
2016-02-21 00:29:19 +13:00
|
|
|
}
|
|
|
|
|
|
|
|
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]);
|
|
|
|
fgblu = (16 * ctoi(symbol->fgcolour[4])) + ctoi(symbol->fgcolour[5]);
|
|
|
|
bgred = (16 * ctoi(symbol->bgcolour[0])) + ctoi(symbol->bgcolour[1]);
|
|
|
|
bggrn = (16 * ctoi(symbol->bgcolour[2])) + ctoi(symbol->bgcolour[3]);
|
|
|
|
bgblu = (16 * ctoi(symbol->bgcolour[4])) + ctoi(symbol->bgcolour[5]);
|
2020-10-27 01:21:43 +13:00
|
|
|
red_ink = (float) (fgred / 256.0);
|
|
|
|
green_ink = (float) (fggrn / 256.0);
|
|
|
|
blue_ink = (float) (fgblu / 256.0);
|
|
|
|
red_paper = (float) (bgred / 256.0);
|
|
|
|
green_paper = (float) (bggrn / 256.0);
|
|
|
|
blue_paper = (float) (bgblu / 256.0);
|
2016-09-06 09:06:50 +12:00
|
|
|
|
2016-06-20 01:14:30 +12:00
|
|
|
/* Convert RGB to CMYK */
|
|
|
|
if (red_ink > green_ink) {
|
|
|
|
if (blue_ink > red_ink) {
|
2020-10-27 01:21:43 +13:00
|
|
|
black_ink = 1.0f - blue_ink;
|
2016-06-20 01:14:30 +12:00
|
|
|
} else {
|
2020-10-27 01:21:43 +13:00
|
|
|
black_ink = 1.0f - red_ink;
|
2016-06-20 01:14:30 +12:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if (blue_ink > red_ink) {
|
2020-10-27 01:21:43 +13:00
|
|
|
black_ink = 1.0f - blue_ink;
|
2016-06-20 01:14:30 +12:00
|
|
|
} else {
|
2020-10-27 01:21:43 +13:00
|
|
|
black_ink = 1.0f - green_ink;
|
2016-06-20 01:14:30 +12:00
|
|
|
}
|
|
|
|
}
|
2020-10-27 01:21:43 +13:00
|
|
|
if (black_ink < 1.0f) {
|
|
|
|
cyan_ink = (1.0f - red_ink - black_ink) / (1.0f - black_ink);
|
|
|
|
magenta_ink = (1.0f - green_ink - black_ink) / (1.0f - black_ink);
|
|
|
|
yellow_ink = (1.0f - blue_ink - black_ink) / (1.0f - black_ink);
|
2016-06-20 01:14:30 +12:00
|
|
|
} else {
|
2020-10-27 01:21:43 +13:00
|
|
|
cyan_ink = 0.0f;
|
|
|
|
magenta_ink = 0.0f;
|
|
|
|
yellow_ink = 0.0f;
|
2016-06-20 01:14:30 +12:00
|
|
|
}
|
2016-09-06 09:06:50 +12:00
|
|
|
|
2016-06-20 01:14:30 +12:00
|
|
|
if (red_paper > green_paper) {
|
|
|
|
if (blue_paper > red_paper) {
|
2020-10-27 01:21:43 +13:00
|
|
|
black_paper = 1.0f - blue_paper;
|
2016-06-20 01:14:30 +12:00
|
|
|
} else {
|
2020-10-27 01:21:43 +13:00
|
|
|
black_paper = 1.0f - red_paper;
|
2016-06-20 01:14:30 +12:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if (blue_paper > red_paper) {
|
2020-10-27 01:21:43 +13:00
|
|
|
black_paper = 1.0f - blue_paper;
|
2016-06-20 01:14:30 +12:00
|
|
|
} else {
|
2020-10-27 01:21:43 +13:00
|
|
|
black_paper = 1.0f - green_paper;
|
2016-06-20 01:14:30 +12:00
|
|
|
}
|
|
|
|
}
|
2020-10-27 01:21:43 +13:00
|
|
|
if (black_paper < 1.0f) {
|
|
|
|
cyan_paper = (1.0f - red_paper - black_paper) / (1.0f - black_paper);
|
|
|
|
magenta_paper = (1.0f - green_paper - black_paper) / (1.0f - black_paper);
|
|
|
|
yellow_paper = (1.0f - blue_paper - black_paper) / (1.0f - black_paper);
|
2016-06-20 01:14:30 +12:00
|
|
|
} else {
|
2020-10-27 01:21:43 +13:00
|
|
|
cyan_paper = 0.0f;
|
|
|
|
magenta_paper = 0.0f;
|
|
|
|
yellow_paper = 0.0f;
|
2016-06-20 01:14:30 +12:00
|
|
|
}
|
2016-02-21 00:29:19 +13:00
|
|
|
|
2020-10-01 00:19:12 +13:00
|
|
|
for (i = 0, len = (int) ustrlen(symbol->text); i < len; i++) {
|
|
|
|
switch (symbol->text[i]) {
|
|
|
|
case '(':
|
|
|
|
case ')':
|
|
|
|
case '\\':
|
|
|
|
ps_len += 2;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
if (!iso_latin1 && symbol->text[i] >= 0x80) {
|
|
|
|
iso_latin1 = 1;
|
|
|
|
}
|
|
|
|
ps_len++; /* Will overcount 2 byte UTF-8 chars */
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-07-15 03:01:30 +12:00
|
|
|
ps_string = (unsigned char *) z_alloca(ps_len + 1);
|
2020-10-01 00:19:12 +13:00
|
|
|
|
2021-08-23 00:59:01 +12:00
|
|
|
/* Check for circle widths */
|
|
|
|
for (circle = symbol->vector->circles; circle; circle = circle->next) {
|
|
|
|
if (circle->width) {
|
|
|
|
have_circles_with_width = 1;
|
|
|
|
} else {
|
|
|
|
have_circles_without_width = 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-02-21 00:29:19 +13:00
|
|
|
/* Start writing the header */
|
|
|
|
fprintf(feps, "%%!PS-Adobe-3.0 EPSF-3.0\n");
|
2020-09-05 03:38:11 +12:00
|
|
|
if (ZINT_VERSION_BUILD) {
|
2021-06-10 22:15:39 +12:00
|
|
|
fprintf(feps, "%%%%Creator: Zint %d.%d.%d.%d\n",
|
|
|
|
ZINT_VERSION_MAJOR, ZINT_VERSION_MINOR, ZINT_VERSION_RELEASE, ZINT_VERSION_BUILD);
|
2020-09-05 03:38:11 +12:00
|
|
|
} else {
|
|
|
|
fprintf(feps, "%%%%Creator: Zint %d.%d.%d\n", ZINT_VERSION_MAJOR, ZINT_VERSION_MINOR, ZINT_VERSION_RELEASE);
|
|
|
|
}
|
2018-06-10 20:16:18 +12:00
|
|
|
fprintf(feps, "%%%%Title: Zint Generated Symbol\n");
|
2016-02-21 00:29:19 +13:00
|
|
|
fprintf(feps, "%%%%Pages: 0\n");
|
2021-06-10 22:15:39 +12:00
|
|
|
fprintf(feps, "%%%%BoundingBox: 0 0 %d %d\n",
|
2021-07-27 02:29:05 +12:00
|
|
|
(int) ceilf(symbol->vector->width), (int) ceilf(symbol->vector->height));
|
2016-02-21 00:29:19 +13:00
|
|
|
fprintf(feps, "%%%%EndComments\n");
|
|
|
|
|
|
|
|
/* Definitions */
|
2021-08-23 00:59:01 +12:00
|
|
|
if (have_circles_without_width) {
|
|
|
|
/* Disc: x y radius TD */
|
|
|
|
fprintf(feps, "/TD { newpath 0 360 arc fill } bind def\n");
|
|
|
|
}
|
|
|
|
if (have_circles_with_width) {
|
|
|
|
/* Circle (ring): x y radius width TC (adapted from BWIPP renmaxicode.ps) */
|
|
|
|
fprintf(feps, "/TC { newpath 4 1 roll 3 copy 0 360 arc closepath 4 -1 roll add 360 0 arcn closepath fill }"
|
|
|
|
" bind def\n");
|
|
|
|
}
|
|
|
|
if (symbol->vector->hexagons) {
|
|
|
|
fprintf(feps, "/TH { 0 setlinewidth moveto lineto lineto lineto lineto lineto closepath fill } bind def\n");
|
|
|
|
}
|
2016-02-21 00:29:19 +13:00
|
|
|
fprintf(feps, "/TB { 2 copy } bind def\n");
|
2021-08-23 00:59:01 +12:00
|
|
|
fprintf(feps, "/TR { newpath 4 1 roll exch moveto 1 index 0 rlineto 0 exch rlineto neg 0 rlineto closepath fill }"
|
|
|
|
" bind def\n");
|
2016-02-21 00:29:19 +13:00
|
|
|
fprintf(feps, "/TE { pop pop } bind def\n");
|
|
|
|
|
|
|
|
fprintf(feps, "newpath\n");
|
|
|
|
|
|
|
|
/* Now the actual representation */
|
2021-07-27 02:29:05 +12:00
|
|
|
|
2022-07-15 03:01:30 +12:00
|
|
|
/* Background */
|
2020-08-03 18:37:27 +12:00
|
|
|
if (draw_background) {
|
|
|
|
if ((symbol->output_options & CMYK_COLOUR) == 0) {
|
|
|
|
fprintf(feps, "%.2f %.2f %.2f setrgbcolor\n", red_paper, green_paper, blue_paper);
|
|
|
|
} else {
|
|
|
|
fprintf(feps, "%.2f %.2f %.2f %.2f setcmykcolor\n", cyan_paper, magenta_paper, yellow_paper, black_paper);
|
|
|
|
}
|
2021-07-27 02:29:05 +12:00
|
|
|
|
2020-08-03 18:37:27 +12:00
|
|
|
fprintf(feps, "%.2f 0.00 TB 0.00 %.2f TR\n", symbol->vector->height, symbol->vector->width);
|
|
|
|
fprintf(feps, "TE\n");
|
2016-06-20 01:14:30 +12:00
|
|
|
}
|
2016-02-21 00:29:19 +13:00
|
|
|
|
2020-01-07 07:00:43 +13:00
|
|
|
if (symbol->symbology != BARCODE_ULTRA) {
|
|
|
|
if ((symbol->output_options & CMYK_COLOUR) == 0) {
|
|
|
|
fprintf(feps, "%.2f %.2f %.2f setrgbcolor\n", red_ink, green_ink, blue_ink);
|
|
|
|
} else {
|
|
|
|
fprintf(feps, "%.2f %.2f %.2f %.2f setcmykcolor\n", cyan_ink, magenta_ink, yellow_ink, black_ink);
|
|
|
|
}
|
2016-02-21 00:29:19 +13:00
|
|
|
}
|
2020-01-06 00:27:24 +13:00
|
|
|
|
2022-07-15 03:01:30 +12:00
|
|
|
/* Rectangles */
|
2020-01-07 07:00:43 +13:00
|
|
|
if (symbol->symbology == BARCODE_ULTRA) {
|
2021-07-27 02:29:05 +12:00
|
|
|
colour_rect_flag = 0;
|
|
|
|
rect = symbol->vector->rectangles;
|
|
|
|
while (rect) {
|
2022-07-15 03:01:30 +12:00
|
|
|
if (rect->colour == -1) { /* Foreground */
|
2021-07-27 02:29:05 +12:00
|
|
|
if (colour_rect_flag == 0) {
|
2022-07-15 03:01:30 +12:00
|
|
|
/* Set foreground colour */
|
2021-07-27 02:29:05 +12:00
|
|
|
if ((symbol->output_options & CMYK_COLOUR) == 0) {
|
|
|
|
fprintf(feps, "%.2f %.2f %.2f setrgbcolor\n", red_ink, green_ink, blue_ink);
|
|
|
|
} else {
|
|
|
|
fprintf(feps, "%.2f %.2f %.2f %.2f setcmykcolor\n",
|
|
|
|
cyan_ink, magenta_ink, yellow_ink, black_ink);
|
|
|
|
}
|
|
|
|
colour_rect_flag = 1;
|
|
|
|
}
|
|
|
|
fprintf(feps, "%.2f %.2f TB %.2f %.2f TR\n",
|
|
|
|
rect->height, (symbol->vector->height - rect->y) - rect->height, rect->x, rect->width);
|
|
|
|
fprintf(feps, "TE\n");
|
|
|
|
}
|
|
|
|
rect = rect->next;
|
|
|
|
}
|
|
|
|
for (colour_index = 1; colour_index <= 8; colour_index++) {
|
|
|
|
colour_rect_flag = 0;
|
2020-01-07 07:00:43 +13:00
|
|
|
rect = symbol->vector->rectangles;
|
|
|
|
while (rect) {
|
|
|
|
if (rect->colour == colour_index) {
|
2021-07-27 02:29:05 +12:00
|
|
|
if (colour_rect_flag == 0) {
|
2022-07-15 03:01:30 +12:00
|
|
|
/* Set new colour */
|
2020-01-07 07:00:43 +13:00
|
|
|
colour_to_pscolor(symbol->output_options, colour_index, ps_color);
|
|
|
|
fprintf(feps, "%s\n", ps_color);
|
2021-07-27 02:29:05 +12:00
|
|
|
colour_rect_flag = 1;
|
2020-01-07 07:00:43 +13:00
|
|
|
}
|
2021-06-10 22:15:39 +12:00
|
|
|
fprintf(feps, "%.2f %.2f TB %.2f %.2f TR\n",
|
|
|
|
rect->height, (symbol->vector->height - rect->y) - rect->height, rect->x, rect->width);
|
2020-01-07 07:00:43 +13:00
|
|
|
fprintf(feps, "TE\n");
|
|
|
|
}
|
|
|
|
rect = rect->next;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
rect = symbol->vector->rectangles;
|
|
|
|
while (rect) {
|
2021-06-10 22:15:39 +12:00
|
|
|
fprintf(feps, "%.2f %.2f TB %.2f %.2f TR\n",
|
|
|
|
rect->height, (symbol->vector->height - rect->y) - rect->height, rect->x, rect->width);
|
2020-01-07 07:00:43 +13:00
|
|
|
fprintf(feps, "TE\n");
|
|
|
|
rect = rect->next;
|
|
|
|
}
|
2018-06-10 20:16:18 +12:00
|
|
|
}
|
2020-01-06 00:27:24 +13:00
|
|
|
|
2022-07-15 03:01:30 +12:00
|
|
|
/* Hexagons */
|
2020-10-27 01:21:43 +13:00
|
|
|
previous_diameter = radius = half_radius = half_sqrt3_radius = 0.0f;
|
2018-06-10 20:16:18 +12:00
|
|
|
hex = symbol->vector->hexagons;
|
|
|
|
while (hex) {
|
2020-10-27 01:21:43 +13:00
|
|
|
if (previous_diameter != hex->diameter) {
|
|
|
|
previous_diameter = hex->diameter;
|
|
|
|
radius = (float) (0.5 * previous_diameter);
|
|
|
|
half_radius = (float) (0.25 * previous_diameter);
|
|
|
|
half_sqrt3_radius = (float) (0.43301270189221932338 * previous_diameter);
|
|
|
|
}
|
2020-08-06 08:23:11 +12:00
|
|
|
if ((hex->rotation == 0) || (hex->rotation == 180)) {
|
2020-10-27 01:21:43 +13:00
|
|
|
ay = (symbol->vector->height - hex->y) + radius;
|
|
|
|
by = (symbol->vector->height - hex->y) + half_radius;
|
|
|
|
cy = (symbol->vector->height - hex->y) - half_radius;
|
|
|
|
dy = (symbol->vector->height - hex->y) - radius;
|
|
|
|
ey = (symbol->vector->height - hex->y) - half_radius;
|
|
|
|
fy = (symbol->vector->height - hex->y) + half_radius;
|
2020-08-06 08:23:11 +12:00
|
|
|
ax = hex->x;
|
2020-10-27 01:21:43 +13:00
|
|
|
bx = hex->x + half_sqrt3_radius;
|
|
|
|
cx = hex->x + half_sqrt3_radius;
|
2020-08-06 08:23:11 +12:00
|
|
|
dx = hex->x;
|
2020-10-27 01:21:43 +13:00
|
|
|
ex = hex->x - half_sqrt3_radius;
|
|
|
|
fx = hex->x - half_sqrt3_radius;
|
2020-08-06 08:23:11 +12:00
|
|
|
} else {
|
|
|
|
ay = (symbol->vector->height - hex->y);
|
2020-10-27 01:21:43 +13:00
|
|
|
by = (symbol->vector->height - hex->y) + half_sqrt3_radius;
|
|
|
|
cy = (symbol->vector->height - hex->y) + half_sqrt3_radius;
|
2020-08-06 08:23:11 +12:00
|
|
|
dy = (symbol->vector->height - hex->y);
|
2020-10-27 01:21:43 +13:00
|
|
|
ey = (symbol->vector->height - hex->y) - half_sqrt3_radius;
|
|
|
|
fy = (symbol->vector->height - hex->y) - half_sqrt3_radius;
|
|
|
|
ax = hex->x - radius;
|
|
|
|
bx = hex->x - half_radius;
|
|
|
|
cx = hex->x + half_radius;
|
|
|
|
dx = hex->x + radius;
|
|
|
|
ex = hex->x + half_radius;
|
|
|
|
fx = hex->x - half_radius;
|
2020-08-06 08:23:11 +12:00
|
|
|
}
|
2021-06-10 22:15:39 +12:00
|
|
|
fprintf(feps, "%.2f %.2f %.2f %.2f %.2f %.2f %.2f %.2f %.2f %.2f %.2f %.2f TH\n",
|
|
|
|
ax, ay, bx, by, cx, cy, dx, dy, ex, ey, fx, fy);
|
2018-06-10 20:16:18 +12:00
|
|
|
hex = hex->next;
|
|
|
|
}
|
2020-01-06 00:27:24 +13:00
|
|
|
|
2022-07-15 03:01:30 +12:00
|
|
|
/* Circles */
|
2020-10-27 01:21:43 +13:00
|
|
|
previous_diameter = radius = 0.0f;
|
2018-06-10 20:16:18 +12:00
|
|
|
circle = symbol->vector->circles;
|
|
|
|
while (circle) {
|
2021-08-23 00:59:01 +12:00
|
|
|
if (previous_diameter != circle->diameter - circle->width) {
|
|
|
|
previous_diameter = circle->diameter - circle->width;
|
2020-10-27 01:21:43 +13:00
|
|
|
radius = (float) (0.5 * previous_diameter);
|
|
|
|
}
|
2018-06-10 20:16:18 +12:00
|
|
|
if (circle->colour) {
|
2022-07-15 03:01:30 +12:00
|
|
|
/* A 'white' circle */
|
2016-06-20 01:14:30 +12:00
|
|
|
if ((symbol->output_options & CMYK_COLOUR) == 0) {
|
2018-06-10 20:16:18 +12:00
|
|
|
fprintf(feps, "%.2f %.2f %.2f setrgbcolor\n", red_paper, green_paper, blue_paper);
|
2016-06-20 01:14:30 +12:00
|
|
|
} else {
|
2021-06-10 22:15:39 +12:00
|
|
|
fprintf(feps, "%.2f %.2f %.2f %.2f setcmykcolor\n",
|
|
|
|
cyan_paper, magenta_paper, yellow_paper, black_paper);
|
2016-02-21 00:29:19 +13:00
|
|
|
}
|
2021-08-23 00:59:01 +12:00
|
|
|
if (circle->width) {
|
|
|
|
fprintf(feps, "%.2f %.2f %.3f %.3f TC\n",
|
|
|
|
circle->x, (symbol->vector->height - circle->y), radius, circle->width);
|
|
|
|
} else {
|
|
|
|
fprintf(feps, "%.2f %.2f %.2f TD\n", circle->x, (symbol->vector->height - circle->y), radius);
|
|
|
|
}
|
2018-06-10 20:16:18 +12:00
|
|
|
if (circle->next) {
|
2016-08-29 03:38:02 +12:00
|
|
|
if ((symbol->output_options & CMYK_COLOUR) == 0) {
|
|
|
|
fprintf(feps, "%.2f %.2f %.2f setrgbcolor\n", red_ink, green_ink, blue_ink);
|
|
|
|
} else {
|
|
|
|
fprintf(feps, "%.2f %.2f %.2f %.2f setcmykcolor\n", cyan_ink, magenta_ink, yellow_ink, black_ink);
|
|
|
|
}
|
|
|
|
}
|
2016-06-20 01:14:30 +12:00
|
|
|
} else {
|
2022-07-15 03:01:30 +12:00
|
|
|
/* A 'black' circle */
|
2021-08-23 00:59:01 +12:00
|
|
|
if (circle->width) {
|
|
|
|
fprintf(feps, "%.2f %.2f %.3f %.3f TC\n",
|
|
|
|
circle->x, (symbol->vector->height - circle->y), radius, circle->width);
|
|
|
|
} else {
|
|
|
|
fprintf(feps, "%.2f %.2f %.2f TD\n", circle->x, (symbol->vector->height - circle->y), radius);
|
|
|
|
}
|
2016-06-19 22:59:09 +12:00
|
|
|
}
|
2018-06-10 20:16:18 +12:00
|
|
|
circle = circle->next;
|
2016-06-19 22:59:09 +12:00
|
|
|
}
|
2020-01-06 00:27:24 +13:00
|
|
|
|
2022-07-15 03:01:30 +12:00
|
|
|
/* Text */
|
2020-10-01 00:19:12 +13:00
|
|
|
|
2018-06-10 20:16:18 +12:00
|
|
|
string = symbol->vector->strings;
|
2020-08-06 08:23:11 +12:00
|
|
|
|
2020-10-01 00:19:12 +13:00
|
|
|
if (string) {
|
2021-06-10 22:15:39 +12:00
|
|
|
if ((symbol->output_options & BOLD_TEXT)
|
|
|
|
&& (!is_extendable(symbol->symbology) || (symbol->output_options & SMALL_TEXT))) {
|
2020-10-01 00:19:12 +13:00
|
|
|
font = "Helvetica-Bold";
|
|
|
|
} else {
|
|
|
|
font = "Helvetica";
|
|
|
|
}
|
2021-06-10 22:15:39 +12:00
|
|
|
if (iso_latin1) {
|
|
|
|
/* Change encoding to ISO 8859-1, see Postscript Language Reference Manual 2nd Edition Example 5.6 */
|
2020-10-01 00:19:12 +13:00
|
|
|
fprintf(feps, "/%s findfont\n", font);
|
|
|
|
fprintf(feps, "dup length dict begin\n");
|
|
|
|
fprintf(feps, "{1 index /FID ne {def} {pop pop} ifelse} forall\n");
|
|
|
|
fprintf(feps, "/Encoding ISOLatin1Encoding def\n");
|
|
|
|
fprintf(feps, "currentdict\n");
|
|
|
|
fprintf(feps, "end\n");
|
|
|
|
fprintf(feps, "/Helvetica-ISOLatin1 exch definefont pop\n");
|
|
|
|
font = "Helvetica-ISOLatin1";
|
|
|
|
}
|
2021-02-11 11:37:59 +13:00
|
|
|
do {
|
|
|
|
ps_convert(string->text, ps_string);
|
|
|
|
fprintf(feps, "matrix currentmatrix\n");
|
|
|
|
fprintf(feps, "/%s findfont\n", font);
|
|
|
|
fprintf(feps, "%.2f scalefont setfont\n", string->fsize);
|
2021-06-10 22:15:39 +12:00
|
|
|
fprintf(feps, " 0 0 moveto %.2f %.2f translate 0.00 rotate 0 0 moveto\n",
|
|
|
|
string->x, (symbol->vector->height - string->y));
|
2021-02-11 11:37:59 +13:00
|
|
|
if (string->halign == 0 || string->halign == 2) { /* Need width for middle or right align */
|
|
|
|
fprintf(feps, " (%s) stringwidth\n", ps_string);
|
|
|
|
}
|
|
|
|
if (string->rotation != 0) {
|
|
|
|
fprintf(feps, "gsave\n");
|
|
|
|
fprintf(feps, "%d rotate\n", 360 - string->rotation);
|
|
|
|
}
|
|
|
|
if (string->halign == 0 || string->halign == 2) {
|
|
|
|
fprintf(feps, "pop\n");
|
|
|
|
fprintf(feps, "%s 0 rmoveto\n", string->halign == 2 ? "neg" : "-2 div");
|
|
|
|
}
|
|
|
|
fprintf(feps, " (%s) show\n", ps_string);
|
|
|
|
if (string->rotation != 0) {
|
|
|
|
fprintf(feps, "grestore\n");
|
|
|
|
}
|
|
|
|
fprintf(feps, "setmatrix\n");
|
|
|
|
string = string->next;
|
|
|
|
} while (string);
|
2016-02-21 00:29:19 +13:00
|
|
|
}
|
2020-01-06 00:27:24 +13:00
|
|
|
|
2021-07-27 02:29:05 +12:00
|
|
|
if (output_to_stdout) {
|
2016-02-21 00:29:19 +13:00
|
|
|
fflush(feps);
|
|
|
|
} else {
|
|
|
|
fclose(feps);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (locale)
|
|
|
|
setlocale(LC_ALL, locale);
|
|
|
|
|
|
|
|
return error_number;
|
2008-07-14 09:15:55 +12:00
|
|
|
}
|
RMQR: update to ISO/IEC 23941:2022 - R13x77 numeric cclens change 8 -> 7
QRCODE: use stricter interpretation of ZINT_FULL_MULTIBYTE, excluding
certain trailing bytes
libzint: fix some confusing error messages introduced by segment stuff
general: new escape chars \U, \d and \o
backend_qt: fudge rendering of border rectangles due to scaling/translation
rounding errors TODO: better fudge
GUI: foreground/background colours -> text boxes and icon buttons, add swap
button, independently movable picker (NULL parent), preview colour changes,
preview Data Window changes, add clear data (del) buttons, add zap button
and Factory Reset menu option, various other fixes
libzint: remove STATIC_UNLESS_ZINT_TEST, use wrappers
CMake: add find package QtSvg, remove QtXml
manual: split symbology and general specs and sort, move DAFT to 4-state,
UPC/EAN -> EAN/UPC, DataBar -> GS1 DataBar always, expand MAILMARK info,
various other fiddlings
man page: options or -> |, expand MSI Plessey check digit options
README.linux: add packages info
license: add SPDX-License-Identifier to touched files
2022-06-10 08:52:02 +12:00
|
|
|
|
|
|
|
/* vim: set ts=4 sw=4 et : */
|