Skip to content

Commit

Permalink
Fix font loading (#37919)
Browse files Browse the repository at this point in the history
* Remove Terminus-Bold font

It has same internal id as normal Terminus font which can cause confusion.

* Avoid adding file extension to typeface multiple times
  • Loading branch information
ZhilkinSerg authored Feb 17, 2020
1 parent bd6534a commit 9aa8765
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
Binary file removed data/font/terminus-bold.fon
Binary file not shown.
5 changes: 3 additions & 2 deletions src/sdltiles.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3865,20 +3865,21 @@ CachedTTFFont::CachedTTFFont( const int w, const int h, std::string typeface, in
: Font( w, h )
, fontblending( fontblending )
{
const std::string original_typeface = typeface;
int faceIndex = 0;
if( const cata::optional<std::string> sysfnt = find_system_font( typeface, faceIndex ) ) {
typeface = *sysfnt;
dbg( D_INFO ) << "Using font [" + typeface + "] found in the system.";
}
if( !file_exist( typeface ) ) {
faceIndex = 0;
typeface = PATH_INFO::user_font() + typeface + ".ttf";
typeface = PATH_INFO::user_font() + original_typeface + ".ttf";
dbg( D_INFO ) << "Using compatible font [" + typeface + "] found in user font dir.";
}
//make fontdata compatible with wincurse
if( !file_exist( typeface ) ) {
faceIndex = 0;
typeface = PATH_INFO::fontdir() + typeface + ".ttf";
typeface = PATH_INFO::fontdir() + original_typeface + ".ttf";
dbg( D_INFO ) << "Using compatible font [" + typeface + "] found in font dir.";
}
//different default font with wincurse
Expand Down

0 comments on commit 9aa8765

Please sign in to comment.