Verifone vx520 更改打印机字体

Verifone vx520 change printer font

我想更改 Verifone vx520 内部打印机字体。 我用 C 语言编写了我的程序,并使用字体设计器工具来创建打印机字体。我已经使用 <ESC>m<s><t> 命令下载字体 table 但我仍然无法更改打印机的字体。 我该怎么做?

您可以考虑在 520 上使用 "p3700_" 函数,而不是直接使用转义序列。具体来说,您需要 p3700_dnld_font_file() 和 p3700_select_font()。

根据文档:

#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
);

文档也将此作为示例程序的一部分(稍作修改):

//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);

我已经用 p3700_ 打印函数和 p3300_ 函数对此进行了测试,它们似乎都可以正常工作。故障排除的一些注意事项:

  1. 确保在您的代码中包含 #include <printer.h>
  2. 保存字体文件时,select正确的打印机类型。如果您使用 p3700 函数调用,请另存为 "Verix 37xx" 打印机类型。如果您使用 p3300 调用,则保存为 "Verix 33xx".
  3. 如果您要复制示例代码,则需要确保您的自定义字体大小为 16x16,并将其保存为字体 table 1(select 字体 table 在您 select 打印机类型的同一对话框中)。如果你做一些不同的事情,你需要相应地改变 p3700_select_font
  4. 一定要记得下载字体到终端
  5. 检查函数的 return 值。例如,open 应该 return 一个正的文件句柄号,p3700_dnld_font_file 应该 return 下载的字体字符数,等等。

是关于打印图形的类似问答。


如果您想坚持使用转义序列,我不确定您从哪里得到 <ESC>m<s><t>。 23230_Verix_V_Operating_system_programmers_Manual 显示:

<ESC>m<c><r1>...<rn>; Downloads fonts into memory.

然后

<ESC>l<s><t>; Selects font table for printing and downloading.

就个人而言,除了切换双倍宽度、双倍高度和反转之外,我倾向于避免使用转义序列。