Raylib-cs icon indicating copy to clipboard operation
Raylib-cs copied to clipboard

[utf8] Codepoint 2193 and 2191 do not render with cascadia-code font

Open 9ParsonsB opened this issue 4 years ago • 5 comments

Before submitting a new issue, please verify and check:

  • [x] The issue is specific to Raylib-cs and not raylib
  • [x] I checked there is no similar issue already reported
  • [x] My code has ~no~ errors or misuse of Raylib-cs

Issue description

[20:16] SW_CreeperKing: i mean i think theres one more bug :D 2 characters will render as _ : ↓ and ↑ im using cascadia mono, which should support the characters [20:17] SW_CreeperKing: but idk if its because they are out of range or something (2193 and 2191 respectively) [20:56] MiniJack: https://github.com/microsoft/cascadia-code this? [20:57] SW_CreeperKing: yes

Environment

raylib-cs 4.0.0

Issue screenshot

If possible, provide a screenshot that illustrates the issue. Usually an image is better than a thousand words.

Code example

TODO

9ParsonsB avatar Feb 15 '22 11:02 9ParsonsB

I use these characters for my drop down box, terrible code: https://github.com/SWCreeperKing/RayWrapper/blob/master/RayWrapper/Objs/DropDown.cs

i am using DrawTextEx to draw the text, and for loading the font i have

        private static Font LoadFont(string font, int fontSize, int toChar = 5000)
        {
            var f = LoadFontEx(font, fontSize, null, toChar);
            SetTextureFilter(f.texture, fontFilter);
            return f;
        }

SWCreeperKing avatar Feb 15 '22 18:02 SWCreeperKing

LoadCodepoints returns 8595 for ↓ and 8593 for ↑. So these would not be included by default loading up to 5000. Changing to a number higher than this and I can get them to draw with Cascadia-Regular.otf.

rgebee avatar Feb 15 '22 19:02 rgebee

Yep, setting it to a number greater than or equal to 8595 allows me to grab them! I thought it went based off of unicode.

SWCreeperKing avatar Feb 16 '22 00:02 SWCreeperKing

The issue is that if we set toChar to a higher number by default, it may take a lot longer to load the font, which is not a great user experience

9ParsonsB avatar Feb 16 '22 04:02 9ParsonsB

You can also use LoadFontEx and pass in just the codepoints you want. I made a few fixes when testing this that will be in the next release.

rgebee avatar Feb 28 '22 20:02 rgebee