BRT Community

Please login or register.

Login with username, password and session length
Advanced search  

News:

Welcome to the Bridgetek Community!

Please read our Welcome Note

Technical Support enquires
please contact the team
@ Bridgetek Support

Please refer to our website for detailed information on all our products - Bridgetek - Bridging Technology

Author Topic: Multiple custom fonts  (Read 128 times)

Keko

  • Newbie
  • *
  • Posts: 1
    • View Profile
Multiple custom fonts
« on: June 21, 2022, 08:03:54 PM »

Hi,

I am using BT817Q controller and I need 2 custom fonts in my project.
I have successfully used EVE Assets Builder to create fonts, load it into the flash and use fontcache.
But I have performance problems because only one of the fonts is in the cache. I would like to load one font into the fontcache and second one into the RAM_G.
And I can not find any working example. Can someone please help me.

Here is the code I am using:
/*
unified.blob            : 0      : 4096
saarland_120_ASTC.glyph : 4096   : 420480
saarland_120_ASTC.xfont : 424576 : 320
saarland_200_ASTC.glyph : 424896 : 479168
saarland_200_ASTC.xfont : 904064 : 320
*/

if (E_OK == EVE_init_flash())
{
           EVE_cmd_fontcache(12, 0xf0000, 0x80000);
           EVE_cmd_flashread(0, 424576,320); /* copy .xfont from FLASH to RAM_G, offset and length are from the .map file */           
           EVE_cmd_flashread(MEM_FONT, 904064,320); /* copy .xfont from FLASH to RAM_G, offset and length are from the .map file */
}

EVE_cmd_setfont2_burst(12,0,32);
EVE_cmd_setfont2_burst(13,MEM_FONT,32);

Thank you...
Logged

BRT Community

  • Administrator
  • Hero Member
  • *****
  • Posts: 586
    • View Profile
Re: Multiple custom fonts
« Reply #1 on: June 22, 2022, 11:24:05 AM »

Hi,

Here is a small example where we copy two fonts to RAM_G and then display them.

The pointer to the graphic data will have been set in the xfont block when you convert the font or when creating the bin for the flash but you can overwrite this after copying the xfont to RAM_G as shown below.

Hope it helps, BRT Community

Code: [Select]
void eve_display(void)
{

Flash_Full_Speed();


//unified.blob                  : 0     : 4096
//EDF Block                     : 4096  : 128
//HPSimplified_Rg_14_ASTC.xfont : 4224  : 192
//HPSimplified_Rg_14_ASTC.glyph : 4416  : 8192
//HPSimplified_Rg_20_ASTC.xfont : 12608 : 192
//HPSimplified_Rg_20_ASTC.glyph : 12800 : 24576

// define where we will put in RAM_G
#define Font1_xfont  0
#define Font1_glyph  0+192
#define Font2_xfont  0+192+8192
#define Font2_glyph  0+192+8192+192

// ---------------------------------------------------------------------------

// copy xfont to RAM_G (font 1 is size 14)
EVE_LIB_BeginCoProList();
EVE_CMD_FLASHREAD(Font1_xfont, 4224, 192);
EVE_LIB_EndCoProList();
EVE_LIB_AwaitCoProEmpty();

// copy glyph to RAM_G
EVE_LIB_BeginCoProList();
EVE_CMD_FLASHREAD(Font1_glyph, 4416, 8192);
EVE_LIB_EndCoProList();
EVE_LIB_AwaitCoProEmpty();

// copy xfont to RAM_G (font 2 is size 20)
EVE_LIB_BeginCoProList();
EVE_CMD_FLASHREAD(Font2_xfont, 12608, 192);
EVE_LIB_EndCoProList();
EVE_LIB_AwaitCoProEmpty();

// copy glyph to RAM_G
EVE_LIB_BeginCoProList();
EVE_CMD_FLASHREAD(Font2_glyph, 12800, 24576);
EVE_LIB_EndCoProList();
EVE_LIB_AwaitCoProEmpty();

// ---------------------------------------------------------------------------

// Update the RAM_G location holding start of graphic data which is 8th 32-bit value in the xfont block
// See BT81x programmers guide 5.4.3
HAL_MemWrite32((Font1_xfont+32), Font1_glyph); // update address xfont + (4*8 bytes)
HAL_MemWrite32((Font2_xfont+32), Font2_glyph);  // update address xfont + (4*8 bytes)

// ---------------------------------------------------------------------------

EVE_LIB_BeginCoProList();
EVE_CMD_DLSTART();
EVE_CLEAR_COLOR_RGB(0, 0, 0);
EVE_CLEAR(1,1,1);
EVE_COLOR_RGB(255,255,255);

EVE_CMD_SETFONT2(2, Font1_xfont, 0);
EVE_CMD_SETFONT2(3, Font2_xfont, 0);

EVE_CMD_TEXT(100, 50, 2, 0, "Custom Font 14");
EVE_CMD_TEXT(100, 100, 3, 0, "Custom Font 20");
EVE_DISPLAY();
EVE_CMD_SWAP();
EVE_LIB_EndCoProList();
EVE_LIB_AwaitCoProEmpty();

// ---------------------------------------------------------------------------

while(1)
{
}

}
Logged