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

Game fails to display non-latin alphabet characters possibly due to PR #37668 #37916

Closed
VoidForge opened this issue Feb 11, 2020 · 1 comment · Fixed by #37919
Closed

Game fails to display non-latin alphabet characters possibly due to PR #37668 #37916

VoidForge opened this issue Feb 11, 2020 · 1 comment · Fixed by #37919
Labels
<Bug> This needs to be fixed (S2 - Confirmed) Bug that's been confirmed to exist

Comments

@VoidForge
Copy link

Describe the bug

All non-latin alphabet characters fail to be displayed in build #10316. Likely caused by erroneous code in PR#37668.
I believe that the problem is caused by std::unique_ptr<Font> Font::load_font( const std::string &typeface, int fontsize in src/sdltiles.cpp, where fonts in data/font are not loaded unless an error is thrown during loading of user's font.

   if( ends_with( typeface, ".bmp" ) || ends_with( typeface, ".png" ) ) {
        // Seems to be an image file, not a font.
        // Try to load as bitmap font from user font dir, then from font dir.
        try {
            return std::unique_ptr<Font>( std::make_unique<BitmapFont>( fontwidth, fontheight,
                                          PATH_INFO::fontdir() + typeface ) );
                                          PATH_INFO::user_font() + typeface ) );
        } catch( std::exception &err ) {
            try {
                return std::unique_ptr<Font>( std::make_unique<BitmapFont>( fontwidth, fontheight,
                                              PATH_INFO::fontdir() + typeface ) );
            } catch( std::exception &err ) {
                dbg( D_ERROR ) << "Failed to load " << typeface << ": " << err.what();
                // Continue to load as truetype font
            }
        }

Steps To Reproduce

Download build #10316 and switch to other languages like Russian or Chinese.

Expected behavior

The characters are displayed correctly.

Screenshots

Versions and configuration

  • OS: Windows
  • Game Version: 0.D-Windows_x64-Tiles-10317
  • Graphics version: Tiles
  • Mods loaded: dda

Additional context

I dont know how to create a PR to fix it.

@VoidForge
Copy link
Author

The bug is not observed in build 10316, but present in build 10317, so I am pretty sure that PR No. 37668 Added support for user font directory causes this bug.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
<Bug> This needs to be fixed (S2 - Confirmed) Bug that's been confirmed to exist
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants