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

Check the typeface file exists #75937

Merged
merged 2 commits into from
Aug 26, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion src/cata_imgui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,13 @@
ImU32 rgb = sdlCol.b << 16 | sdlCol.g << 8 | sdlCol.r;
sdlColorsToCata[rgb] = index;
}
io.FontDefault = io.Fonts->AddFontFromFileTTF( io_typefaces[0].c_str(), fontheight, nullptr,
auto it = std::find_if( io_typefaces.begin(),
io_typefaces.end(), []( const std::string & io_typeface ) {
std::filesystem::path path( io_typeface );

Check failure on line 274 in src/cata_imgui.cpp

View workflow job for this annotation

GitHub Actions / build (src)

Construct `fs::path` by passing UTF-8 string to `fs::u8path` to ensure the correct path encoding. [cata-u8-path,-warnings-as-errors]

Check failure on line 274 in src/cata_imgui.cpp

View workflow job for this annotation

GitHub Actions / Clang 14, macOS 12, Tiles, Sound, x64 and arm64 Universal Binary

'path' is unavailable: introduced in macOS 10.15

Check failure on line 274 in src/cata_imgui.cpp

View workflow job for this annotation

GitHub Actions / Clang 14, macOS 12, Tiles, Sound, x64 and arm64 Universal Binary

'~path' is unavailable: introduced in macOS 10.15

Check failure on line 274 in src/cata_imgui.cpp

View workflow job for this annotation

GitHub Actions / Clang 14, macOS 12, Tiles, Sound, x64 and arm64 Universal Binary

'path' is unavailable: introduced in macOS 10.15
return std::filesystem::exists( path );

Check failure on line 275 in src/cata_imgui.cpp

View workflow job for this annotation

GitHub Actions / Clang 14, macOS 12, Tiles, Sound, x64 and arm64 Universal Binary

'exists' is unavailable: introduced in macOS 10.15
} );
std::string existing_typeface = *it;
io.FontDefault = io.Fonts->AddFontFromFileTTF( existing_typeface.c_str(), fontheight, nullptr,
io.Fonts->GetGlyphRangesDefault() );
io.Fonts->Fonts[0]->SetFallbackStrSizeCallback( GetFallbackStrWidth );
io.Fonts->Fonts[0]->SetFallbackCharSizeCallback( GetFallbackCharWidth );
Expand Down
Loading