Nuklear icon indicating copy to clipboard operation
Nuklear copied to clipboard

Unicode char 0x2022 shows as 0x20ac

Open ronaaron opened this issue 5 years ago • 7 comments

I noticed this when using the 'bullet' character in my code and seeing instead the Euro symbol. So I reproduced with the generic 'extended.c' demo.

Modified it so that font config 'range' includes the 0x2000 to 0x2fff, and changed the font to Ubuntu-R.ttf which includes the characters, and then inserted the bullet character in one of the display texts.

Here's a screenshot. The Euro should be a bullet, and the square box should be a Euro sign: screenshot

I've verified that inside the nk_draw_list_add_text() function, the nk_rune 0x2022 is parsed off the string. Therefore it must be the font->query() that's at fault.

ronaaron avatar Jan 05 '21 06:01 ronaaron

The problem occurs when the font config 'range' is split. For example, it fails with {0x20,0x200, 0x2000, 0x2fff, 0} but works ok with {0x20,0x2fff,0}

Not sure if it's a baking issue, or a glyph lookup issue.

ronaaron avatar Jan 05 '21 07:01 ronaaron

Curiouser and curiouser...

"Ubuntu-R" has a problem, but e.g. "Roboto-Regular" is fine.

ronaaron avatar Jan 05 '21 08:01 ronaaron

Commenting out line #16598 seems to fix the issue

if (!pc->x0 && !pc->x1 && !pc->y0 && !pc->y1) continue;

What is happening is that a missing glyph throws off the number of glyphs in the range, so the returned glyph isn't the one requested (for some fonts)

ronaaron avatar Jan 05 '21 09:01 ronaaron

Works for me too, Thanks! Many CJK fonts have same problem.

rorschach-py avatar Feb 13 '21 11:02 rorschach-py

@ronaaron

Commenting out line #16598 seems to fix the issue

if (!pc->x0 && !pc->x1 && !pc->y0 && !pc->y1) continue;

What is happening is that a missing glyph throws off the number of glyphs in the range, so the returned glyph isn't the one requested (for some fonts)

That was an excellent find! This solves https://github.com/Immediate-Mode-UI/Nuklear/issues/295

Many thanks!

FrostKiwi avatar May 17 '21 10:05 FrostKiwi

Thanks

ronaaron avatar May 17 '21 19:05 ronaaron

Is this still an issue now that https://github.com/Immediate-Mode-UI/Nuklear/pull/531 has been merged?

stefnotch avatar Mar 31 '24 19:03 stefnotch