diff --git a/Code/thermal_printer/devterm_thermal_printer.c b/Code/thermal_printer/devterm_thermal_printer.c index 9d64682..bcaf25d 100644 --- a/Code/thermal_printer/devterm_thermal_printer.c +++ b/Code/thermal_printer/devterm_thermal_printer.c @@ -711,7 +711,15 @@ void parse_serial_stream(CONFIG*cfg,uint8_t input_ch){ } //read utf8 codename // - a = (ser_cache.idx+1)*current_font.width+(ser_cache.idx)*0+ g_config.margin.width; + if(cfg->font->mode == FONT_MODE_1) { + + a = get_serial_cache_font_width(&g_config); + a+= (ser_cache.idx)*0+ g_config.margin.width; + + }else { + a = (ser_cache.idx+1)*current_font.width+(ser_cache.idx)*0+ g_config.margin.width; + + } if( a >= MAX_DOTS)//got enough points to print { if(cfg->font->mode == FONT_MODE_1){ diff --git a/Code/thermal_printer/printer.c b/Code/thermal_printer/printer.c index 39de6e0..438636f 100644 --- a/Code/thermal_printer/printer.c +++ b/Code/thermal_printer/printer.c @@ -422,6 +422,24 @@ int glob_file(char*av) { } #endif +uint16_t get_serial_cache_font_width(CONFIG*cfg) { + + int i; + uint8_t *ch; + uint32_t codename; + int w; + w = 0; + i = 0; + while( i face, codename); + FT_Load_Glyph ( cfg->face, gi, FT_LOAD_NO_BITMAP); + w += cfg->face->glyph->metrics.horiAdvance / 64; + i++; + } + return w+cfg->font->width; +} //print with freetype font dots glyph uint8_t print_lines_ft(CONFIG*cfg) { @@ -550,7 +568,6 @@ uint8_t print_lines_ft(CONFIG*cfg) { break; } - } rv = IsPaper(); if( rv == IS_PAPER) { diff --git a/Code/thermal_printer/printer.h b/Code/thermal_printer/printer.h index d8acc4d..a0b141b 100644 --- a/Code/thermal_printer/printer.h +++ b/Code/thermal_printer/printer.h @@ -29,7 +29,7 @@ void print_dots_8bit(CONFIG*cfg,uint8_t *Array, uint8_t characters,uint8_t feed_ uint16_t read_adc(char*); uint16_t temperature(); int glob_file(char*); - +uint16_t get_serial_cache_font_width(CONFIG*); uint8_t print_lines_ft(CONFIG*); uint8_t print_lines8(CONFIG*);