parent
d25b96d72d
commit
bcc1e28bab
|
@ -64,7 +64,7 @@ FONTCONFIG* Fontconfig()
|
||||||
FONTCONFIG::FF_RESULT FONTCONFIG::FindFont( const wxString &aFontName, wxString &aFontFile,
|
FONTCONFIG::FF_RESULT FONTCONFIG::FindFont( const wxString &aFontName, wxString &aFontFile,
|
||||||
bool aBold, bool aItalic )
|
bool aBold, bool aItalic )
|
||||||
{
|
{
|
||||||
FF_RESULT retval = FF_RESULT::ERROR;
|
FF_RESULT retval = FF_RESULT::FF_ERROR;
|
||||||
wxString qualifiedFontName = aFontName;
|
wxString qualifiedFontName = aFontName;
|
||||||
|
|
||||||
if( aBold )
|
if( aBold )
|
||||||
|
@ -93,7 +93,7 @@ FONTCONFIG::FF_RESULT FONTCONFIG::FindFont( const wxString &aFontName, wxString
|
||||||
FcChar8* family = nullptr;
|
FcChar8* family = nullptr;
|
||||||
FcChar8* style = nullptr;
|
FcChar8* style = nullptr;
|
||||||
|
|
||||||
retval = FF_RESULT::SUBSTITUTE;
|
retval = FF_RESULT::FF_SUBSTITUTE;
|
||||||
|
|
||||||
if( FcPatternGetString( font, FC_FAMILY, 0, &family ) == FcResultMatch )
|
if( FcPatternGetString( font, FC_FAMILY, 0, &family ) == FcResultMatch )
|
||||||
{
|
{
|
||||||
|
@ -132,15 +132,15 @@ FONTCONFIG::FF_RESULT FONTCONFIG::FindFont( const wxString &aFontName, wxString
|
||||||
if( fontName.Lower().StartsWith( aFontName.Lower() ) )
|
if( fontName.Lower().StartsWith( aFontName.Lower() ) )
|
||||||
{
|
{
|
||||||
if( ( aBold && !has_bold ) && ( aItalic && !has_ital ) )
|
if( ( aBold && !has_bold ) && ( aItalic && !has_ital ) )
|
||||||
retval = FF_RESULT::MISSING_BOLD_ITAL;
|
retval = FF_RESULT::FF_MISSING_BOLD_ITAL;
|
||||||
else if( aBold && !has_bold )
|
else if( aBold && !has_bold )
|
||||||
retval = FF_RESULT::MISSING_BOLD;
|
retval = FF_RESULT::FF_MISSING_BOLD;
|
||||||
else if( aItalic && !has_ital )
|
else if( aItalic && !has_ital )
|
||||||
retval = FF_RESULT::MISSING_ITAL;
|
retval = FF_RESULT::FF_MISSING_ITAL;
|
||||||
else if( ( aBold != has_bold ) || ( aItalic != has_ital ) )
|
else if( ( aBold != has_bold ) || ( aItalic != has_ital ) )
|
||||||
retval = FF_RESULT::SUBSTITUTE;
|
retval = FF_RESULT::FF_SUBSTITUTE;
|
||||||
else
|
else
|
||||||
retval = FF_RESULT::OK;
|
retval = FF_RESULT::FF_OK;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -148,9 +148,9 @@ FONTCONFIG::FF_RESULT FONTCONFIG::FindFont( const wxString &aFontName, wxString
|
||||||
FcPatternDestroy( font );
|
FcPatternDestroy( font );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( retval == FF_RESULT::ERROR )
|
if( retval == FF_RESULT::FF_ERROR )
|
||||||
wxLogWarning( _( "Error loading font '%s'." ), qualifiedFontName );
|
wxLogWarning( _( "Error loading font '%s'." ), qualifiedFontName );
|
||||||
else if( retval == FF_RESULT::SUBSTITUTE )
|
else if( retval == FF_RESULT::FF_SUBSTITUTE )
|
||||||
wxLogWarning( _( "Font '%s' not found; substituting '%s'." ), qualifiedFontName, fontName );
|
wxLogWarning( _( "Font '%s' not found; substituting '%s'." ), qualifiedFontName, fontName );
|
||||||
|
|
||||||
FcPatternDestroy( pat );
|
FcPatternDestroy( pat );
|
||||||
|
|
|
@ -97,13 +97,13 @@ OUTLINE_FONT* OUTLINE_FONT::LoadFont( const wxString& aFontName, bool aBold, boo
|
||||||
|
|
||||||
fc::FF_RESULT retval = Fontconfig()->FindFont( aFontName, fontFile, aBold, aItalic );
|
fc::FF_RESULT retval = Fontconfig()->FindFont( aFontName, fontFile, aBold, aItalic );
|
||||||
|
|
||||||
if( retval == fc::FF_RESULT::MISSING_BOLD || retval == fc::FF_RESULT::MISSING_BOLD_ITAL )
|
if( retval == fc::FF_RESULT::FF_MISSING_BOLD || retval == fc::FF_RESULT::FF_MISSING_BOLD_ITAL )
|
||||||
font->SetFakeBold();
|
font->SetFakeBold();
|
||||||
|
|
||||||
if( retval == fc::FF_RESULT::MISSING_ITAL || retval == fc::FF_RESULT::MISSING_BOLD_ITAL )
|
if( retval == fc::FF_RESULT::FF_MISSING_ITAL || retval == fc::FF_RESULT::FF_MISSING_BOLD_ITAL )
|
||||||
font->SetFakeItal();
|
font->SetFakeItal();
|
||||||
|
|
||||||
if( retval != fc::FF_RESULT::ERROR )
|
if( retval != fc::FF_RESULT::FF_ERROR )
|
||||||
(void) font->loadFace( fontFile );
|
(void) font->loadFace( fontFile );
|
||||||
|
|
||||||
font->m_fontName = aFontName; // Keep asked-for name, even if we substituted.
|
font->m_fontName = aFontName; // Keep asked-for name, even if we substituted.
|
||||||
|
|
|
@ -38,12 +38,12 @@ public:
|
||||||
|
|
||||||
enum class FF_RESULT
|
enum class FF_RESULT
|
||||||
{
|
{
|
||||||
OK,
|
FF_OK,
|
||||||
ERROR,
|
FF_ERROR,
|
||||||
SUBSTITUTE,
|
FF_SUBSTITUTE,
|
||||||
MISSING_BOLD,
|
FF_MISSING_BOLD,
|
||||||
MISSING_ITAL,
|
FF_MISSING_ITAL,
|
||||||
MISSING_BOLD_ITAL
|
FF_MISSING_BOLD_ITAL
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue