summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTae-Young Chung <ty83.chung@samsung.com>2015-09-08 15:06:14 +0900
committerTae-Young Chung <ty83.chung@samsung.com>2015-09-09 18:22:52 +0900
commit4f3e68a11484b0aaceceeba9c4c1bb42861d56b9 (patch)
tree50f1f995eaedfd52b19a963780bbca4aed88a8f8
parent944bd1c1f1c5bdd8843732dc5159cd66a9a0817a (diff)
downloadlibzint-4f3e68a11484b0aaceceeba9c4c1bb42861d56b9.tar.gz
libzint-4f3e68a11484b0aaceceeba9c4c1bb42861d56b9.tar.bz2
libzint-4f3e68a11484b0aaceceeba9c4c1bb42861d56b9.zip
Change-Id: I258e47db7a832af5f2c99b98677e8d254f689881 Signed-off-by: Tae-Young Chung <ty83.chung@samsung.com>
-rw-r--r--backend/png.c237
-rw-r--r--backend/ps.c307
2 files changed, 279 insertions, 265 deletions
diff --git a/backend/png.c b/backend/png.c
index e3522fe..085bbec 100644
--- a/backend/png.c
+++ b/backend/png.c
@@ -737,7 +737,7 @@ int png_plot(struct zint_symbol *symbol, int rotate_angle, int data_type)
local_text[0] = '\0';
}
- textdone = 0;
+ textdone = (symbol->show_hrt != 0) ? 0 : 1;
main_width = symbol->width;
strcpy(addon, "");
comp_offset = 0;
@@ -817,8 +817,8 @@ int png_plot(struct zint_symbol *symbol, int rotate_angle, int data_type)
}
}
addon[r] = '\0';
-
- if(tlen) {
+
+ if((symbol->show_hrt != 0) && tlen) {
textoffset = 9;
} else {
textoffset = 0;
@@ -827,7 +827,7 @@ int png_plot(struct zint_symbol *symbol, int rotate_angle, int data_type)
yoffset = symbol->border_width;
image_width = 2 * (symbol->width + xoffset + xoffset);
image_height = 2 * (symbol->height + textoffset + yoffset + yoffset);
-
+
if (!(pixelbuf = (char *) malloc(image_width * image_height))) {
printf("Insufficient memory for pixel buffer");
return ERROR_ENCODING_PROBLEM;
@@ -836,7 +836,7 @@ int png_plot(struct zint_symbol *symbol, int rotate_angle, int data_type)
*(pixelbuf + i) = '0';
}
}
-
+
if(((symbol->output_options & BARCODE_BOX) != 0) || ((symbol->output_options & BARCODE_BIND) != 0)) {
default_text_posn = image_height - 17;
} else {
@@ -905,29 +905,32 @@ int png_plot(struct zint_symbol *symbol, int rotate_angle, int data_type)
draw_bar(pixelbuf, (34 + xoffset) * 2, 1 * 2, (4 + (int)yoffset) * 2, 5 * 2, image_width, image_height);
draw_bar(pixelbuf, (64 + xoffset) * 2, 1 * 2, (4 + (int)yoffset) * 2, 5 * 2, image_width, image_height);
draw_bar(pixelbuf, (66 + xoffset) * 2, 1 * 2, (4 + (int)yoffset) * 2, 5 * 2, image_width, image_height);
- for(i = 0; i < 4; i++) {
- textpart[i] = symbol->text[i];
- }
- textpart[4] = '\0';
- textpos = 2 * (17 + xoffset);
-
- draw_string(pixelbuf, textpart, textpos, default_text_posn, smalltext, image_width, image_height);
- for(i = 0; i < 4; i++) {
- textpart[i] = symbol->text[i + 4];
- }
- textpart[4] = '\0';
- textpos = 2 * (50 + xoffset);
- draw_string(pixelbuf, textpart, textpos, default_text_posn, smalltext, image_width, image_height);
- textdone = 1;
- switch(strlen(addon)) {
- case 2:
- textpos = 2 * (xoffset + 86);
- draw_string(pixelbuf, addon, textpos, image_height - (addon_text_posn * 2) - 13, smalltext, image_width, image_height);
- break;
- case 5:
- textpos = 2 * (xoffset + 100);
- draw_string(pixelbuf, addon, textpos, image_height - (addon_text_posn * 2) - 13, smalltext, image_width, image_height);
- break;
+
+ if(symbol->show_hrt != 0) {
+ for(i = 0; i < 4; i++) {
+ textpart[i] = symbol->text[i];
+ }
+ textpart[4] = '\0';
+ textpos = 2 * (17 + xoffset);
+
+ draw_string(pixelbuf, textpart, textpos, default_text_posn, smalltext, image_width, image_height);
+ for(i = 0; i < 4; i++) {
+ textpart[i] = symbol->text[i + 4];
+ }
+ textpart[4] = '\0';
+ textpos = 2 * (50 + xoffset);
+ draw_string(pixelbuf, textpart, textpos, default_text_posn, smalltext, image_width, image_height);
+ textdone = 1;
+ switch(strlen(addon)) {
+ case 2:
+ textpos = 2 * (xoffset + 86);
+ draw_string(pixelbuf, addon, textpos, image_height - (addon_text_posn * 2) - 13, smalltext, image_width, image_height);
+ break;
+ case 5:
+ textpos = 2 * (xoffset + 100);
+ draw_string(pixelbuf, addon, textpos, image_height - (addon_text_posn * 2) - 13, smalltext, image_width, image_height);
+ break;
+ }
}
break;
@@ -941,42 +944,44 @@ int png_plot(struct zint_symbol *symbol, int rotate_angle, int data_type)
draw_bar(pixelbuf, (92 + xoffset) * 2, 1 * 2, (4 + (int)yoffset) * 2, 5 * 2, image_width, image_height);
draw_bar(pixelbuf, (94 + xoffset) * 2, 1 * 2, (4 + (int)yoffset) * 2, 5 * 2, image_width, image_height);
- textpart[0] = symbol->text[0];
- textpart[1] = '\0';
- textpos = 2 * (-7 + xoffset);
- draw_string(pixelbuf, textpart, textpos, default_text_posn, smalltext, image_width, image_height);
- for(i = 0; i < 6; i++) {
- textpart[i] = symbol->text[i + 1];
- }
- textpart[6] = '\0';
- textpos = 2 * (24 + xoffset);
- draw_string(pixelbuf, textpart, textpos, default_text_posn, smalltext, image_width, image_height);
- for(i = 0; i < 6; i++) {
- textpart[i] = symbol->text[i + 7];
- }
- textpart[6] = '\0';
- textpos = 2 * (71 + xoffset);
- draw_string(pixelbuf, textpart, textpos, default_text_posn, smalltext, image_width, image_height);
- textdone = 1;
- switch(strlen(addon)) {
- case 2:
- textpos = 2 * (xoffset + 114);
- draw_string(pixelbuf, addon, textpos, image_height - (addon_text_posn * 2) - 13, smalltext, image_width, image_height);
- break;
- case 5:
- textpos = 2 * (xoffset + 128);
- draw_string(pixelbuf, addon, textpos, image_height - (addon_text_posn * 2) - 13, smalltext, image_width, image_height);
- break;
+ if (symbol->show_hrt != 0) {
+ textpart[0] = symbol->text[0];
+ textpart[1] = '\0';
+ textpos = 2 * (-7 + xoffset);
+ draw_string(pixelbuf, textpart, textpos, default_text_posn, smalltext, image_width, image_height);
+ for(i = 0; i < 6; i++) {
+ textpart[i] = symbol->text[i + 1];
+ }
+ textpart[6] = '\0';
+ textpos = 2 * (24 + xoffset);
+ draw_string(pixelbuf, textpart, textpos, default_text_posn, smalltext, image_width, image_height);
+ for(i = 0; i < 6; i++) {
+ textpart[i] = symbol->text[i + 7];
+ }
+ textpart[6] = '\0';
+ textpos = 2 * (71 + xoffset);
+ draw_string(pixelbuf, textpart, textpos, default_text_posn, smalltext, image_width, image_height);
+ textdone = 1;
+ switch(strlen(addon)) {
+ case 2:
+ textpos = 2 * (xoffset + 114);
+ draw_string(pixelbuf, addon, textpos, image_height - (addon_text_posn * 2) - 13, smalltext, image_width, image_height);
+ break;
+ case 5:
+ textpos = 2 * (xoffset + 128);
+ draw_string(pixelbuf, addon, textpos, image_height - (addon_text_posn * 2) - 13, smalltext, image_width, image_height);
+ break;
+ }
+ break;
}
- break;
}
- }
+ }
if (((symbol->symbology == BARCODE_UPCA) && (symbol->rows == 1)) || (symbol->symbology == BARCODE_UPCA_CC)) {
/* guard bar extensions and text formatting for UPCA */
latch = 1;
-
+
i = 0 + comp_offset;
do {
block_width = 0;
@@ -1012,39 +1017,41 @@ int png_plot(struct zint_symbol *symbol, int rotate_angle, int data_type)
}
i += block_width;
} while (i < 96 + comp_offset);
- textpart[0] = symbol->text[0];
- textpart[1] = '\0';
- textpos = 2 * (-5 + xoffset);
- draw_string(pixelbuf, textpart, textpos, default_text_posn, smalltext, image_width, image_height);
- for(i = 0; i < 5; i++) {
- textpart[i] = symbol->text[i + 1];
- }
- textpart[5] = '\0';
- textpos = 2 * (27 + xoffset);
- draw_string(pixelbuf, textpart, textpos, default_text_posn, smalltext, image_width, image_height);
- for(i = 0; i < 5; i++) {
- textpart[i] = symbol->text[i + 6];
- }
- textpart[6] = '\0';
- textpos = 2 * (68 + xoffset);
- draw_string(pixelbuf, textpart, textpos, default_text_posn, smalltext, image_width, image_height);
- textpart[0] = symbol->text[11];
- textpart[1] = '\0';
- textpos = 2 * (100 + xoffset);
- draw_string(pixelbuf, textpart, textpos, default_text_posn, smalltext, image_width, image_height);
- textdone = 1;
- switch(strlen(addon)) {
- case 2:
- textpos = 2 * (xoffset + 116);
- draw_string(pixelbuf, addon, textpos, image_height - (addon_text_posn * 2) - 13, smalltext, image_width, image_height);
- break;
- case 5:
- textpos = 2 * (xoffset + 130);
- draw_string(pixelbuf, addon, textpos, image_height - (addon_text_posn * 2) - 13, smalltext, image_width, image_height);
- break;
- }
- }
+ if(symbol->show_hrt != 0) {
+ textpart[0] = symbol->text[0];
+ textpart[1] = '\0';
+ textpos = 2 * (-5 + xoffset);
+ draw_string(pixelbuf, textpart, textpos, default_text_posn, smalltext, image_width, image_height);
+ for(i = 0; i < 5; i++) {
+ textpart[i] = symbol->text[i + 1];
+ }
+ textpart[5] = '\0';
+ textpos = 2 * (27 + xoffset);
+ draw_string(pixelbuf, textpart, textpos, default_text_posn, smalltext, image_width, image_height);
+ for(i = 0; i < 5; i++) {
+ textpart[i] = symbol->text[i + 6];
+ }
+ textpart[6] = '\0';
+ textpos = 2 * (68 + xoffset);
+ draw_string(pixelbuf, textpart, textpos, default_text_posn, smalltext, image_width, image_height);
+ textpart[0] = symbol->text[11];
+ textpart[1] = '\0';
+ textpos = 2 * (100 + xoffset);
+ draw_string(pixelbuf, textpart, textpos, default_text_posn, smalltext, image_width, image_height);
+ textdone = 1;
+ switch(strlen(addon)) {
+ case 2:
+ textpos = 2 * (xoffset + 116);
+ draw_string(pixelbuf, addon, textpos, image_height - (addon_text_posn * 2) - 13, smalltext, image_width, image_height);
+ break;
+ case 5:
+ textpos = 2 * (xoffset + 130);
+ draw_string(pixelbuf, addon, textpos, image_height - (addon_text_posn * 2) - 13, smalltext, image_width, image_height);
+ break;
+ }
+ }
+ }
if (((symbol->symbology == BARCODE_UPCE) && (symbol->rows == 1)) || (symbol->symbology == BARCODE_UPCE_CC)) {
/* guard bar extensions and text formatting for UPCE */
@@ -1054,36 +1061,38 @@ int png_plot(struct zint_symbol *symbol, int rotate_angle, int data_type)
draw_bar(pixelbuf, (48 + xoffset) * 2, 1 * 2, (4 + (int)yoffset) * 2, 5 * 2, image_width, image_height);
draw_bar(pixelbuf, (50 + xoffset) * 2, 1 * 2, (4 + (int)yoffset) * 2, 5 * 2, image_width, image_height);
- textpart[0] = symbol->text[0];
- textpart[1] = '\0';
- textpos = 2 * (-5 + xoffset);
- draw_string(pixelbuf, textpart, textpos, default_text_posn, smalltext, image_width, image_height);
- for(i = 0; i < 6; i++) {
- textpart[i] = symbol->text[i + 1];
- }
- textpart[6] = '\0';
- textpos = 2 * (24 + xoffset);
- draw_string(pixelbuf, textpart, textpos, default_text_posn, smalltext, image_width, image_height);
- textpart[0] = symbol->text[7];
- textpart[1] = '\0';
- textpos = 2 * (55 + xoffset);
- draw_string(pixelbuf, textpart, textpos, default_text_posn, smalltext, image_width, image_height);
- textdone = 1;
- switch(strlen(addon)) {
- case 2:
- textpos = 2 * (xoffset + 70);
- draw_string(pixelbuf, addon, textpos, image_height - (addon_text_posn * 2) - 13, smalltext, image_width, image_height);
- break;
- case 5:
- textpos = 2 * (xoffset + 84);
- draw_string(pixelbuf, addon, textpos, image_height - (addon_text_posn * 2) - 13, smalltext, image_width, image_height);
- break;
+ if (symbol->show_hrt != 0) {
+ textpart[0] = symbol->text[0];
+ textpart[1] = '\0';
+ textpos = 2 * (-5 + xoffset);
+ draw_string(pixelbuf, textpart, textpos, default_text_posn, smalltext, image_width, image_height);
+ for(i = 0; i < 6; i++) {
+ textpart[i] = symbol->text[i + 1];
+ }
+ textpart[6] = '\0';
+ textpos = 2 * (24 + xoffset);
+ draw_string(pixelbuf, textpart, textpos, default_text_posn, smalltext, image_width, image_height);
+ textpart[0] = symbol->text[7];
+ textpart[1] = '\0';
+ textpos = 2 * (55 + xoffset);
+ draw_string(pixelbuf, textpart, textpos, default_text_posn, smalltext, image_width, image_height);
+ textdone = 1;
+ switch(strlen(addon)) {
+ case 2:
+ textpos = 2 * (xoffset + 70);
+ draw_string(pixelbuf, addon, textpos, image_height - (addon_text_posn * 2) - 13, smalltext, image_width, image_height);
+ break;
+ case 5:
+ textpos = 2 * (xoffset + 84);
+ draw_string(pixelbuf, addon, textpos, image_height - (addon_text_posn * 2) - 13, smalltext, image_width, image_height);
+ break;
+ }
}
}
xoffset -= comp_offset;
-
+
/* Put boundary bars or box around symbol */
if(((symbol->output_options & BARCODE_BOX) != 0) || ((symbol->output_options & BARCODE_BIND) != 0)) {
/* boundary bars */
diff --git a/backend/ps.c b/backend/ps.c
index ce7fca1..771d186 100644
--- a/backend/ps.c
+++ b/backend/ps.c
@@ -181,9 +181,10 @@ int ps_plot(struct zint_symbol *symbol)
}
}
addon[r] = '\0';
-
+
if((symbol->show_hrt == 0) || (ustrlen(symbol->text) == 0)) {
plot_text = 0;
+ textdone = 1;
}
if(plot_text) {
textoffset = 9;
@@ -192,7 +193,7 @@ int ps_plot(struct zint_symbol *symbol)
}
xoffset = symbol->border_width + symbol->whitespace_width;
yoffset = symbol->border_width;
-
+
/* Start writing the header */
fprintf(feps, "%%!PS-Adobe-3.0 EPSF-3.0\n");
fprintf(feps, "%%%%Creator: Zint %s\n", ZINT_VERSION);
@@ -475,7 +476,7 @@ int ps_plot(struct zint_symbol *symbol)
fprintf(feps, "setmatrix\n");
textdone = 1;
switch(strlen(addon)) {
- case 2:
+ case 2:
fprintf(feps, "matrix currentmatrix\n");
fprintf(feps, "/Helvetica findfont\n");
fprintf(feps, "%.2f scalefont setfont\n", 11.0 * scaler);
@@ -547,89 +548,91 @@ int ps_plot(struct zint_symbol *symbol)
}
i += block_width;
} while (i < 96 + comp_offset);
- textpart[0] = symbol->text[0];
- textpart[1] = '\0';
- fprintf(feps, "TE\n");
- fprintf(feps, "%.2f %.2f %.2f setrgbcolor\n", red_ink, green_ink, blue_ink);
- fprintf(feps, "matrix currentmatrix\n");
- fprintf(feps, "/Helvetica findfont\n");
- fprintf(feps, "%.2f scalefont setfont\n", 8.0 * scaler);
- textpos = -5;
- fprintf(feps, " 0 0 moveto %.2f %.2f translate 0.00 rotate 0 0 moveto\n", (textpos + xoffset) * scaler, default_text_posn);
- fprintf(feps, " (%s) stringwidth\n", textpart);
- fprintf(feps, "pop\n");
- fprintf(feps, "-2 div 0 rmoveto\n");
- fprintf(feps, " (%s) show\n", textpart);
- fprintf(feps, "setmatrix\n");
- for(i = 0; i < 5; i++) {
- textpart[i] = symbol->text[i + 1];
- }
- textpart[5] = '\0';
- fprintf(feps, "matrix currentmatrix\n");
- fprintf(feps, "/Helvetica findfont\n");
- fprintf(feps, "%.2f scalefont setfont\n", 11.0 * scaler);
- textpos = 27;
- fprintf(feps, " 0 0 moveto %.2f %.2f translate 0.00 rotate 0 0 moveto\n", (textpos + xoffset) * scaler, default_text_posn);
- fprintf(feps, " (%s) stringwidth\n", textpart);
- fprintf(feps, "pop\n");
- fprintf(feps, "-2 div 0 rmoveto\n");
- fprintf(feps, " (%s) show\n", textpart);
- fprintf(feps, "setmatrix\n");
- for(i = 0; i < 5; i++) {
- textpart[i] = symbol->text[i + 6];
- }
- textpart[6] = '\0';
- fprintf(feps, "matrix currentmatrix\n");
- fprintf(feps, "/Helvetica findfont\n");
- fprintf(feps, "%.2f scalefont setfont\n", 11.0 * scaler);
- textpos = 68;
- fprintf(feps, " 0 0 moveto %.2f %.2f translate 0.00 rotate 0 0 moveto\n", (textpos + xoffset) * scaler, default_text_posn);
- fprintf(feps, " (%s) stringwidth\n", textpart);
- fprintf(feps, "pop\n");
- fprintf(feps, "-2 div 0 rmoveto\n");
- fprintf(feps, " (%s) show\n", textpart);
- fprintf(feps, "setmatrix\n");
- textpart[0] = symbol->text[11];
- textpart[1] = '\0';
- fprintf(feps, "matrix currentmatrix\n");
- fprintf(feps, "/Helvetica findfont\n");
- fprintf(feps, "%.2f scalefont setfont\n", 8.0 * scaler);
- textpos = 100;
- fprintf(feps, " 0 0 moveto %.2f %.2f translate 0.00 rotate 0 0 moveto\n", (textpos + xoffset) * scaler, default_text_posn);
- fprintf(feps, " (%s) stringwidth\n", textpart);
- fprintf(feps, "pop\n");
- fprintf(feps, "-2 div 0 rmoveto\n");
- fprintf(feps, " (%s) show\n", textpart);
- fprintf(feps, "setmatrix\n");
- textdone = 1;
- switch(strlen(addon)) {
- case 2:
- fprintf(feps, "matrix currentmatrix\n");
- fprintf(feps, "/Helvetica findfont\n");
- fprintf(feps, "%.2f scalefont setfont\n", 11.0 * scaler);
- textpos = xoffset + 116;
- fprintf(feps, " 0 0 moveto %.2f %.2f translate 0.00 rotate 0 0 moveto\n", textpos * scaler, addon_text_posn * scaler);
- fprintf(feps, " (%s) stringwidth\n", addon);
- fprintf(feps, "pop\n");
- fprintf(feps, "-2 div 0 rmoveto\n");
- fprintf(feps, " (%s) show\n", addon);
- fprintf(feps, "setmatrix\n");
- break;
- case 5:
- fprintf(feps, "matrix currentmatrix\n");
- fprintf(feps, "/Helvetica findfont\n");
- fprintf(feps, "%.2f scalefont setfont\n", 11.0 * scaler);
- textpos = xoffset + 130;
- fprintf(feps, " 0 0 moveto %.2f %.2f translate 0.00 rotate 0 0 moveto\n", textpos * scaler, addon_text_posn * scaler);
- fprintf(feps, " (%s) stringwidth\n", addon);
- fprintf(feps, "pop\n");
- fprintf(feps, "-2 div 0 rmoveto\n");
- fprintf(feps, " (%s) show\n", addon);
- fprintf(feps, "setmatrix\n");
- break;
- }
- }
+ if(plot_text) {
+ textpart[0] = symbol->text[0];
+ textpart[1] = '\0';
+ fprintf(feps, "TE\n");
+ fprintf(feps, "%.2f %.2f %.2f setrgbcolor\n", red_ink, green_ink, blue_ink);
+ fprintf(feps, "matrix currentmatrix\n");
+ fprintf(feps, "/Helvetica findfont\n");
+ fprintf(feps, "%.2f scalefont setfont\n", 8.0 * scaler);
+ textpos = -5;
+ fprintf(feps, " 0 0 moveto %.2f %.2f translate 0.00 rotate 0 0 moveto\n", (textpos + xoffset) * scaler, default_text_posn);
+ fprintf(feps, " (%s) stringwidth\n", textpart);
+ fprintf(feps, "pop\n");
+ fprintf(feps, "-2 div 0 rmoveto\n");
+ fprintf(feps, " (%s) show\n", textpart);
+ fprintf(feps, "setmatrix\n");
+ for(i = 0; i < 5; i++) {
+ textpart[i] = symbol->text[i + 1];
+ }
+ textpart[5] = '\0';
+ fprintf(feps, "matrix currentmatrix\n");
+ fprintf(feps, "/Helvetica findfont\n");
+ fprintf(feps, "%.2f scalefont setfont\n", 11.0 * scaler);
+ textpos = 27;
+ fprintf(feps, " 0 0 moveto %.2f %.2f translate 0.00 rotate 0 0 moveto\n", (textpos + xoffset) * scaler, default_text_posn);
+ fprintf(feps, " (%s) stringwidth\n", textpart);
+ fprintf(feps, "pop\n");
+ fprintf(feps, "-2 div 0 rmoveto\n");
+ fprintf(feps, " (%s) show\n", textpart);
+ fprintf(feps, "setmatrix\n");
+ for(i = 0; i < 5; i++) {
+ textpart[i] = symbol->text[i + 6];
+ }
+ textpart[6] = '\0';
+ fprintf(feps, "matrix currentmatrix\n");
+ fprintf(feps, "/Helvetica findfont\n");
+ fprintf(feps, "%.2f scalefont setfont\n", 11.0 * scaler);
+ textpos = 68;
+ fprintf(feps, " 0 0 moveto %.2f %.2f translate 0.00 rotate 0 0 moveto\n", (textpos + xoffset) * scaler, default_text_posn);
+ fprintf(feps, " (%s) stringwidth\n", textpart);
+ fprintf(feps, "pop\n");
+ fprintf(feps, "-2 div 0 rmoveto\n");
+ fprintf(feps, " (%s) show\n", textpart);
+ fprintf(feps, "setmatrix\n");
+ textpart[0] = symbol->text[11];
+ textpart[1] = '\0';
+ fprintf(feps, "matrix currentmatrix\n");
+ fprintf(feps, "/Helvetica findfont\n");
+ fprintf(feps, "%.2f scalefont setfont\n", 8.0 * scaler);
+ textpos = 100;
+ fprintf(feps, " 0 0 moveto %.2f %.2f translate 0.00 rotate 0 0 moveto\n", (textpos + xoffset) * scaler, default_text_posn);
+ fprintf(feps, " (%s) stringwidth\n", textpart);
+ fprintf(feps, "pop\n");
+ fprintf(feps, "-2 div 0 rmoveto\n");
+ fprintf(feps, " (%s) show\n", textpart);
+ fprintf(feps, "setmatrix\n");
+ textdone = 1;
+ switch(strlen(addon)) {
+ case 2:
+ fprintf(feps, "matrix currentmatrix\n");
+ fprintf(feps, "/Helvetica findfont\n");
+ fprintf(feps, "%.2f scalefont setfont\n", 11.0 * scaler);
+ textpos = xoffset + 116;
+ fprintf(feps, " 0 0 moveto %.2f %.2f translate 0.00 rotate 0 0 moveto\n", textpos * scaler, addon_text_posn * scaler);
+ fprintf(feps, " (%s) stringwidth\n", addon);
+ fprintf(feps, "pop\n");
+ fprintf(feps, "-2 div 0 rmoveto\n");
+ fprintf(feps, " (%s) show\n", addon);
+ fprintf(feps, "setmatrix\n");
+ break;
+ case 5:
+ fprintf(feps, "matrix currentmatrix\n");
+ fprintf(feps, "/Helvetica findfont\n");
+ fprintf(feps, "%.2f scalefont setfont\n", 11.0 * scaler);
+ textpos = xoffset + 130;
+ fprintf(feps, " 0 0 moveto %.2f %.2f translate 0.00 rotate 0 0 moveto\n", textpos * scaler, addon_text_posn * scaler);
+ fprintf(feps, " (%s) stringwidth\n", addon);
+ fprintf(feps, "pop\n");
+ fprintf(feps, "-2 div 0 rmoveto\n");
+ fprintf(feps, " (%s) show\n", addon);
+ fprintf(feps, "setmatrix\n");
+ break;
+ }
+ }
+ }
if (((symbol->symbology == BARCODE_UPCE) && (symbol->rows == 1)) || (symbol->symbology == BARCODE_UPCE_CC)) {
/* guard bar extensions and text formatting for UPCE */
@@ -641,72 +644,74 @@ int ps_plot(struct zint_symbol *symbol)
fprintf(feps, "TB %.2f %.2f TR\n", (46 + xoffset) * scaler, 1 * scaler);
fprintf(feps, "TB %.2f %.2f TR\n", (48 + xoffset) * scaler, 1 * scaler);
fprintf(feps, "TB %.2f %.2f TR\n", (50 + xoffset) * scaler, 1 * scaler);
- textpart[0] = symbol->text[0];
- textpart[1] = '\0';
- fprintf(feps, "TE\n");
- fprintf(feps, "%.2f %.2f %.2f setrgbcolor\n", red_ink, green_ink, blue_ink);
- fprintf(feps, "matrix currentmatrix\n");
- fprintf(feps, "/Helvetica findfont\n");
- fprintf(feps, "%.2f scalefont setfont\n", 8.0 * scaler);
- textpos = -5;
- fprintf(feps, " 0 0 moveto %.2f %.2f translate 0.00 rotate 0 0 moveto\n", (textpos + xoffset) * scaler, default_text_posn);
- fprintf(feps, " (%s) stringwidth\n", textpart);
- fprintf(feps, "pop\n");
- fprintf(feps, "-2 div 0 rmoveto\n");
- fprintf(feps, " (%s) show\n", textpart);
- fprintf(feps, "setmatrix\n");
- for(i = 0; i < 6; i++) {
- textpart[i] = symbol->text[i + 1];
- }
- textpart[6] = '\0';
- fprintf(feps, "matrix currentmatrix\n");
- fprintf(feps, "/Helvetica findfont\n");
- fprintf(feps, "%.2f scalefont setfont\n", 11.0 * scaler);
- textpos = 24;
- fprintf(feps, " 0 0 moveto %.2f %.2f translate 0.00 rotate 0 0 moveto\n", (textpos + xoffset) * scaler, default_text_posn);
- fprintf(feps, " (%s) stringwidth\n", textpart);
- fprintf(feps, "pop\n");
- fprintf(feps, "-2 div 0 rmoveto\n");
- fprintf(feps, " (%s) show\n", textpart);
- fprintf(feps, "setmatrix\n");
- textpart[0] = symbol->text[7];
- textpart[1] = '\0';
- fprintf(feps, "matrix currentmatrix\n");
- fprintf(feps, "/Helvetica findfont\n");
- fprintf(feps, "%.2f scalefont setfont\n", 8.0 * scaler);
- textpos = 55;
- fprintf(feps, " 0 0 moveto %.2f %.2f translate 0.00 rotate 0 0 moveto\n", (textpos + xoffset) * scaler, default_text_posn);
- fprintf(feps, " (%s) stringwidth\n", textpart);
- fprintf(feps, "pop\n");
- fprintf(feps, "-2 div 0 rmoveto\n");
- fprintf(feps, " (%s) show\n", textpart);
- fprintf(feps, "setmatrix\n");
- textdone = 1;
- switch(strlen(addon)) {
- case 2:
- fprintf(feps, "matrix currentmatrix\n");
- fprintf(feps, "/Helvetica findfont\n");
- fprintf(feps, "%.2f scalefont setfont\n", 11.0 * scaler);
- textpos = xoffset + 70;
- fprintf(feps, " 0 0 moveto %.2f %.2f translate 0.00 rotate 0 0 moveto\n", textpos * scaler, addon_text_posn * scaler);
- fprintf(feps, " (%s) stringwidth\n", addon);
- fprintf(feps, "pop\n");
- fprintf(feps, "-2 div 0 rmoveto\n");
- fprintf(feps, " (%s) show\n", addon);
- fprintf(feps, "setmatrix\n");
- break;
- case 5:
- fprintf(feps, "matrix currentmatrix\n");
- fprintf(feps, "/Helvetica findfont\n");
- fprintf(feps, "%.2f scalefont setfont\n", 11.0 * scaler);
- textpos = xoffset + 84;
- fprintf(feps, " 0 0 moveto %.2f %.2f translate 0.00 rotate 0 0 moveto\n", textpos * scaler, addon_text_posn * scaler);
- fprintf(feps, " (%s) stringwidth\n", addon);
- fprintf(feps, "pop\n");
- fprintf(feps, "-2 div 0 rmoveto\n");
- fprintf(feps, " (%s) show\n", addon);
- fprintf(feps, "setmatrix\n");
- break;
+ if(plot_text) {
+ textpart[0] = symbol->text[0];
+ textpart[1] = '\0';
+ fprintf(feps, "TE\n");
+ fprintf(feps, "%.2f %.2f %.2f setrgbcolor\n", red_ink, green_ink, blue_ink);
+ fprintf(feps, "matrix currentmatrix\n");
+ fprintf(feps, "/Helvetica findfont\n");
+ fprintf(feps, "%.2f scalefont setfont\n", 8.0 * scaler);
+ textpos = -5;
+ fprintf(feps, " 0 0 moveto %.2f %.2f translate 0.00 rotate 0 0 moveto\n", (textpos + xoffset) * scaler, default_text_posn);
+ fprintf(feps, " (%s) stringwidth\n", textpart);
+ fprintf(feps, "pop\n");
+ fprintf(feps, "-2 div 0 rmoveto\n");
+ fprintf(feps, " (%s) show\n", textpart);
+ fprintf(feps, "setmatrix\n");
+ for(i = 0; i < 6; i++) {
+ textpart[i] = symbol->text[i + 1];
+ }
+ textpart[6] = '\0';
+ fprintf(feps, "matrix currentmatrix\n");
+ fprintf(feps, "/Helvetica findfont\n");
+ fprintf(feps, "%.2f scalefont setfont\n", 11.0 * scaler);
+ textpos = 24;
+ fprintf(feps, " 0 0 moveto %.2f %.2f translate 0.00 rotate 0 0 moveto\n", (textpos + xoffset) * scaler, default_text_posn);
+ fprintf(feps, " (%s) stringwidth\n", textpart);
+ fprintf(feps, "pop\n");
+ fprintf(feps, "-2 div 0 rmoveto\n");
+ fprintf(feps, " (%s) show\n", textpart);
+ fprintf(feps, "setmatrix\n");
+ textpart[0] = symbol->text[7];
+ textpart[1] = '\0';
+ fprintf(feps, "matrix currentmatrix\n");
+ fprintf(feps, "/Helvetica findfont\n");
+ fprintf(feps, "%.2f scalefont setfont\n", 8.0 * scaler);
+ textpos = 55;
+ fprintf(feps, " 0 0 moveto %.2f %.2f translate 0.00 rotate 0 0 moveto\n", (textpos + xoffset) * scaler, default_text_posn);
+ fprintf(feps, " (%s) stringwidth\n", textpart);
+ fprintf(feps, "pop\n");
+ fprintf(feps, "-2 div 0 rmoveto\n");
+ fprintf(feps, " (%s) show\n", textpart);
+ fprintf(feps, "setmatrix\n");
+ textdone = 1;
+ switch(strlen(addon)) {
+ case 2:
+ fprintf(feps, "matrix currentmatrix\n");
+ fprintf(feps, "/Helvetica findfont\n");
+ fprintf(feps, "%.2f scalefont setfont\n", 11.0 * scaler);
+ textpos = xoffset + 70;
+ fprintf(feps, " 0 0 moveto %.2f %.2f translate 0.00 rotate 0 0 moveto\n", textpos * scaler, addon_text_posn * scaler);
+ fprintf(feps, " (%s) stringwidth\n", addon);
+ fprintf(feps, "pop\n");
+ fprintf(feps, "-2 div 0 rmoveto\n");
+ fprintf(feps, " (%s) show\n", addon);
+ fprintf(feps, "setmatrix\n");
+ break;
+ case 5:
+ fprintf(feps, "matrix currentmatrix\n");
+ fprintf(feps, "/Helvetica findfont\n");
+ fprintf(feps, "%.2f scalefont setfont\n", 11.0 * scaler);
+ textpos = xoffset + 84;
+ fprintf(feps, " 0 0 moveto %.2f %.2f translate 0.00 rotate 0 0 moveto\n", textpos * scaler, addon_text_posn * scaler);
+ fprintf(feps, " (%s) stringwidth\n", addon);
+ fprintf(feps, "pop\n");
+ fprintf(feps, "-2 div 0 rmoveto\n");
+ fprintf(feps, " (%s) show\n", addon);
+ fprintf(feps, "setmatrix\n");
+ break;
+ }
}
}