FTDI Community

Please login or register.

Login with username, password and session length.
Advanced Search  

News:

Welcome to the FTDI Community!

Please read our Welcome Note

Technical Support enquires
please contact the team
@ FTDI Support


New Bridgetek Community is now open

Please note that we have created the Bridgetek Community to discuss all Bridgetek products e.g. EVE, MCU.

Please follow this link and create a new user account to get started.

Bridgetek Community

Author Topic: FT813 (or BT815) few fonts at the same time.  (Read 118 times)

marbalon

  • Newbie
  • *
  • Posts: 7
    • View Profile
FT813 (or BT815) few fonts at the same time.
« on: September 04, 2019, 11:29:49 AM »

In our application, we need to have possibility to use few fonts with different sizes. Now I'm working on FT813 and found that custom fonts must be uploaded to RAM_G, but custom font means 1 x font in 1 x size yes ? So, I can't upload font in size 20 and then use it in smaller size ?

I found that new chip from BT81x family have possibility to use external flash to store fonts/bitmaps. So in this way we can upload few fonts in to the external flash and use later? But in FT813 we can not overwrite existing fonts ?

Is there any example how to use external flash fonts ? The documentation is not clear for me.

« Last Edit: September 04, 2019, 12:02:37 PM by marbalon »
Logged

FTDI Community

  • Administrator
  • Sr. Member
  • *****
  • Posts: 307
    • View Profile
Re: FT813 (or BT815) few fonts at the same time.
« Reply #1 on: September 06, 2019, 01:56:03 PM »

Hi,

Although in theory you can scale individual characters of text like an image, it is normally more feasible to load the font several times converted to different sizes. If you don't need all characters (e.g. maybe just numbers and maths symbols) you can save some space there too. Or in many cases you can try L2 or L4 format or even L1 which won't take up as much space. You can experiment a bit to see what looks good on the screen.

If you want just a few sizes, then loading each to a different bitmap handle should work well.

For BT81x, we have a beta sample app below which you can refer to for BT81x. See SampleApp folder in this file and in particular within sampleapp go to src -> Application -> Set_10.c -> ExtendedFormatFont() for an example.

BT81x Sample Apps

Note that the file is around 200MBytes.

Best Regards, FTDI Community
« Last Edit: September 13, 2019, 03:14:28 PM by FTDI Community »
Logged

marbalon

  • Newbie
  • *
  • Posts: 7
    • View Profile
Re: FT813 (or BT815) few fonts at the same time.
« Reply #2 on: September 09, 2019, 09:05:27 AM »

Thanks for all the hints I will try to do some different test and see what will be best and fast. But just to confirm - can I use fonts directly (without copying to RAM_G) from the external flash in BT815?

Logged

Rudolph

  • Newbie
  • *
  • Posts: 28
    • View Profile
Re: FT813 (or BT815) few fonts at the same time.
« Reply #3 on: September 09, 2019, 04:17:17 PM »

The chance of getting an answer from the community might be a little higer over in the BRT community forum. :-)

The BT815 can use font.glyph flies directly from FLASH but it also needs the font.xfont file that is also generated
and the .xfont has to be copied to RAM_G.

I just put these both in FLASH, the .glyph first and then use cmd_flashread to to the .xfont into RAM_G.
Logged

marbalon

  • Newbie
  • *
  • Posts: 7
    • View Profile
Re: FT813 (or BT815) few fonts at the same time.
« Reply #4 on: September 10, 2019, 11:05:13 AM »

Ok, I after some tests and L2 fonts seem to be fine in most cases. But I have a new problem to resolve. I'm loading fonts to the RAM_G from SD card, then on the FT813/BT815 I can use two commands:

- SETFONT - this ok but I have to provide: stride, widht,  and heigh - the question is how can I get these values? The best if I can calculate it based on the size + L1/L2/L4/L8 method. Advantage of this command is that I can upload the font to any RAM address I want and it is working.
- SETFONT2 - seems to be better because I only need to provide font address, but problem is that loading address is "compiled" into the raw file when it is generated ??? When I use this command with different address then provided in the the font converter then it is not working.

In my case, I can have dynamic content on the screen controlled by the server. So I want to use a few fonts on the same screen, but I don't know what combination of these fonts will be used.

Like I mentioned before we are going to switch from FT813 to BT815 to have external flash capability. But Can I use this flash for commands above by putting FLASH address instead RAM_G?

What is the best to resolve the case above???

BR,
Marcin.

Edit.
I found a "hack" for SETFONT2 command and now I can use this command no mather what offset was provided using EVE font converter. I found that in the raw file at offset 0x90 RAM_G address is located (value = RAM_G offset+148), so when I modify this in the memory everything is working ;-)

Code: [Select]
EVE_cmd_load_from_sd(fontFileAddress, EVE_OPT_NODL, font_name, CMD_LOAD);
offsetValueFix = fontFileAddress+148;
EVE_memWrite_flash_buffer(fontFileAddress+0x90, (uint8_t*)&offsetValueFix, 4);

The question is - can I use SETFONT2 command for fonts stored in external flash in BT815 ?

Edit2.
Does the SPI flash can be used to save RAM_G only for dynamic pictures ? Or all displayed data must be in RAM_G including fonts etc.
« Last Edit: September 10, 2019, 12:23:24 PM by marbalon »
Logged

FTDI Community

  • Administrator
  • Sr. Member
  • *****
  • Posts: 307
    • View Profile
Re: FT813 (or BT815) few fonts at the same time.
« Reply #5 on: September 12, 2019, 11:49:47 AM »

Hi,

Yes here is an example of SetFont2 below.

Also, as Rudolph mentioned, the BT81x can use font .glyph flies directly from FLASH. But the .xfont file should be copied to RAM_G. This can either be stored on the MCU or can be stored on flash and then copied by your code to RAM_G.

Code: [Select]
void SAMAPP_ExtendedFormat_Font()
{
SAMAPP_API_Screen("Unicode Font");
#define UNICODE_HANDLE 30
Gpu_FontsExt_t font;
uint32_t fontAddr = RAM_G;
//Load glyph file into BT815's flash
//Load xfont file into graphics RAM

/* Switch Flash to FULL Mode */
Gpu_CoCmd_FlashHelper_SwitchFullMode(g_phost);
Gpu_Hal_LoadImageToMemory(g_phost, TEST_DIR "\\mssong_20.xfont", fontAddr, LOAD);
Gpu_Hal_WaitCmdfifo_empty(g_phost);

Gpu_CoCmd_Dlstart(g_phost);
App_WrCoCmd_Buffer(g_phost, CLEAR(1, 1, 1));
App_WrCoCmd_Buffer(g_phost, COLOR_RGB(255, 255, 255));

Gpu_CoCmd_SetFont2(g_phost, UNICODE_HANDLE, fontAddr, 0);
Gpu_CoCmd_Text(g_phost, 0, 0, UNICODE_HANDLE, 0, u8"BRT的EVE技术是一个革命性的概念,");
Gpu_CoCmd_Text(g_phost, 0, 30, UNICODE_HANDLE, 0, u8"利用面向对象的方法创建高质量的人机界面(HMI) 同时支持显示,");
Gpu_CoCmd_Text(g_phost, 0, 60, UNICODE_HANDLE, 0, u8"音频和触摸功能。");
App_WrCoCmd_Buffer(g_phost, DISPLAY());
Gpu_CoCmd_Swap(g_phost);
App_Flush_Co_Buffer(g_phost);
Gpu_Hal_WaitCmdfifo_empty(g_phost);
Gpu_Hal_Sleep(4000);
}

Best Regards, BRT Community
Logged