Verifone vx520 change printer font

I want to change the internal font of a Verifone vx520 printer. I wrote my program in C and I used the Designer Font tool to create a printer font. I used the command <ESC>m<s><t>

to load the font table, but I still cannot change the printer's font. How can i do this?


source to share

1 answer

Instead of using direct escape sequences, you can use the "p3700_" functions at 520. In particular, you will need 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 the sample program (slightly modified):

//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
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);
p3700_init(handle, 6);

// 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_ and p3300_ print functions and both work fine. A few notes for troubleshooting:

  • Make sure in your code #include <printer.h>

  • Select the correct printer type when saving the font file. If you are using function calls p3700

    , save them as type "Verix 37xx". If you use calls p3300

    , then save as "Verix 33xx".
  • If you copy the example code, you need to make sure your custom font size is 16x16 and you save it in font table 1 (select the font table in the same dialog where you select your printer type). If you do something different, you need to change p3700_select_font

  • Be sure to forget to download the font to the terminal.
  • Check the return values โ€‹โ€‹of the function. For example, open

    should return a positive file descriptor number, but p3700_dnld_font_file

    should return the number of fonts loaded, etc.

Here is a similar question and answer for printing graphics.

If you want to stick with escape sequences I'm not sure where you are getting it from <ESC>m<s><t>

. 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 escape sequences for everything except toggle double width, double height and inversion.



All Articles