printing out cjk ok,but not perfect,need more advanced space between here and there

This commit is contained in:
cuu 2022-02-20 02:34:40 -06:00
parent 4218cd1e88
commit 9a21d046e0
3 changed files with 13 additions and 4 deletions

View File

@ -103,7 +103,7 @@ void init_printer(){
current_font.height = 16;
current_font.data= font_ttf_Px437_PS2thin1_8x16;
current_font.file = "NotoSansCJK-Regular.ttf";
current_font.mode = 1;
current_font.mode = FONT_MODE_1;
ser_cache.idx=0;
ser_cache.utf8idx = 0;
@ -112,6 +112,7 @@ void init_printer(){
g_config.face = face;
g_config.ft = ft;
}else {
printf("init_ft error %s\n",error);
g_config.face = NULL;
g_config.ft = NULL;
}
@ -664,6 +665,7 @@ void parse_serial_stream(CONFIG*cfg,uint8_t input_ch){
reset_cmd();
break;
case ASCII_FF:
print_lines8(cfg);
reset_cmd();
break;

View File

@ -448,7 +448,8 @@ uint8_t print_lines_ft(CONFIG*cfg) {
uint32_t codename;
uint8_t *ch;
printf("left = %d\n",left);
while( left>0 ) {
i = lastidx;
while(row<current_font.height){
@ -457,10 +458,10 @@ uint8_t print_lines_ft(CONFIG*cfg) {
dot_line_bitsidx = line_bits%8;
memset(dot_line_data,0,MAXPIXELS);
//line by line bitmap dots to print
i = lastidx;
while( i <ser_cache.idx) {
ch = (uint8_t*)&ser_cache.data[i];
codename = utf8_to_utf32(ch);
FT_UInt gi = FT_Get_Char_Index ( cfg->face, codename);
FT_Load_Glyph (cfg->face, gi, FT_LOAD_DEFAULT);
int bbox_ymax = cfg->face->bbox.yMax / 64;
@ -487,7 +488,7 @@ uint8_t print_lines_ft(CONFIG*cfg) {
if(p) {
dot_line_data[dot_line_idx ] |= 1<<(7-dot_line_bitsidx);
}
dot_line_bitsidx++;
w++;
line_bits++;
@ -548,6 +549,10 @@ uint8_t print_lines_ft(CONFIG*cfg) {
uint8_t print_lines8(CONFIG*cfg) {
if(cfg->font->mode == FONT_MODE_1) {
return print_lines_ft(cfg);
}
uint8_t i,j,k;
int8_t w;
uint8_t *data;
@ -563,6 +568,7 @@ uint8_t print_lines8(CONFIG*cfg) {
uint8_t lastidx,lastw,lastj;
int8_t left;
uint8_t rv;
pad = current_font.width %BITS8;

View File

@ -30,6 +30,7 @@ uint16_t read_adc(char*);
uint16_t temperature();
int glob_file(char*);
uint8_t print_lines_ft(CONFIG*);
uint8_t print_lines8(CONFIG*);
uint8_t invert_bit(uint8_t a);