我使用此代码下载并选择我的字体到打印机并打印字符
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <svc.h>
#include <printer.h>
int main() {
int retVal;
int handle;
open_block_t parm;
int h_font_file;
char print[32] = {43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43};
handle = open("/dev/com4", 0);
memset(&parm, 0, sizeof (parm));
parm.rate = Rt_19200;
parm.format = Fmt_A8N1 | Fmt_auto | Fmt_RTS;
parm.protocol = P_char_mode;
parm.parameter = 0;
set_opn_blk(handle, &parm);
SVC_WAIT(200);
p3700_init(handle, 6);
SVC_WAIT(100);
/****************SETUP FONT******************/
h_font_file = open("8x16.pft", O_RDONLY); //load font
retVal = p3700_dnld_font_file(handle, h_font_file, 2); //set font
SVC_WAIT(100);
retVal = p3700_select_font(handle, 0x03, 2);
retVal = write(handle, print, 32);
printf("printf: %d\n", retVal);
retVal = write(handle, "\n\n\n\n", 4);
SVC_WAIT(100);
return 0;
}