#i87970# better debug printing for FC substitutions
This commit is contained in:
parent
8f25475364
commit
baab9baa6a
1 changed files with 45 additions and 20 deletions
|
@ -2174,19 +2174,32 @@ bool FcPreMatchSubstititution::FindFontSubstitute( ImplFontSelectData &rFontSelD
|
||||||
|
|
||||||
rtl::OUString aDummy;
|
rtl::OUString aDummy;
|
||||||
const ImplFontSelectData aOut = GetFcSubstitute( rFontSelData, aDummy );
|
const ImplFontSelectData aOut = GetFcSubstitute( rFontSelData, aDummy );
|
||||||
|
// TODO: cache the font substitution suggestion
|
||||||
|
// FC doing it would be preferable because it knows the invariables
|
||||||
|
// e.g. FC knows the FC rule that all Arial gets replaced by LiberationSans
|
||||||
|
// whereas we would have to check for every size or attribute
|
||||||
if( !aOut.maSearchName.Len() )
|
if( !aOut.maSearchName.Len() )
|
||||||
return false;
|
return false;
|
||||||
if( uselessmatch(rFontSelData, aOut ) )
|
|
||||||
return false;
|
const bool bHaveSubstitute = !uselessmatch( rFontSelData, aOut );
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
ByteString aOrigName( rFontSelData.maTargetName, RTL_TEXTENCODING_UTF8 );
|
const ByteString aOrigName( rFontSelData.maTargetName, RTL_TEXTENCODING_UTF8 );
|
||||||
ByteString aSubstName( aOut.maSearchName, RTL_TEXTENCODING_UTF8 );
|
const ByteString aSubstName( aOut.maSearchName, RTL_TEXTENCODING_UTF8 );
|
||||||
printf( "FcPreMatchSubstititution \"%s\" -> \"%s\"\n",
|
printf( "FcPreMatchSubstititution \"%s\" bipw=%d%d%d%d -> ",
|
||||||
aOrigName.GetBuffer(), aSubstName.GetBuffer() );
|
aOrigName.GetBuffer(), rFontSelData.meWeight, rFontSelData.meItalic,
|
||||||
|
rFontSelData.mePitch, rFontSelData.meWidthType );
|
||||||
|
if( !bHaveSubstitute )
|
||||||
|
printf( "no substitute available\n" );
|
||||||
|
else
|
||||||
|
printf( "\"%s\" bipw=%d%d%d%d\n", aSubstName.GetBuffer(),
|
||||||
|
aOut.meWeight, aOut.meItalic, aOut.mePitch, aOut.meWidthType );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
if( bHaveSubstitute )
|
||||||
rFontSelData = aOut;
|
rFontSelData = aOut;
|
||||||
return true;
|
|
||||||
|
return bHaveSubstitute;
|
||||||
}
|
}
|
||||||
|
|
||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
|
@ -2203,20 +2216,32 @@ bool FcGlyphFallbackSubstititution::FindFontSubstitute( ImplFontSelectData& rFon
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
const ImplFontSelectData aOut = GetFcSubstitute( rFontSelData, rMissingCodes );
|
const ImplFontSelectData aOut = GetFcSubstitute( rFontSelData, rMissingCodes );
|
||||||
// TODO: cache the unicode+font specific result
|
// TODO: cache the unicode + srcfont specific result
|
||||||
|
// FC doing it would be preferable because it knows the invariables
|
||||||
|
// e.g. FC knows the FC rule that all Arial gets replaced by LiberationSans
|
||||||
|
// whereas we would have to check for every size or attribute
|
||||||
if( !aOut.maSearchName.Len() )
|
if( !aOut.maSearchName.Len() )
|
||||||
return false;
|
return false;
|
||||||
if (uselessmatch(rFontSelData, aOut))
|
|
||||||
return false;
|
const bool bHaveSubstitute = !uselessmatch( rFontSelData, aOut );
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
ByteString aOrigName( rFontSelData.maTargetName, RTL_TEXTENCODING_UTF8 );
|
const ByteString aOrigName( rFontSelData.maTargetName, RTL_TEXTENCODING_UTF8 );
|
||||||
ByteString aSubstName( aOut.maSearchName, RTL_TEXTENCODING_UTF8 );
|
const ByteString aSubstName( aOut.maSearchName, RTL_TEXTENCODING_UTF8 );
|
||||||
printf( "FcGlyphFallbackSubstititution \"%s\" -> \"%s\"\n",
|
printf( "FcGFSubstititution \"%s\" bipw=%d%d%d%d ->",
|
||||||
aOrigName.GetBuffer(), aSubstName.GetBuffer() );
|
aOrigName.GetBuffer(), rFontSelData.meWeight, rFontSelData.meItalic,
|
||||||
|
rFontSelData.mePitch, rFontSelData.meWidthType );
|
||||||
|
if( !bHaveSubstitute )
|
||||||
|
printf( "no substitute available\n" );
|
||||||
|
else
|
||||||
|
printf( "\"%s\" bipw=%d%d%d%d\n", aSubstName.GetBuffer(),
|
||||||
|
aOut.meWeight, aOut.meItalic, aOut.mePitch, aOut.meWidthType );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
if( bHaveSubstitute )
|
||||||
rFontSelData = aOut;
|
rFontSelData = aOut;
|
||||||
return true;
|
|
||||||
|
return bHaveSubstitute;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
Loading…
Reference in a new issue