Verifone vx520 change printer font
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:
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 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_ and p3300_ print functions and both work fine. A few notes for troubleshooting:
- Make sure in your code
- Select the correct printer type when saving the font file. If you are using function calls
, save them as type "Verix 37xx". If you use calls
, 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
- Be sure to forget to download the font to the terminal.
- Check the return values of the function. For example,
should return a positive file descriptor number, but
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
. 23230_Verix_V_Operating_system_programmers_Manual shows:
<ESC>m<c><r1>...<rn>; Downloads fonts into memory.
<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.
source to share