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.
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?
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?
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.
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.
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.
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.