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: EAB 2.5.0 generate legacy custom font L8 format  (Read 10526 times)

Spyy

  • Newbie
  • *
  • Posts: 20
    • View Profile
EAB 2.5.0 generate legacy custom font L8 format
« on: February 22, 2022, 09:42:47 PM »

Hi,

i am trying to get a working legacy L8 font with UTF-8File, CMD_SETFONT, First character: 1, RAM_G+ 181936.
=> Resulting command line is: fnt_cvt.exe -f legacy -C BT81X -i C:/blabla/isfdV11BoldPlus55.ttf -s 22 -d  181936 -c setfont -l 1 -g -u C:/blabla/isfdFont V4.txt -o C:/blabla/output -O
I am using this because i have no flash attached and i am only using a few glyphs and then the output for L8 ist relatively small.
When i use  the font in my application i only get "pixel dust/snow" or a solid block instead of numbers with CMD_NUMBER or CMD_TEXT. Other fonts are working fine.
BTW: I get the same result with the setting CMD_SETFONT2.
Going more into detail:
Resulting command line: fnt_cvt.exe -f legacy -C BT81X -i C:/blabla/isfdV11BoldPlus55.ttf -s 22 -d  181936 -c setfont -l 1 -g -u C:/blabla/isfdFont V4.txt -o C:/blabla/output -O
In the *_L8.c i then get:
Code: [Select]
#include "Common.h"

#define FONT_HANDLE       (1)
#define FONT_FILE_ADDRESS (RAM_G + 181936)
#define STRIDE            (28)
#define FONT_WIDTH        (28)
#define FONT_HEIGHT       (24)
#define FIRST_CHARACTER   (1)

void Load_Font_L8(EVE_HalContext * phost)
{
Gpu_CoCmd_Dlstart(phost);
App_WrCoCmd_Buffer(phost, CLEAR(1, 1, 1));
App_WrCoCmd_Buffer(phost, COLOR_RGB(255, 255, 255));
Gpu_Hal_LoadImageToMemory(phost, "../../../L8/isfdV11BoldPlus55_22_L8.raw", FONT_FILE_ADDRESS, LOAD);

App_WrCoCmd_Buffer(phost, BITMAP_HANDLE(FONT_HANDLE));
App_WrCoCmd_Buffer(phost, BITMAP_SOURCE(FONT_FILE_ADDRESS + 148 - STRIDE*FONT_HEIGHT*FIRST_CHARACTER));
App_WrCoCmd_Buffer(phost, BITMAP_LAYOUT(L8, STRIDE, FONT_HEIGHT));
App_WrCoCmd_Buffer(phost, BITMAP_SIZE(NEAREST, BORDER, BORDER, FONT_WIDTH, FONT_HEIGHT));
Gpu_CoCmd_SetFont(phost, FONT_HANDLE, FONT_FILE_ADDRESS);
Gpu_CoCmd_Text(phost, 50, 50, FONT_HANDLE, 0, "\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0A");
App_WrCoCmd_Buffer(phost, DISPLAY());
Gpu_CoCmd_Swap(phost);
App_Flush_Co_Buffer(phost);
Gpu_Hal_WaitCmdfifo_empty(phost);
}
This output i am using in my code...
In the .rawh i find:
Code: [Select]
/* Widths */
0,16,14,16,16,16,16,16,16,16,8,16,28,17,20,20,28,23,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/* Format */
3,0,0,0,
/* Stride */
28,0,0,0,
/* Max Width */
28,0,0,0,
/* Max Height */
24,0,0,0,
/* Raw Data Address in Decimal: <181412> */
164,196,2,0,

/* 148 Metric Block End ---  */

/*Bitmap Raw Data begin +++*/
/*The expected raw bitmap size is 11424 Bytes */
0,0,0,3,88,173,222,246,248,227,182,100,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,21,198,.......
For the "base" i get FONT_FILE_ADDRESS (RAM_G + 181936)

For BITMAP_SOURCE(FONT_FILE_ADDRESS + 148 - STRIDE*FONT_HEIGHT*FIRST_CHARACTER)); => I get the address for the first bitmap at 181412 which seemed to be smaller than the base address (Base: 181936 vs. Bitmap 181412). Is this correct ? I would think that bitmap source is Base+148 ?

