I want to change the Verifone vx520 internal printer font.
I have written my program in C and I used the Font Designer Tool for creating the printer font. I have used the <ESC>m<s><t>
command to download font table but I still can't change the printer's font.
How can I do it?
Rather than using the straight escape sequences, you may consider using the "p3700_" functions on a 520. Specifically, you will want p3700_dnld_font_file() and p3700_select_font().
According to the documentation:
#include <printer.h>
short p3700_dnld_font_file(short handle, //the open printer handle
short h_font_file, //the open file handle
short font_table //font table to select
);
short p3700_select_font(short h_comm_port, // the open printer handle
short font_size, // size of the font
short font_table // font table to select
);
The documentation also has this as part of an example program (modified slightly):
//Variable declarations
int handle; // file handle for the Printer
open_block_t parm; // structure to fill comm parameters for com port
int h_font_file; // handle to the font file
//open printer
handle = open("/dev/com4", 0);
//initialize printer
memset(&parm,0,sizeof(parm));
parm.rate = Rt_19200; // ITP is always set to 19200 baud
parm.format = Fmt_A8N1 | Fmt_auto |Fmt_RTS; // ITP is always set at 8N1
parm.protocol = P_char_mode;
parm.parameter = 0;
set_opn_blk(handle, &parm);
SVC_WAIT(200);
p3700_init(handle, 6);
SVC_WAIT(100);
// Download a 16x16 printer font file containing 128 chars from offset 0 to 127
h_font_file = open("16x16.pft", O_RDONLY);
// download the printer font file at font table 1
p3700_dnld_font_file (handle, h_font_file, 1);
strcpy((char *)printBuf,(const char *)"Printing 16x16 Font\n\n");
p3700_print(handle, printBuf);
p3700_select_font(handle, 0x01, 1);
// 0x01 corresponds to 16x16 font size
p3700_print(handle, printBuf);
I have tested this with both p3700_ print functions and p3300_ functions and they both seem to work fine. A few notes for troubleshooting:
#include <printer.h>
in your codep3700
function calls, save as a "Verix 37xx" printer type. If you are using p3300
calls, then save as "Verix 33xx".p3700_select_font
accordingly.open
should return a positive file handle number and p3700_dnld_font_file
should return the number of font characters that were downloaded, etc.Here is a similar question and answer regarding printing graphics.
If you want to stick with escape sequences, I'm not sure where you are getting <ESC>m<s><t>
from. 23230_Verix_V_Operating_system_programmers_Manual shows:
<ESC>m<c><r1>...<rn>; Downloads fonts into memory.
and then
<ESC>l<s><t>; Selects font table for printing and downloading.
Personally, I tend to avoid the escape sequences for everything other than toggling double wide, double height and inverse.