[英]Verifone vx520 change printer font
I want to change the Verifone vx520 internal printer font. 我想更改Verifone vx520内置打印机字体。 I have written my program in C and I used the Font Designer Tool for creating the printer font.
我用C语言编写程序,然后使用字体设计器工具创建打印机字体。 I have used the
<ESC>m<s><t>
command to download font table but I still can't change the printer's font. 我使用
<ESC>m<s><t>
命令下载字体表但我仍然无法更改打印机的字体。 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(). 您可以考虑在520上使用“p3700_”函数,而不是使用直接转义序列。具体来说,您需要p3700_dnld_font_file()和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. 我用p3700_打印功能和p3300_功能对它进行了测试,它们似乎都运行良好。 A few notes for troubleshooting:
一些故障排除说明:
#include <printer.h>
in your code #include <printer.h>
p3700
function calls, save as a "Verix 37xx" printer type. p3700
函数调用,请另存为“Verix 37xx”打印机类型。 If you are using p3300
calls, then save as "Verix 33xx". p3300
呼叫,请另存为“Verix 33xx”。 p3700_select_font
accordingly. p3700_select_font
。 open
should return a positive file handle number and p3700_dnld_font_file
should return the number of font characters that were downloaded, etc. open
应返回正文件句柄号, p3700_dnld_font_file
应返回已下载的字体字符数等。 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. 如果你想坚持使用转义序列,我不知道你从哪里得到
<ESC>m<s><t>
。 23230_Verix_V_Operating_system_programmers_Manual shows: 23230_Verix_V_Operating_system_programmers_Manual显示:
<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. 就个人而言,除了切换双宽,双高和反向之外,我倾向于避免除了转换之外的所有事情的转义序列。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.