With CMD_SETFONT2 the memory map looks a bit more plausible (especially the "Raw Data Address in Decimal") which here matches with the resulting memory map:
Command line: fnt_cvt.exe -f legacy -C BT81X -i C:/blabla/isfdV11BoldPlus55.ttf -s 22 -d  181936 -c setfont2 -l 1 -g -u C:/blabla/isfdFont V4.txt -o C:/blabla/output -O 4
Uploaded memory map of RAM_G with CMD_SETFONT2 looks like this:
Load metrix 3 Start: 181936 => 0x2C6B0
Load metrix 3 End: 182084 => 0x2C744
Load font bitmap 3 Start: 182084 => 0x2C744
Load font bitmap 3 End: 193508 => 0x2F3E4

_L8.rawh
Code: [Select]
/* Widths */
0,16,14,16,16,16,16,16,16,16,8,16,28,17,20,20,28,23,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/* Format */
3,0,0,0,
/* Stride */
28,0,0,0,
/* Max Width */
28,0,0,0,
/* Max Height */
24,0,0,0,
/* Raw Data Address in Decimal: <182084> */
68,199,2,0,

/* 148 Metric Block End ---  */

/*Bitmap Raw Data begin +++*/
/*The expected raw bitmap size is 11424 Bytes */
0,0,0,3,88,173,222,246,248,227,182,100,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,21,198,.....

But still also "pixel snow"...

Find attached my font if you want to try...with the EAB settings above...

Thank you for your help

Torsten
« Last Edit: February 22, 2022, 10:21:43 PM by Spyy »
Logged

BRT Community

  • Administrator
  • Hero Member
  • *****
  • Posts: 745
    • View Profile
Re: EAB 2.5.0 generate legacy custom font L8 format
« Reply #1 on: February 23, 2022, 04:15:44 PM »

Hello,

Thank you for your question.

Can you just confirm how you are loading the font in your application code?
Is this the same as the "*_L8.c" file?

Could you also confirm how you are calling CMD_TEXT or CMD_NUMBER in your code?

As a note the BITMAP_SOURCE value is calculated in the following manner:
(Address of data in RAM_G) + (Metric Block size) – (32 characters worth of (stride * height))

Can I get you to try reconverting the font with the first character set as 48? Please also try the SETFONT2 option.
The CMD_NUMBER command will take the font widths from the standard ASCII positions, so you need to adjust for this fact.

The CMD_TEXT command then can use the hex value of the position of the character in the font file to display a given character. For example: CMD_TEXT(191, 295, 5, 0, "\x30 ")

However when testing this I noticed that the following symbols did not convert correctly:

Code: [Select]
./:()-
It appears as if these are not included in your font source file.

Best Regards,
BRT Community
Logged

Spyy

  • Newbie
  • *
  • Posts: 20
    • View Profile
Re: EAB 2.5.0 generate legacy custom font L8 format
« Reply #2 on: February 23, 2022, 04:43:09 PM »

Hi,

Can you just confirm how you are loading the font in your application code?
Is this the same as the "*_L8.c" file?
=> I do it this way:
1. Put the rawh into a header as an array (metrixData22BoldLegacy and fontData22BoldASTCLegacy) and
2. load it via EVE_memWrite8 byte per byte into RAM_G + x

Code: [Select]
#define FONT_FILE_ADDRESS_22 (0x00 + 181936)
        uint32_t pos = FONT_FILE_ADDRESS;
....
....
// 3. Font
// Loading the font metrix data to address given from EAB
xFontLoadingAddress[2] = pos;
Serial.printf("Load metrix 3 Start: %u => 0x%02X\n", pos, pos);
for (i = 0; i < sizeof(metrixData22BoldLegacy); i++)
{
EVE_memWrite8(pos, metrixData22BoldLegacy[i]);
pos++;
}
Serial.printf("Load metrix 3 End: %u => 0x%02X\n", pos, pos);
// Loading the font bitmap data to address RAM_G + sizeof(metrixData28BoldLegacy)
Serial.printf("Load font bitmap 3 Start: %u => 0x%02X\n", pos, pos);
for (i = 0; i < sizeof(fontData22BoldASTCLegacy); i++)
{
EVE_memWrite8(pos, fontData22BoldASTCLegacy[i]);
pos++;
}
Serial.printf("Load font bitmap 3 End: %u => 0x%02X\n\n", pos, pos);

Could you also confirm how you are calling CMD_TEXT or CMD_NUMBER in your code?
=> Yes, i do it with an other custom font without "cutting" the letters via utf file and it works fine, but now my memory is limited so i tried the "cutting" method

Can I get you to try reconverting the font with the first character set as 48? Please also try the SETFONT2 option
=> will try

However when testing this I noticed that the following symbols did not convert correctly => Ok but they are all showing up correctly in the EAB font preview window...BTW which is not updated when you load a font and then a different font.

