2019-11-29 09:05 PM
Here are my programs:
const int FontCacheSize = 10000;
uint8_t fontdata[FontCacheSize] __attribute__((at(0XC0E00000))) __attribute__ ((aligned(4)));
FrontendApplication::FrontendApplication(Model& m, FrontendHeap& heap)
: FrontendApplicationBase(m, heap)
{
FIL fil; /* File object */
FRESULT fr; /* FatFs return code */
UINT br;
fontCache.setMemory(fontdata, FontCacheSize);
/* Open a text file */
fr = f_open(&fil, "0:/Font_VINERITC_TTF_20_4bpp.bin", FA_READ|FA_WRITE|FA_OPEN_ALWAYS);
if(fr == FR_OK)
{
fr = f_read(&fil, fontdata, FontCacheSize, &br);
fr = f_close(&fil);
new (&bf) BinaryFont((const struct touchgfx::BinaryFontData*)fontdata);
TypedTextDatabase::setFont(Typography::DEFAULT, &bf);
}
}
Sometimes it able to work. But , if I touch the screen the program will crash.
Most of the time,the program crash on the power on.
2�?I'm not sure what this filedatareader is. Who can give me an example. The chip is stm32f429bi, and the file system is FatFs.Thank you .
2019-12-02 04:12 AM
Normally you'd use Binary Fonts because you have a typography that is incredibly large, and you cannot or won't place it in external flash memory, so you place it on an SD-Card. You then have to read this data from the SD-Card (Here's where the FileDataReader comes into play).
/Martin
2019-12-02 04:59 AM
Hello, Martin, Thank you for your answer.
What you say is what I need.
I want to read the typography to SDRAM from the Sd-card.
1.Can you give me a specific example for the FileDataReader.
2. How about my first question?Do you know why?When I define the fontdata[FontCacheSize] in the internal RAM, it go good.
2019-12-02 05:20 AM
Re: 2 - You're allocating some buffer. Are you using an RTOS? Check your stack/heap settings - If they're large enough. Do you have external ram? Also note that there's a difference between "Font cache" (in which you only read few glyphs into ram that you need) and binary fonts in which you can install a font from somewhere in SD-RAM because you want to replace the font with a new one - This example is e.g. for when you want to update typographies on the fly or through an update.
1. I'll try to make an example for binary fonts using FileDataReader that just reads the file from a filesystem (in a simulator).
Do you really know what you're trying to achieve? Are you trying to install a complate binary font, or are you trying to read glyphs into a cache in the case where loading a complete binary font is not possible? (e.g. for asian languages).
/Martin
2019-12-02 06:46 AM
1.I have an external sdram of 16MB.
2. I want trying to read glyphs into a cache( preferably define in Sdram) in the case where loading a complete binary font is not possible.(e.g. Chinese).
2022-04-05 02:49 AM
I have the same problem as you. Has this problem been solved ?