BRT Community

General Category => Discussion - EVE => Topic started by: ali on February 15, 2019, 12:53:04 PM

Title: Fonts in FT81x
Post by: ali on February 15, 2019, 12:53:04 PM
Hi!

Could it be that it is not possible to use any font in the FT81x controller?
I imported a 7 segment font using the FTDI Screen editor in two different sizes, and used the created binh files as import source, which worked fine as long as I am in the debugger, where I am just doing soft restarts of the device. As soon as I do a cold restart, only garbage is displayed. If I am using a different font, that has been supplied by our distributor, the font is shown fine independant of the type of system restart.
What are the requirements towards the used font?

In the below example I reduced the number of fonts to just one, which is loaded two times to make the sample simpler.


    #define RAM_DSEG7MODERN_REGULAR 0
    #define RAM_DSEG7MODERN_REGULAR2 61708 //uncompressed size of the font
 
    const unsigned char DSEG7Modern_Regular[] = {
           #include "Segment7Standard.h"
    }; //load picture in flash
   
    begin();
    uint32_t stride_u32;
    uint32_t width_u32;
    uint32_t height_u32;
    int t;
    //Font 1
    cmd_inflate(RAM_DSEG7MODERN_REGULAR); //41
    loadimage(DSEG7Modern_Regular,sizeof(DSEG7Modern_Regular));
    stride_u32= rd32(RAM_DSEG7MODERN_REGULAR + 132);
    width_u32 = rd32(RAM_DSEG7MODERN_REGULAR + 136);
    height_u32=rd32(RAM_DSEG7MODERN_REGULAR + 140);
    cmd(BITMAP_HANDLE(1));
    //Siehe AN014, P20:   RAM_G - (num chars * (stride *  height) + 148
    //                    0     - (32          (12     *  54    ) + 148
    t = (RAM_DSEG7MODERN_REGULAR - (32 * stride_u32 * height_u32) + 148);
    cmd(BITMAP_SOURCE(t));
    //Format, stride, height
    cmd(BITMAP_LAYOUT(L2, stride_u32, height_u32));
    //NEAREST, BORDER, BORDER,  width, height
    cmd(BITMAP_SIZE(NEAREST, BORDER, BORDER, width_u32, height_u32));
    cmd_setfont(1, RAM_DSEG7MODERN_REGULAR);

    //Font 2
    cmd_inflate(RAM_DSEG7MODERN_REGULAR2); //41
    loadimage(DSEG7Modern_Regular,sizeof(DSEG7Modern_Regular));
    stride_u32= rd32(RAM_DSEG7MODERN_REGULAR2 + 132);
    width_u32 = rd32(RAM_DSEG7MODERN_REGULAR2 + 136);
    height_u32=rd32(RAM_DSEG7MODERN_REGULAR2 + 140);
    cmd(BITMAP_HANDLE(2));
    //Siehe AN014, P20:   RAM_G - (num chars * (stride *  height) + 148
    //                    0     - (32          (12     *  54    ) + 148
    t = (RAM_DSEG7MODERN_REGULAR2 - (32 * stride_u32 * height_u32) + 148);
    cmd(BITMAP_SOURCE(t));
    //Format, stride, height
    cmd(BITMAP_LAYOUT(L2, stride_u32, height_u32));
    //NEAREST, BORDER, BORDER,  width, height
    cmd(BITMAP_SIZE(NEAREST, BORDER, BORDER, width_u32, height_u32));
    cmd_setfont(2, RAM_DSEG7MODERN_REGULAR2);
    uint32_t timestamp_u32 = SYSTEMGetSystics();
    while(1000 < SYSTEMGetSysticsDiff(timestamp_u32));

     while(1)
    {
        cmd(CLEAR(1,1,1));
        cmd(COLOR_RGB(255,255,255));

        cmd_text(98,160,1,0,"Text");
        cmd_number(124,270,1,0,42);
        cmd_text(98,320,2,0,"Text");
        cmd(DISPLAY());
   
        swap();
        copro_idle();

    }//end of while
Title: Re: Fonts in FT81x
Post by: BRT Community on February 18, 2019, 11:08:15 AM
Hello,

It would be worth trying the non-compressed versions of your font first of all to check if this works when you load two copies of the same font. Also, does your 7-segment font work if you load only one copy / one size ?

Could you also send a copy of your font files (both pre and post conversion) to us at our support address? If you could send an email initially to support.emea@brtchip.com with no attachment then we can get back to you.

We'll also post any updates here once we have investigated for future reference.

Best Regards,
BRT Community