Thank you
Logged

BRT Community

  • Administrator
  • Hero Member
  • *****
  • Posts: 745
    • View Profile
Re: EAB 2.5.0 generate legacy custom font L8 format
« Reply #3 on: February 24, 2022, 11:53:48 AM »

Hello,

Thank you for the update.

I have managed to test the provided font file with ESE to verify the behavior.

Again I was seeing that the font file being used does not include some of the input characters that you wish to convert. Please see "Font Preview.PNG", this is from the Windows preview of the file but I note the same behavior in EAB. As a result the conversion output contains these characters and not the desired "./:()-" characters (see "isfdV11BoldPlus55_22.png").

Using the following display list I was able to display the font correctly:

Code: [Select]
CLEAR(1,1,1)
CMD_DLSTART
CMD_SETFONT2(5, 0, 48)
CMD_TEXT(100, 198, 5, 0, "12345 \x33 \x36 \x37 \x38 \x39 \x3A \x3B \x3C \x3D \x3f \x3E  ")
CMD_NUMBER(111, 259, 5, 0, 987654321)

Note: I performed the EAB conversion using RAM_G +0 as the address, see below for the command line:

Code: [Select]
/*Command Line: fnt_cvt.exe -f legacy -C BT81X -i C:/Users/~/Desktop/Spyy Font Question/isfdV11BoldPlus55.ttf -s 22 -d  0 -c setfont2 -l 48 -g -u C:/Users/~/Desktop/Spyy Font Question/isfdFont V4.txt -o C:/Users/~/Desktop/Spyy Font Question -O 4*/
The result can be seen in the ESE.PNG file.

Setting the first character to 48 in the conversion command line allows us to utilize CMD_NUMBER with the given numerals, we can then print the remaining characters in CMD_TEXT with their hex representation. Note, the convertor is assuming that input character list conforms to the ASCII standard layout, so character number 58 is a colon (:) in ASCII but in your input set it is a full-stop (.), as such you cannot use the full-stop in CMD_TEXT to print a full-stop but you can use the hex value 0x3A.

If you are seeing a different preview for the given font file or a different output from EAB please let me know.

Best Regards,
BRT Community
Logged

Spyy

  • Newbie
  • *
  • Posts: 20
    • View Profile
Re: EAB 2.5.0 generate legacy custom font L8 format
« Reply #4 on: February 24, 2022, 04:59:54 PM »

Hi,

i have the same result here with cmd_setfont2 and 48, with RAM_G+xxxxx it works also. Thank you for your effords....
That i use different glyphs in my font than ()./- etc, is intentional.
But what i noticed is that the same is not working with the setting "cmd_setfont". The spacing between the numbers is then zero because of the /* Widths */ in the metrix block. It is not shifted correctly to 48, the widths are then still beginning at position zero instead of 48 => on 48+ there are only zeros for the spacing (width).
So summary as far as i understood for legacy L8 font conversion with cropping UTF-8 file:
1. First character option must be set to minimum 48
2. Use setfont2, setfont has perhaps to be corrected in later EAB versions concerning "width" in the metrix block (see above)

Thank you

Torsten
Logged

BRT Community

  • Administrator
  • Hero Member
  • *****
  • Posts: 745
    • View Profile
Re: EAB 2.5.0 generate legacy custom font L8 format
« Reply #5 on: February 25, 2022, 12:05:07 PM »

Hello,

Thank you for the update, I'm glad you have got that working now.

One your two points, for (1) the first character option is set to 48 as this is the first ASCII character in your input character set, CMD_SETFONT2 expects the custom font data to conform to the standard ASCII format, if you were to start your custom character set with a different character then you would need to set this number accordingly. For example for the following set you would select 32 for this option:
Code: [Select]
!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]
On you're second point, it is possible to utilize CMD_SETFONT, but yes some manipulation of the metric block may be required in the widths section, this normally involves shifting the widths appropriately in the data for the characters you are using. i.e. shifting them 48 places for your given input character set.

Best Regards,
BRT Community
Logged

progchip

  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: EAB 2.5.0 generate legacy custom font L8 format
« Reply #6 on: March 25, 2022, 05:15:07 AM »

I work with BT817. It seems that the incorrect display is not a format L8, but the size of the font file. My created font was displayed incorrectly from a certain symbol in L8 format, but completely correctly in L4 format.
   In a font with large characters, even in the format L4, only the first three were correctly displayed.
  I installed an experienced way that problems begin when the size of the font file exceeds 16 kilobytes.
  The FT801 chips are shown correctly.
Logged