mirror of
https://github.com/clockworkpi/DevTerm.git
synced 2025-12-15 03:38:50 +01:00
printing out cjk ok,but not perfect,need more advanced space between here and there
This commit is contained in:
parent
4218cd1e88
commit
9a21d046e0
@ -103,7 +103,7 @@ void init_printer(){
|
|||||||
current_font.height = 16;
|
current_font.height = 16;
|
||||||
current_font.data= font_ttf_Px437_PS2thin1_8x16;
|
current_font.data= font_ttf_Px437_PS2thin1_8x16;
|
||||||
current_font.file = "NotoSansCJK-Regular.ttf";
|
current_font.file = "NotoSansCJK-Regular.ttf";
|
||||||
current_font.mode = 1;
|
current_font.mode = FONT_MODE_1;
|
||||||
|
|
||||||
ser_cache.idx=0;
|
ser_cache.idx=0;
|
||||||
ser_cache.utf8idx = 0;
|
ser_cache.utf8idx = 0;
|
||||||
@ -112,6 +112,7 @@ void init_printer(){
|
|||||||
g_config.face = face;
|
g_config.face = face;
|
||||||
g_config.ft = ft;
|
g_config.ft = ft;
|
||||||
}else {
|
}else {
|
||||||
|
printf("init_ft error %s\n",error);
|
||||||
g_config.face = NULL;
|
g_config.face = NULL;
|
||||||
g_config.ft = NULL;
|
g_config.ft = NULL;
|
||||||
}
|
}
|
||||||
@ -664,6 +665,7 @@ void parse_serial_stream(CONFIG*cfg,uint8_t input_ch){
|
|||||||
reset_cmd();
|
reset_cmd();
|
||||||
break;
|
break;
|
||||||
case ASCII_FF:
|
case ASCII_FF:
|
||||||
|
|
||||||
print_lines8(cfg);
|
print_lines8(cfg);
|
||||||
reset_cmd();
|
reset_cmd();
|
||||||
break;
|
break;
|
||||||
|
|||||||
@ -448,7 +448,8 @@ uint8_t print_lines_ft(CONFIG*cfg) {
|
|||||||
|
|
||||||
uint32_t codename;
|
uint32_t codename;
|
||||||
uint8_t *ch;
|
uint8_t *ch;
|
||||||
|
printf("left = %d\n",left);
|
||||||
|
|
||||||
while( left>0 ) {
|
while( left>0 ) {
|
||||||
i = lastidx;
|
i = lastidx;
|
||||||
while(row<current_font.height){
|
while(row<current_font.height){
|
||||||
@ -457,10 +458,10 @@ uint8_t print_lines_ft(CONFIG*cfg) {
|
|||||||
dot_line_bitsidx = line_bits%8;
|
dot_line_bitsidx = line_bits%8;
|
||||||
memset(dot_line_data,0,MAXPIXELS);
|
memset(dot_line_data,0,MAXPIXELS);
|
||||||
//line by line bitmap dots to print
|
//line by line bitmap dots to print
|
||||||
|
i = lastidx;
|
||||||
while( i <ser_cache.idx) {
|
while( i <ser_cache.idx) {
|
||||||
ch = (uint8_t*)&ser_cache.data[i];
|
ch = (uint8_t*)&ser_cache.data[i];
|
||||||
codename = utf8_to_utf32(ch);
|
codename = utf8_to_utf32(ch);
|
||||||
|
|
||||||
FT_UInt gi = FT_Get_Char_Index ( cfg->face, codename);
|
FT_UInt gi = FT_Get_Char_Index ( cfg->face, codename);
|
||||||
FT_Load_Glyph (cfg->face, gi, FT_LOAD_DEFAULT);
|
FT_Load_Glyph (cfg->face, gi, FT_LOAD_DEFAULT);
|
||||||
int bbox_ymax = cfg->face->bbox.yMax / 64;
|
int bbox_ymax = cfg->face->bbox.yMax / 64;
|
||||||
@ -487,7 +488,7 @@ uint8_t print_lines_ft(CONFIG*cfg) {
|
|||||||
if(p) {
|
if(p) {
|
||||||
dot_line_data[dot_line_idx ] |= 1<<(7-dot_line_bitsidx);
|
dot_line_data[dot_line_idx ] |= 1<<(7-dot_line_bitsidx);
|
||||||
}
|
}
|
||||||
|
|
||||||
dot_line_bitsidx++;
|
dot_line_bitsidx++;
|
||||||
w++;
|
w++;
|
||||||
line_bits++;
|
line_bits++;
|
||||||
@ -548,6 +549,10 @@ uint8_t print_lines_ft(CONFIG*cfg) {
|
|||||||
|
|
||||||
|
|
||||||
uint8_t print_lines8(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;
|
uint8_t i,j,k;
|
||||||
int8_t w;
|
int8_t w;
|
||||||
uint8_t *data;
|
uint8_t *data;
|
||||||
@ -563,6 +568,7 @@ uint8_t print_lines8(CONFIG*cfg) {
|
|||||||
uint8_t lastidx,lastw,lastj;
|
uint8_t lastidx,lastw,lastj;
|
||||||
int8_t left;
|
int8_t left;
|
||||||
uint8_t rv;
|
uint8_t rv;
|
||||||
|
|
||||||
|
|
||||||
pad = current_font.width %BITS8;
|
pad = current_font.width %BITS8;
|
||||||
|
|
||||||
|
|||||||
@ -30,6 +30,7 @@ uint16_t read_adc(char*);
|
|||||||
uint16_t temperature();
|
uint16_t temperature();
|
||||||
int glob_file(char*);
|
int glob_file(char*);
|
||||||
|
|
||||||
|
uint8_t print_lines_ft(CONFIG*);
|
||||||
uint8_t print_lines8(CONFIG*);
|
uint8_t print_lines8(CONFIG*);
|
||||||
|
|
||||||
uint8_t invert_bit(uint8_t a);
|
uint8_t invert_bit(uint8_t a);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user