@@ -67,10 +67,6 @@ bool osd_font_sdl::open(std::string const &font_path, std::string const &_name,
6767 bool bakedstyles = false ;
6868
6969 std::string name (_name);
70- if (name.compare (" default" ) == 0 )
71- {
72- name = " Liberation Sans|Regular" ;
73- }
7470
7571 // accept qualifiers from the name
7672 bool const underline = (strreplace (name, " [U]" , " " ) + strreplace (name, " [u]" , " " ) > 0 );
@@ -79,12 +75,22 @@ bool osd_font_sdl::open(std::string const &font_path, std::string const &_name,
7975 // Handle the "Font Family|Style" type of font name:
8076 // Separate it into family and style, and extract bold and italic style information.
8177 std::string::size_type const separator = name.rfind (' |' );
82- std::string const family (name.substr (0 , separator));
83- std::string const style ((std::string::npos != separator) ? name.substr (separator + 1 ) : std::string () );
78+ std::string family (name.substr (0 , separator));
79+ std::string style ((std::string::npos != separator) ? name.substr (separator + 1 ) : " Regular " );
8480 bool bold = (style.find (" Bold" ) != std::string::npos) || (style.find (" Black" ) != std::string::npos);
8581 bool italic = (style.find (" Italic" ) != std::string::npos) || (style.find (" Oblique" ) != std::string::npos);
8682
87- // first up, try it as a filename
83+ // Translate generic names into platform-specific real ones:
84+ if (family == " serif" )
85+ family = " Liberation Serif" ;
86+ else if (family == " sans-serif" )
87+ family = " Liberation Sans" ;
88+ else if (family == " monospace" )
89+ family = " Liberation Mono" ;
90+ else if (family == " default" )
91+ family = " Liberation Sans" ;
92+
93+ // first up, try it as a filename
8894 TTF_Font_ptr font = TTF_OpenFont_Magic (family, POINT_SIZE, 0 );
8995
9096 // if no success, try the font path
@@ -137,6 +143,7 @@ bool osd_font_sdl::open(std::string const &font_path, std::string const &_name,
137143 if (strike)
138144 osd_printf_warning (" Ignoring strikethrough for SDL_TTF older than 2.0.10\n " );
139145#endif // PATCHLEVEL
146+ osd_printf_verbose (" setting style flags %x\n " , styleflags);
140147 TTF_SetFontStyle (font.get (), styleflags);
141148
142149 height = TTF_FontLineSkip (font.get ());
0 commit comments