"glyph dsc. not found" Error when adding an arabic font

Description

I am trying to export a new font into the library on VS simulation

a simple label shows “hello أهلا وسهلا”
but i get this error

Warn: lv_draw_letter: glyph dsc. not found

for every arabic letter

and it only shows the English letters

Code to reproduce


LV_FONT_DECLARE(ReemKufi_Regular)

void custom_fonts(void)
{
	static lv_style_t style;
	lv_style_init(&style);
	lv_style_set_text_font(&style, LV_STATE_DEFAULT,&ReemKufi_Regular);

	lv_obj_t * lbl = lv_label_create(lv_scr_act(), NULL);

	lv_obj_align(lbl,NULL,LV_ALIGN_CENTER,0,0);
	lv_label_set_text(lbl,"hello اهلا وسهلا");
	lv_obj_add_style(lbl,LV_LABEL_PART_MAIN,&style);
}

Screenshot

the output

image

what I expect

image

the online font converter settings “which i actually don’t really understand”

the font file

Reem_Kufi.zip (28.1 KB)

please see the discussion on this thread to verify your setup.

Hey @ashrafkamel5,

You can get this to work by identifying the Unicode’s of characters that you need.

  1. head over to https://fontdrop.info/ and drop the ttf into it
  2. identify the ranges of Unicode of characters inside the fonts. If you hover over them or double click you can get the characters Unicode
  3. In the font converter put the range in as hex ( you can use a “,” and insert multiple ranges)
    image
  4. update your generated c file

cheers :slight_smile:

1 Like

thanks alsaleem
I did and and i see nothing missing
can you help with this?
I managed to get the ranges right
and still no output

many thanks for your detailed reply.
alas.
the problem still exists

LV_FONT_DECLARE(ReemKufi_numbers)
LV_FONT_DECLARE(ReemKufi_30)
LV_FONT_DECLARE(ReemKufi_Regular)
LV_FONT_DECLARE(ReemKufi_30_manually)


void custom_fonts(void)
{
	static lv_style_t style;
	lv_style_init(&style);
	//lv_style_set_text_font(&style, LV_STATE_DEFAULT,&ReemKufi_Regular);
	lv_style_set_text_font(&style, LV_STATE_DEFAULT, &ReemKufi_30);
	//lv_style_set_text_font(&style, LV_STATE_DEFAULT, &ReemKufi_30_manually);
	//lv_style_set_text_font(&style, LV_STATE_DEFAULT, &ReemKufi_numbers);
	lv_obj_t * lbl = lv_label_create(lv_scr_act(), NULL);

	lv_obj_align(lbl,NULL,LV_ALIGN_CENTER,0,0);
	
	lv_label_set_text(lbl,"hello123 أهلا ١٢٣");
	lv_obj_add_style(lbl,LV_LABEL_PART_MAIN,&style);
}

I used fontforge to get the individual unicode in my font.
image
and after along time of manually getting the codes.
it also doesn’t work :frowning:
then I used a crude python script using fonttools library.
and got all the individual unicodes from the font
with no luck.
here are the ranges i managed to get
unicoderange.txt (2.6 KB)
manual_range.txt (184 Bytes)

and here is my generated font.c files
ReemKufi_30.c (196.8 KB)
ReemKufi_30_manually.c (185.8 KB)
ReemKufi_numbers.c (6.2 KB)
the numbers file was the same as the you did in your example mr @mair.swartz
can you share yours,please?

(1) Some font files do not include all characters, When you use font converter, it will tell you which font is missing when it processes the file. It will produce the necessary .c for you.

(2) the link i provided (forum) also contains all required fonts ranges for arabic display. Your font ranges is not correct. The correct ones are below. (Note: you can mix font files to get full range if some characyers are missing from a file)

-r 0x20-0x7f -r 0x600-0x6ff  -r 0xfe00-0xfeff

(3) Use (lv_font_dejavu_16_persian_hebrew) that comes with lvgl code. After you verify your CODE is working, you can use your converted font.
(4) you also need to mention this font in lv_config.h file to be included. You did it already.

I did a conversion of ReemKufi_Regular.ttf to C and have taken some glyphs from the c-file.
It’s really the case, that some (or most?) arabic glyphs are not shown within my example.

I have taken some glyphs as they appear in the c-file, but I do not see an output of the arabic glyphs.
They are definitely within the c-file.

Some glyphs (taken from the c-file) are shown, but not all. Is it a strange RTL issue?
I’m not sure which version I run (> V7.2) on my Visual Studio example. I have to take a look tomorrow.

image

I don’t know what this message means @alsaleem00, I don’t know all of the unicodes
I uploaded the font to https://fontdrop.info/ and you will find the Arabic letters in it.
they are in this range 0600 — 06FF. and then I picked the ones which I found in the font.
you can check the ranges I found in the files in the reply to Mr Mair reply.
Many thanks.

Thank you very much Mr @robekras.
Are you suggesting trying out another font or what?

and can I ask you about the way of getting the Unicode ranges from the ttf file?
really looking for a shortcut.

would the converter work If I just put the full range?
shouldn’t I just enter the existing unicodes in the font.ttf file?

In range setting, I’ve taken the full range (0 - 0xffff), then you get some single ranges in the resulting c-file.
I’ve taken the characters which are preceeding the
glyph data as a c-comment and entered it into notepad++.
In notepad++ I observed, that when I copy and pasted the arabic character to the end of the line (at the right most position), it was added to the end of the arabic line which is in LTR the left most position. Also a little bit strange!

I think, that issue needs a debugging session.

1 Like

Is this problem related to this font only or what :face_with_raised_eyebrow::face_with_raised_eyebrow:
@robekras

And can you elaborate on the problem you encountered.
What line was the Arabic letters in a LTR?

Don’t know. I havn’t checked any other font so far.

Can you show your output?

I am a bit confused about what the issue is here. The builtin DejaVu Hebrew font includes the following ranges:

0x20-0x7f,0x5d0-0x5ea,0x600-0x6FF,0xFB50-0xFDFF,0xFE70-0xFEFF

If the characters you are trying to use are there, could you try it (use &lv_font_dejavu_16_persian_hebrew as the font) to see if it’s an issue with Arabic font rendering in general or just your specific font?

1 Like

I tried it today with UniFont, converted the range 0x0-0x074f to C, and tried to output some arabic characters “يحكبةت” to a button label.
There is not one character shown!
When the string is “helloيحكبةت”, just the hello is shown.

So it seems to be font independent.

1 Like

Hi @alsaleem00 did you managed to make it work with Arabic letters before?
Can you send the font you used?
Would you upload the C format of it also please?

I agree with embeddedt
Yes. I am actually using the (lv_font_dejavu_16_persian_hebrew) that comes with lvgl code. It is displaying Arabic correctly “with” contextual.
Please try it first. If it goes well then you move to ReemKufi.
Please see thread i mentioned on how to use it with label.