gpt4 book ai didi

point-of-sale - Verifone vx520 更改打印机字体

转载 作者:行者123 更新时间:2023-12-04 08:15:37 32 4
gpt4 key购买 nike

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

最佳答案

与其使用直接转义序列,不如考虑在 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. 保存字体文件时,选择正确的打印机类型。如果您使用 p3700函数调用,另存为“Verix 37xx”打印机类型。如果您使用 p3300调用,然后另存为“Verix 33xx”。
  3. 如果要复制示例代码,则需要确保自定义字体大小为 16x16 并将其保存到字体表 1(在选择打印机类型的同一对话框中选择字体表)。如果你做一些不同的事情,你需要改变 p3700_select_font相应地。
  4. 一定要记得下载字体到终端。
  5. 检查函数的返回值。例如,open应该返回一个正文件句柄号和 p3700_dnld_font_file应返回下载的字体字符数等。

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


如果您想坚持使用转义序列,我不确定您从哪里得到 <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.

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

关于point-of-sale - Verifone vx520 更改打印机字体,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29949851/

32 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com