Ameba Pro2 Font & Bitmap Tool Link / Documentation

Hi all,

I’m working with the Ameba Pro2 SDK and need to generate custom fonts and bitmaps for OSD. I’ve seen references to a Font Tool and a Bitmap Generate Tool in internal notes/images, but I cannot locate these tools in the Linux SDK ( GitHub - Ameba-AIoT/ameba-rtos-pro2: Realtek Official IoT Software Development Kit for Ameba Series SoC: (Ameba Pro2) ).

Could someone provide the download link or official documentation for these tools?

Thanks in advance!

Hi @ravinder

You may find the tools for downloading here

Hi @Pammy

Thank you, @Pammy. I found what you provided. I’ll try it again and see how it goes. Thanks once again for your help!..

Hi @Pammy,

Thanks again for sharing the Font & Bitmap Tool earlier.
I followed the complete procedure to generate the custom English font and bitmap for OSD.

However, when I display my test string NuraEye_@_$123 on the video stream, the output in VLC does not appear correctly — some characters look distorted or misaligned.

Expected: NuraEye_@_$123 and in date: PM

Actual:
The text appears jumbled or not aligned properly, as seen in the image.

Could you please advise:

  1. Are there any specific font conversion settings (e.g., pixel format, 1BPP/8BPP, or character spacing) required for special characters like @, _, or $?

  2. i set output format 1BPP

  3. Is there a sample .txt font set for reference to verify the output

  4. this is my Eng.txtdata:0123456789/:abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-~!@#$%^&*()_+=;"'.><,?|{}`

Thank you for your continued help!

Ravinder

Hi @ravinder

All the alphabets and symbols should appear fully visible in the FontTool preview window without any clipping.

Some fonts have taller or wider glyphs that extend beyond the character box, which can cause parts of the characters to be cropped.

Some suggestions to prevent clipping is to adjust the font settings. You can so by navigating to “Font Setting” and configuring the following:

Font 1: MingLiU
Style: Regular
Size: 14-16

Font 2: SimSun/NSimSun
Style: Regular
Size: 16

Hi @Pammy,

Thanks again for your help and explanation about font clipping — it was very helpful.

I noticed that in the OSD2 example, there are references to both 1BPP and ARGB4444 font files.
I wanted to ask whether the Font & Bitmap Tool can generate fonts in these formats.
If yes, could you please explain how to generate them?

Thanks again for your help

Hi @ravinder

You can refer to the Application Note point 6 (image below) to generate the contents for 1BPP and ARGB4444 font files.

  1. You can use fonttools to generate .bin and convert to array using osd2_generation_tool

Hi @Pammy ,

I too have same doubts regarding font generation. The bin file generated by Font tool is 1BPP or ARGB4444 format? The OSD2Gen Tool is only converting bin file to an array representation to use in C program only.

Do you know how to change the font format(1BPP, ARGB, etc) in Font Tool output?

Hi @yugandhar

The Font Tool generates fonts in 1BPP format by default.

The ARGB4444 format is mainly meant for images, so it isn’t supported for font generation in the tool.

Hi @Pammy ,

But in demo app, I can see font with ARGB format also. See attached screenshot. How it was generated? In 1BPP font there is no anti-aliasing effect becuse of no alpha channel and ARGB font rendering is perfect for curved characters like C, O, Q, etc. Becasue of this reason I need ARGB font, can you help me to generate ARGB font.

Hi @yugandhar

The Font Tool does not support generating fonts in ARGB format.

You can provide a bitmap (.bmp) file for each character that you want to display.

  1. Set the image size according to your display needs; the height should be twice the width.
  2. Keep the background black or transparent, and draw the character in white. Color can later be controlled in software.
  3. Let us know your desired output format (e.g. ARGB4444).

The required characters to display are:
1, 2, 3, 4, 5, 6, 7, 8, 9, A, M, P, :, /, -

Please confirm if there are any additional characters that need to be included.

Once you provide these files, we’ll prepare a corresponding patch for you.

Hi @Pammy

Thanks for the update. So, The character bitmaps will be converted to required color format(ARGB4444) using OSD2 generation tool and each charcater’s glyph data(ARGB4444 format) will be assembled as font file offline and shared with us?

If we want to try different fonts, evertytime we need to request for font data by generating bmp files as you mentioned, It is very difficult to do until I finalize a font file.

Can you share the format of font file currently using? I think it has a header and data section, header contains all characters info like ascii values, width, height, bmp size, bmp data offset in data section, etc. If possible please share that information or a tool which does same.

