the fonts are really 8x8 fronts but the alpha/numeric char only use 7x8 with the last bit always o (for chr spacing)
there are two fonts in this thread the first is chr 32-90 and the second chr 32-127. I have a extended font (attached) that has
a radio button arrows ,play,stop,pause,speaker on/off symbols ,these use the full 8x8
this is the routine to display font chars
the arduino utft code can handle variable width fonts by storing a second table along with the font . that table records the h/w of every chr in the font and ascii val of the first and last chr in the font too.Code:g cga: g_fontoffset = (g_chr-font_begin)*8 + fontaddr if (x+textsize*7) > width then return if (y+textsize*8) > height then return if (g_chr <font_begin) || (g_chr >font_end ) then return for ROW=0 to 7 ;font height this would need to be a var set to font height size readcode g_fontoffset +ROW,ctemp ;this would need to be able to "unpack" different font with bits for PIXEL=0 to 7 ;font width ; font width var req here too X1= X+PIXEL X0=X1 Y0=Y+7-ROW Y1=Y0 IF TEXTSIZE ==1 THEN GOSUB SETWINDOW if ctemp.0[PIXEL] then ;SETPIXEL X+PIXEL,Y+7-ROW ,FG TFT_CMD_IN= FG>>8 GOSUB TFT_DATA TFT_CMD_IN= FG GOSUB TFT_DATA ELSE ;SETPIXEL X+PIXEL,Y+7-ROW ,BG TFT_CMD_IN= BG>>8 GOSUB TFT_DATA TFT_CMD_IN= BG GOSUB TFT_DATA ENDIF ELSE X0=X+PIXEL*TEXTSIZE Y0=Y+( 7-ROW )*TEXTSIZE X1= TEXTSIZE Y1= TEXTSIZE if ctemp.0[PIXEL] then FrG=fg GOSUB frectc ELSE FrG=BG GOSUB frectc ENDIF ENDIF NEXT next x=x+textsize*7 ;auto increment x for str function ; and font width here too RETURN
its pretty straight forward but not trivial task to change the pgm to do that ; however all the text box code for buttons etc would need to be altered too




Bookmarks