2020#include < tier0/dbg.h>
2121#include < vgui/ISurface.h>
2222#include < utlbuffer.h>
23+ #if HAVE_FC
2324#include < fontconfig/fontconfig.h>
25+ #endif
2426#include < freetype/ftbitmap.h>
2527#include " materialsystem/imaterialsystem.h"
2628
@@ -462,10 +464,14 @@ char *TryFindFont(const char *winFontName, bool bBold, int italic)
462464
463465 return fontFile;
464466#else
465- // "platform/resource/linux_fonts/";
467+ bool bRegularPostfix = false ;
468+ fontName = " dejavusans" ;
466469
467470 if ( strcmp ( winFontName, " Courier New" ) == 0 )
468- fontName = " liberationmono" ;
471+ {
472+ strncpy (fontFile, " platform/resource/linux_fonts/liberationmono-regular.ttf" , sizeof (fontFile));
473+ return fontFile;
474+ }
469475
470476 if ( bBold )
471477 {
@@ -477,9 +483,13 @@ char *TryFindFont(const char *winFontName, bool bBold, int italic)
477483 else if ( italic )
478484 fontNamePost = " oblique" ;
479485 else
480- fontNamePost = " regular" ;
486+ fontNamePost = NULL ;
487+
488+ if ( fontNamePost )
489+ snprintf (fontFile, sizeof fontFile, " platform/resource/linux_fonts/%s-%s.ttf" , fontName, fontNamePost);
490+ else
491+ snprintf (fontFile, sizeof fontFile, " platform/resource/linux_fonts/%s.ttf" , fontName );
481492
482- snprintf (fontFile, sizeof fontFile, " platform/resource/linux_fonts/%s-%s.ttf" , fontName, fontNamePost);
483493 return fontFile;
484494#endif
485495}
@@ -498,14 +508,14 @@ char *CLinuxFont::GetFontFileName( const char *windowsFontName, int flags )
498508 else if ( !Q_stricmp ( pchFontName, " Arial Black" ) || Q_stristr ( pchFontName, " bold" ) )
499509 bBold = true ;
500510
501- const int italic = ( flags & vgui::ISurface::FONTFLAG_ITALIC ) ? FC_SLANT_ITALIC : FC_SLANT_ROMAN;
502-
503511#if !HAVE_FC
504- char *filename = TryFindFont ( windowsFontName, bBold, italic );
505- Msg (" Found font: %s\n " , filename);
512+ char *filename = TryFindFont ( windowsFontName, bBold, flags & vgui::ISurface::FONTFLAG_ITALIC );
506513 if ( !filename ) return NULL ;
514+ Msg (" Found font: %s\n " , filename);
507515 return strdup ( filename );
508516#else
517+ const int italic = ( flags & vgui::ISurface::FONTFLAG_ITALIC ) ? FC_SLANT_ITALIC : FC_SLANT_ROMAN;
518+
509519 const int nFcWeight = bBold ? FC_WEIGHT_BOLD : FC_WEIGHT_NORMAL;
510520 FcPattern *match = FontMatch ( FC_FAMILY, FcTypeString, pchFontName,
511521 FC_WEIGHT, FcTypeInteger, nFcWeight,
0 commit comments