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: Custom Fonts Problem  (Read 11887 times)

yle

  • Newbie
  • *
  • Posts: 7
    • View Profile
Custom Fonts Problem
« on: January 19, 2023, 02:56:19 PM »

Hi,
I'm facing an issue with custom fonts on an FT812 chip. I try to load 5 custom fonts, but there is a problem with the 4th one. Sometime, with this font, all char are cut in half (see file attached).
Sometime, the font is correct, the problem occurs randomly.
Any help would be appreciated.

Regards
Logged

Cyrilou

  • Jr. Member
  • **
  • Posts: 73
    • View Profile
Re: Custom Fonts Problem
« Reply #1 on: January 31, 2023, 09:54:16 AM »

Hi,

This seems to be same problem than me!
When font is already inflated in RAM_G, the render crashes sometimes.

Please see link below:
http://www.brtcommunity.com/index.php?topic=428.0
« Last Edit: January 31, 2023, 09:58:09 AM by Cyrilou »
Logged

BRT Community

  • Administrator
  • Hero Member
  • *****
  • Posts: 752
    • View Profile
Re: Custom Fonts Problem
« Reply #2 on: January 31, 2023, 03:01:44 PM »

Hi,

Could you share your code for loading the 5 custom fonts to EVE and setting up the font e.g. via SetFont2 command?
Could you also share your settings used to convert each font?

Are the loaded from compressed files or are they loaded as raw data?

If the attachment is too large or if you are not able to share the code snippets on the forum, then you can also email the files to us at support.emea@brtchip.com

Best Regards, BRT Community
Logged

yle

  • Newbie
  • *
  • Posts: 7
    • View Profile
Re: Custom Fonts Problem
« Reply #3 on: February 02, 2023, 03:08:40 PM »

Hi,

Finally, i found a solution (but not the explanation).

My "Ft81x_Init_Font" function is designed as follow :
Code: [Select]
void Ft81x_Init_Font(
    ft_gpu_hal_context* pt_host, /* host data */
    ft_gpu_metric_block* pt_font_metrics, /* font metrics data */
    uint8* pt_font_raw_data,  /* font raw data */
    uint32 font_raw_data_size, /* font raw data size */
    uint16 handle_id, /* GPU handle identifier */
    uint32 gram_address /* GPU General RAM address to store the font */
)
{
    /* load fonts metrics and data in GRAM */
    Ft_Hal_Write_Mem(pt_host, gram_address, (uint8*) pt_font_metrics, FONT_METRIC_SIZE);
    Ft_Hal_Write_Mem(pt_host, gram_address + FONT_METRIC_SIZE, (uint8*) pt_font_raw_data, font_raw_data_size);

    Ft81x_Start_Page(pt_host);
    /* configure the handle */
    Ft_Hal_Write_Cmd32(pt_host, BITMAP_HANDLE(handle_id));
    Ft_Hal_Write_Cmd32(pt_host, BITMAP_SOURCE(raw_data_add));
    Ft_Hal_Write_Cmd32(pt_host, BITMAP_LAYOUT(format, stride, max_height));
    Ft_Hal_Write_Cmd32(pt_host, BITMAP_SIZE(NEAREST, BORDER, BORDER, max_width, max_height));
    /* load the font in Coprocessor */
    Ft_Gpu_CoCmd_SetFont(pt_host, handle_id, gram_address);
    Ft81x_End_Page(pt_host);
}

This function is called once for each of the 5 fonts just after the GPU initialization.
Code: [Select]
    /* initialize GPU */
    Ft81x_Init(&Gpu);

    /* load fonts in GPU memory */
    Ft81x_Init_Font(&Gpu, (s_ft_gpu_metric_block*) Font1_Metrics, (ubyte*) Font1, FONT1_RAW_BITMAP_SIZE, HANDLE_1, RAM_ADDR1);
    Ft81x_Init_Font(&Gpu, (s_ft_gpu_metric_block*) Font2_Metrics, (ubyte*) Font2, FONT2_RAW_BITMAP_SIZE, HANDLE_2, RAM_ADDR2);
    Ft81x_Init_Font(&Gpu, (s_ft_gpu_metric_block*) Font3_Metrics, (ubyte*) Font3, FONT3_RAW_BITMAP_SIZE, HANDLE_3, RAM_ADDR3);
    Ft81x_Init_Font(&Gpu, (s_ft_gpu_metric_block*) Font4_Metrics, (ubyte*) Font4, FONT4_RAW_BITMAP_SIZE, HANDLE_4, RAM_ADDR4);
    Ft81x_Init_Font(&Gpu, (s_ft_gpu_metric_block*) Font5_Metrics, (ubyte*) Font5, FONT5_RAW_BITMAP_SIZE, HANDLE_5, RAM_ADDR5);

By adding the following sequence at each new page, the problem has been fixed.
Code: [Select]
    Ft_Hal_Write_Cmd32(pt_host, BITMAP_HANDLE(handle_id));
    Ft_Hal_Write_Cmd32(pt_host, BITMAP_SOURCE(raw_data_add));
    Ft_Hal_Write_Cmd32(pt_host, BITMAP_LAYOUT(format, stride, max_height));
    Ft_Hal_Write_Cmd32(pt_host, BITMAP_SIZE(NEAREST, BORDER, BORDER, max_width, max_height));
    Ft_Gpu_CoCmd_SetFont(pt_host, handle_id, gram_address);

But i don't understand why the first SetFont commands do not work sometimes.
Is this command needed to be sent at each new page?
If not, what my software needs to wait for before sending the first SetFont commands?

Regards
Logged