Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] Utf8 doesn't work in 4.5.0.3 #184

Closed
3 tasks done
AlexisHuvier opened this issue Aug 11, 2023 · 10 comments
Closed
3 tasks done

[Bug] Utf8 doesn't work in 4.5.0.3 #184

AlexisHuvier opened this issue Aug 11, 2023 · 10 comments
Labels
question Further information is requested

Comments

@AlexisHuvier
Copy link

Before submitting a new issue, please verify and check:

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

Issue description

Since 4.5.0.3, drawing utf8 text shows wrong characters.

Environment

I'm on Windows, with last version of Raylib-cs.

Issue screenshot

4.5.0.2 :
image

4.5.0.3 :
image

@nickyMcDonald
Copy link
Contributor

Looks like bug was introduced here #173

@chrisdill
Copy link
Owner

@AlexisHuvier Can you share a code example for this issue?

@chrisdill chrisdill added the question Further information is requested label Aug 11, 2023
@AlexisHuvier
Copy link
Author

@AlexisHuvier Can you share a code example for this issue?

I don't have now because it in a big project.
If it's needed, i can make it

@chrisdill
Copy link
Owner

Just a small example drawing the text that is not showing correctly and the name of the font used.

@AlexisHuvier
Copy link
Author

Just a small example drawing the text that is not showing correctly and the name of the font used.

Screens in the first message used extern font but with DrawText there is the same problem. So i used it to make this example :

    private static void Main()
    {
        // Initialization
        //--------------------------------------------------------------------------------------
        const int screenWidth = 800;
        const int screenHeight = 450;

        InitWindow(screenWidth, screenHeight, "Test");
        //--------------------------------------------------------------------------------------

        // Main game loop
        while (!WindowShouldClose())
        {
            BeginDrawing();
            ClearBackground(Color.RAYWHITE);

            DrawText("éèàùè&", 250, 20, 20, Color.DARKGRAY);

            EndDrawing();
        }

        CloseWindow();
    }

Result with 4.5.0.3 :
image

@nickyMcDonald
Copy link
Contributor

Wouldn’t this be expected with the default font? I don’t believe there are any additional characters beyond ASCII in the default font.

@AlexisHuvier
Copy link
Author

Wouldn’t this be expected with the default font? I don’t believe there are any additional characters beyond ASCII in the default font.

With the same code, 4.5.0.2 make this result :
image

@nickyMcDonald
Copy link
Contributor

I'm proven wrong about the default font.

I have made a pr with a fix for this bug #185.

This was the result of a fix for another bug. That fix changed all the string conversions from UTF8 to ANSI. Issue is that raylib uses UTF8 for drawing text not ANSI.

@chrisdill
Copy link
Owner

@n77y Thanks for looking into this issue. Few changes needed on your pr then it can be merged.

@chrisdill chrisdill reopened this Aug 13, 2023
@chrisdill
Copy link
Owner

@AlexisHuvier @n77y Fix is now in the 4.5.0.4 release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants