ciao! Ho acquistato un display grafico 128x64 ed ora ho la necessitá di modificare tipo e grandezza dei font. Sulla libreria Adafruit (GitHub - adafruit/ST7565-LCD: There are two 'versions' of the LCD library - one is straightup avr-gcc and the other is an Arduino Library. They're essentially the same. You can create new icons for bitmapdisplaying using bmp2glcd have fun! limor) vi sono due funzioni principali per l'output del testo:
void ST7565::drawstring(uint8_t x, uint8_t line, char *c) {
while (c[0] != 0) {
drawchar(x, line, c[0]);
c++;
x += 6; // 6 pixels wide
if (x + 6 >= LCDWIDTH) {
x = 0; // ran out of this line
line++;
}
if (line >= (LCDHEIGHT/8))
return; // ran out of space :(
}
}
void ST7565::drawchar(uint8_t x, uint8_t line, char c) {
for (uint8_t i =0; i<5; i++ ) {
st7565_buffer[x + (line*128) ] = pgm_read_byte(font+(c*5)+i);
x++;
}
updateBoundingBox(x, line*8, x+5, line*8 + 8);
}
L'unico font disponibile é strutturato in questa maniera (lo riporto parzialmente dato che é lungo):
uint8_t font[] PROGMEM = {
0x0, 0x0, 0x0, 0x0, 0x0, // Ascii 0
0x7C, 0xDA, 0xF2, 0xDA, 0x7C, //ASC(01)
0x7C, 0xD6, 0xF2, 0xD6, 0x7C, //ASC(02)
0x38, 0x7C, 0x3E, 0x7C, 0x38,
0x18, 0x3C, 0x7E, 0x3C, 0x18,
0x38, 0xEA, 0xBE, 0xEA, 0x38, };
Per ora ho provato a utilizzare vari programmi di conversione da font a hex, da bmp a hex ecc. , ho provato a modificare la funzione drawchar, ma senza alcun successo.
Ora ho la necessitá che mi spieghiate in detaglio, dato che in C++ sono un po' niubbo, cosa fanno esattamente le due funzioni e come modificarle per ottenere delle funzioni universali in cui poter inserire il tipo di font e la rispettiva dimensione.
Grazie!