Hi @yugandhar,

The font file currently in use is custom_font_argb4444.h, which renders text in white by default.
If you need to change the text colour, transparency, you can include this function I use to test in isp_osd_example.c to modify these properties.

extern unsigned int eng_bin_len_custom_32x64;
extern unsigned char eng_bin_custom_32x64[];

// Number of bytes in the header (metadata, not pixels)
#define FONT_HEADER_BYTES 1648   // current 32x64 font

static unsigned char *g_font = NULL;

// Recolour white ARGB4444 font
static void font_recolor(void)
{
	// already recolored once
    if (g_font != NULL) {
        return;
    }

    // allocate RAM for whole font
    g_font = malloc(eng_bin_len_custom_32x64);
    if (!g_font) {
        printf("font_recolor_to_red: malloc failed\r\n");
        return;
    }

    memcpy(g_font, eng_bin_custom_32x64, eng_bin_len_custom_32x64);
 	
	// Pixel data starts after font header
    int start = FONT_HEADER_BYTES;

    // make sure we start on 16-bit boundary
    if (start & 1) {
        start++;
    }

    // Each pixel is 16 bits → loop in steps of 2 byte
    for (int i = start; i < (int)eng_bin_len_custom_32x64 - 1; i += 2) {

		uint8_t low_byte  = g_font[i];
		uint8_t high_byte = g_font[i + 1];
		uint16_t px = (uint16_t)low_byte | ((uint16_t)high_byte << 8); // Combine two bytes into one 16-bit pixel (little-endian)

		uint8_t A = (px >> 12) & 0x0F;
        uint8_t B = (px >>  8) & 0x0F;
        uint8_t G = (px >>  4) & 0x0F;
        uint8_t R =  px        & 0x0F;

		if (A == 0) {
			// fully transparent or non-used word, skip
			continue;
		}
		//A = 0x8; 
		B = 0x0;
        G = 0x0;
        R = 0x0;
       	uint16_t new_px = (A << 12) | (B << 8) | (G << 4) | R;

        // Write recolored pixel back
        g_font[i]     = (uint8_t)(new_px & 0xFF); // lower 8 bits
        g_font[i + 1] = (uint8_t)(new_px >> 8); // upper 8 bits
    }
}

in void example_isp_osd(int idx, int ch_id, int txt_w, int txt_h) function you can modify the code in #if CHANGE_FONT

#if CHANGE_FONT

#if USE_CUSTOM_1BPP

		rts_set_font_char_size(ch_id, txt_w, txt_h, eng_bin_custom_32x64, NULL);

#else
		font_recolor(); 

		if (g_font) {
			rts_set_font_char_size(ch_id, txt_w, txt_h, g_font, NULL);
		} else {
			// fallback: original white font if recolor failed
			rts_set_font_char_size(ch_id, txt_w, txt_h, eng_bin_custom_32x64, NULL);
		}
#endif

The above-mentioned custom_font_argb4444.h is the default font file for argb4444. If additional characters are needed, we may need to provide a patch for you. The OSD2 generation tool currently does not support generating fonts in ARGB format.

Hi @Pammy ,

Happy to hear that, please provide ARGB font file data with all ASCII printable characters like alphabets, digits, symbols, etc. to move on temporarily. I will share bmp files of individual characters in our font soon as you suggested.

The characters required are as below.

0123456789`~!@#$%^&*()-=_+,./;’\<>?:”{}|

abcdefghijklmnopqrstuvwxyz

ABCDEFGHIJKLMNOPQRSTUVWXYZ

Please mention the original character width and height also. I am waiting for your reply with font file data. Please send it ASAP.

Thanks,

Yugandhar

Hi @yugandhar ,

Refer to the characters below that are used to generate custom_font_argb4444.h

.

32x64

Hi @Pammy ,

Please share the ARGB font file data for the attached characters.

required_chars.zip (313 Bytes)

Hi @yugandhar

Could you share the font name you intend to use if you are unable to provide the individual character BMP files at the moment?

Hi @Pammy ,

Please use the same font which was used for custom font in GitHub repository and generate for the characters I provided.

https://github.com/Ameba-AIoT/ameba-rtos-pro2/blob/main/component/video/osd2/custom_font_argb4444.h

Thanks,

Yugandhar

Hi @yugandhar

Sure, we are currently processing it. It will require a bit of time, we’ll share it with you as soon as it’s ready.