summaryrefslogtreecommitdiff
path: root/vcl/unx
diff options
context:
space:
mode:
Diffstat (limited to 'vcl/unx')
-rw-r--r--vcl/unx/headless/svpgdi.cxx4
-rw-r--r--vcl/unx/headless/svpgdi.hxx1
-rw-r--r--vcl/unx/headless/svppspgraphics.cxx30
-rw-r--r--vcl/unx/headless/svppspgraphics.hxx1
-rw-r--r--vcl/unx/inc/pspgraphics.h1
-rw-r--r--vcl/unx/inc/salgdi.h1
-rw-r--r--vcl/unx/source/fontmanager/fontcache.cxx13
-rw-r--r--vcl/unx/source/fontmanager/fontconfig.cxx190
-rw-r--r--vcl/unx/source/fontmanager/fontmanager.cxx8
-rw-r--r--vcl/unx/source/gdi/pspgraphics.cxx30
-rw-r--r--vcl/unx/source/gdi/salgdi3.cxx195
-rw-r--r--vcl/unx/source/gdi/xlfd_extd.cxx3
12 files changed, 353 insertions, 124 deletions
diff --git a/vcl/unx/headless/svpgdi.cxx b/vcl/unx/headless/svpgdi.cxx
index bd317c883b0b..5315df2e179b 100644
--- a/vcl/unx/headless/svpgdi.cxx
+++ b/vcl/unx/headless/svpgdi.cxx
@@ -587,3 +587,7 @@ bool SvpSalGraphics::supportsOperation( OutDevSupportType ) const
{
return false;
}
+
+void SvpSalGraphics::GetFontHints( const ImplFontAttributes& , int , ImplFontHints& ) const
+{
+}
diff --git a/vcl/unx/headless/svpgdi.hxx b/vcl/unx/headless/svpgdi.hxx
index 1c71704c0031..227d45469eb6 100644
--- a/vcl/unx/headless/svpgdi.hxx
+++ b/vcl/unx/headless/svpgdi.hxx
@@ -170,6 +170,7 @@ public:
virtual SystemGraphicsData GetGraphicsData() const;
virtual SystemFontData GetSysFontData( int nFallbacklevel ) const;
+ virtual void GetFontHints( const ImplFontAttributes& rFontAttributes, int nSize, ImplFontHints& rFontHints) const;
};
#endif
diff --git a/vcl/unx/headless/svppspgraphics.cxx b/vcl/unx/headless/svppspgraphics.cxx
index 1311aaed4ee4..19bb848c63b2 100644
--- a/vcl/unx/headless/svppspgraphics.cxx
+++ b/vcl/unx/headless/svppspgraphics.cxx
@@ -1160,32 +1160,6 @@ ImplDevFontAttributes PspGraphics::Info2DevFontAttributes( const psp::FastPrintF
aDFA.mePitch = ToFontPitch (rInfo.m_ePitch);
aDFA.mbSymbolFlag = (rInfo.m_aEncoding == RTL_TEXTENCODING_SYMBOL);
- switch (rInfo.m_eEmbeddedbitmap)
- {
- default:
- aDFA.meEmbeddedBitmap = EMBEDDEDBITMAP_DONTKNOW;
- break;
- case psp::fcstatus::istrue:
- aDFA.meEmbeddedBitmap = EMBEDDEDBITMAP_TRUE;
- break;
- case psp::fcstatus::isfalse:
- aDFA.meEmbeddedBitmap = EMBEDDEDBITMAP_FALSE;
- break;
- }
-
- switch (rInfo.m_eAntialias)
- {
- default:
- aDFA.meAntiAlias = ANTIALIAS_DONTKNOW;
- break;
- case psp::fcstatus::istrue:
- aDFA.meAntiAlias = ANTIALIAS_TRUE;
- break;
- case psp::fcstatus::isfalse:
- aDFA.meAntiAlias = ANTIALIAS_FALSE;
- break;
- }
-
switch( rInfo.m_eType )
{
case psp::fonttype::Builtin:
@@ -1392,3 +1366,7 @@ SystemGraphicsData PspGraphics::GetGraphicsData() const
return aRes;
}
+void PspGraphics::GetFontHints( const ImplFontAttributes& , int , ImplFontHints& ) const
+{
+}
+
diff --git a/vcl/unx/headless/svppspgraphics.hxx b/vcl/unx/headless/svppspgraphics.hxx
index 7e5ff051f27b..75d3c9edf741 100644
--- a/vcl/unx/headless/svppspgraphics.hxx
+++ b/vcl/unx/headless/svppspgraphics.hxx
@@ -190,6 +190,7 @@ public:
virtual SystemGraphicsData GetGraphicsData() const;
virtual SystemFontData GetSysFontData( int nFallbacklevel ) const;
+ virtual void GetFontHints( const ImplFontAttributes& rFontAttributes, int nSize, ImplFontHints& rFontHints) const;
};
#endif // _SVP_PSPGRAPHICS_HXX
diff --git a/vcl/unx/inc/pspgraphics.h b/vcl/unx/inc/pspgraphics.h
index 0ccc13291714..6b9fd8500e9a 100644
--- a/vcl/unx/inc/pspgraphics.h
+++ b/vcl/unx/inc/pspgraphics.h
@@ -103,6 +103,7 @@ public:
virtual void SetTextColor( SalColor nSalColor );
virtual USHORT SetFont( ImplFontSelectData*, int nFallbackLevel );
virtual void GetFontMetric( ImplFontMetricData* );
+ virtual void GetFontHints( const ImplFontAttributes& rFontAttributes, int nSize, ImplFontHints& rFontHints) const;
virtual ULONG GetKernPairs( ULONG nPairs, ImplKernPairData* pKernPairs );
virtual ImplFontCharMap* GetImplFontCharMap() const;
virtual void GetDevFontList( ImplDevFontList* );
diff --git a/vcl/unx/inc/salgdi.h b/vcl/unx/inc/salgdi.h
index f893b547e847..b4d07d397794 100644
--- a/vcl/unx/inc/salgdi.h
+++ b/vcl/unx/inc/salgdi.h
@@ -253,6 +253,7 @@ public:
virtual void SetTextColor( SalColor nSalColor );
virtual USHORT SetFont( ImplFontSelectData*, int nFallbackLevel );
virtual void GetFontMetric( ImplFontMetricData* );
+ virtual void GetFontHints( const ImplFontAttributes& rFontAttributes, int nSize, ImplFontHints& rFontHints) const;
virtual ULONG GetKernPairs( ULONG nPairs, ImplKernPairData* pKernPairs );
virtual ImplFontCharMap* GetImplFontCharMap() const;
virtual void GetDevFontList( ImplDevFontList* );
diff --git a/vcl/unx/source/fontmanager/fontcache.cxx b/vcl/unx/source/fontmanager/fontcache.cxx
index 524a365ee20b..24877275bd0d 100644
--- a/vcl/unx/source/fontmanager/fontcache.cxx
+++ b/vcl/unx/source/fontmanager/fontcache.cxx
@@ -214,9 +214,9 @@ void FontCache::flush()
aLine.Append( ';' );
aLine.Append( (*it)->m_bUserOverride ? "1" : "0" );
aLine.Append( ';' );
- aLine.Append( ByteString::CreateFromInt32( (*it)->m_eEmbeddedbitmap ) );
+ aLine.Append( ByteString::CreateFromInt32( 0 ) );
aLine.Append( ';' );
- aLine.Append( ByteString::CreateFromInt32( (*it)->m_eAntialias ) );
+ aLine.Append( ByteString::CreateFromInt32( 0 ) );
switch( (*it)->m_eType )
{
@@ -426,9 +426,6 @@ void FontCache::read()
= atoi( pLine + nTokenPos[14] );
pFont->m_bUserOverride
= (atoi( pLine + nTokenPos[15] ) != 0);
- pFont->m_eEmbeddedbitmap
- = (fcstatus::type)atoi(pLine+nTokenPos[16]);
- pFont->m_eAntialias = (fcstatus::type)atoi(pLine+nTokenPos[17]);
int nStyleTokenNr = 18;
switch( eType )
{
@@ -560,8 +557,6 @@ void FontCache::copyPrintFont( const PrintFontManager::PrintFont* pFrom, PrintFo
pTo->m_nYMax = pFrom->m_nYMax;
pTo->m_bHaveVerticalSubstitutedGlyphs = pFrom->m_bHaveVerticalSubstitutedGlyphs;
pTo->m_bUserOverride = pFrom->m_bUserOverride;
- pTo->m_eEmbeddedbitmap = pFrom->m_eEmbeddedbitmap;
- pTo->m_eAntialias = pFrom->m_eAntialias;
}
/*
@@ -623,9 +618,7 @@ bool FontCache::equalsPrintFont( const PrintFontManager::PrintFont* pLeft, Print
pRight->m_nXMax != pLeft->m_nXMax ||
pRight->m_nYMax != pLeft->m_nYMax ||
pRight->m_bHaveVerticalSubstitutedGlyphs != pLeft->m_bHaveVerticalSubstitutedGlyphs ||
- pRight->m_bUserOverride != pLeft->m_bUserOverride ||
- pRight->m_eEmbeddedbitmap != pLeft->m_eEmbeddedbitmap ||
- pRight->m_eAntialias != pLeft->m_eAntialias
+ pRight->m_bUserOverride != pLeft->m_bUserOverride
)
return false;
std::list< int >::const_iterator lit, rit;
diff --git a/vcl/unx/source/fontmanager/fontconfig.cxx b/vcl/unx/source/fontmanager/fontconfig.cxx
index bc0dae480d31..eb15c490ce8c 100644
--- a/vcl/unx/source/fontmanager/fontconfig.cxx
+++ b/vcl/unx/source/fontmanager/fontconfig.cxx
@@ -120,6 +120,7 @@ class FontCfgWrapper
FcBool (*m_pFcConfigAppFontAddDir)(FcConfig*, const FcChar8*);
FcBool (*m_pFcConfigSubstitute)(FcConfig*,FcPattern*,FcMatchKind);
FcBool (*m_pFcPatternAddInteger)(FcPattern*,const char*,int);
+ FcBool (*m_pFcPatternAddDouble)(FcPattern*,const char*,double);
FcBool (*m_pFcPatternAddBool)(FcPattern*,const char*,FcBool);
FcBool (*m_pFcPatternAddCharSet)(FcPattern*,const char*,const FcCharSet*);
FcBool (*m_pFcPatternAddString)(FcPattern*,const char*,const FcChar8*);
@@ -223,6 +224,8 @@ public:
{ return m_pFcConfigSubstitute( pConfig, pPattern, eKind ); }
FcBool FcPatternAddInteger( FcPattern* pPattern, const char* pObject, int nValue )
{ return m_pFcPatternAddInteger( pPattern, pObject, nValue ); }
+ FcBool FcPatternAddDouble( FcPattern* pPattern, const char* pObject, double nValue )
+ { return m_pFcPatternAddDouble( pPattern, pObject, nValue ); }
FcBool FcPatternAddString( FcPattern* pPattern, const char* pObject, const FcChar8* pString )
{ return m_pFcPatternAddString( pPattern, pObject, pString ); }
FcBool FcPatternAddBool( FcPattern* pPattern, const char* pObject, bool nValue )
@@ -234,7 +237,9 @@ public:
{ return m_pFcFreeTypeCharIndex ? m_pFcFreeTypeCharIndex( face, ucs4 ) : 0; }
public: // TODO: cleanup
- std::hash_map< rtl::OString, rtl::OString, rtl::OStringHash > m_aFontconfigNameToLocalized;
+ FcResult FamilyFromPattern(FcPattern* pPattern, FcChar8 **family);
+ std::hash_map< rtl::OString, rtl::OString, rtl::OStringHash > m_aFontNameToLocalized;
+ std::hash_map< rtl::OString, rtl::OString, rtl::OStringHash > m_aLocalizedToCanonical;
};
oslGenericFunction FontCfgWrapper::loadSymbol( const char* pSymbol )
@@ -324,6 +329,8 @@ FontCfgWrapper::FontCfgWrapper()
loadSymbol( "FcConfigSubstitute" );
m_pFcPatternAddInteger = (FcBool(*)(FcPattern*,const char*,int))
loadSymbol( "FcPatternAddInteger" );
+ m_pFcPatternAddDouble = (FcBool(*)(FcPattern*,const char*,double))
+ loadSymbol( "FcPatternAddDouble" );
m_pFcPatternAddBool = (FcBool(*)(FcPattern*,const char*,FcBool))
loadSymbol( "FcPatternAddBool" );
m_pFcPatternAddCharSet = (FcBool(*)(FcPattern*,const char*,const FcCharSet *))
@@ -374,6 +381,7 @@ FontCfgWrapper::FontCfgWrapper()
m_pFcDefaultSubstitute &&
m_pFcConfigSubstitute &&
m_pFcPatternAddInteger &&
+ m_pFcPatternAddDouble &&
m_pFcPatternAddCharSet &&
m_pFcPatternAddBool &&
m_pFcPatternAddString
@@ -506,53 +514,52 @@ namespace
return candidate;
}
+}
+FcResult FontCfgWrapper::FamilyFromPattern(FcPattern* pPattern, FcChar8 **family)
+{
+ FcChar8 *origfamily;
+ FcResult eFamilyRes = FcPatternGetString( pPattern, FC_FAMILY, 0, &origfamily );
+ *family = origfamily;
- FcResult lcl_FamilyFromPattern(FontCfgWrapper& rWrapper, FcPattern* pPattern, FcChar8 **family,
- std::hash_map< rtl::OString, rtl::OString, rtl::OStringHash > &aFontconfigNameToLocalized)
+ if( eFamilyRes == FcResultMatch)
{
- FcChar8 *origfamily;
- FcResult eFamilyRes = rWrapper.FcPatternGetString( pPattern, FC_FAMILY, 0, &origfamily );
- *family = origfamily;
-
- if( eFamilyRes == FcResultMatch)
+ FcChar8* familylang = NULL;
+ if (FcPatternGetString( pPattern, FC_FAMILYLANG, 0, &familylang ) == FcResultMatch)
{
- FcChar8* familylang = NULL;
- if (rWrapper.FcPatternGetString( pPattern, FC_FAMILYLANG, 0, &familylang ) == FcResultMatch)
+ std::vector< lang_and_family > lang_and_families;
+ lang_and_families.push_back(lang_and_family(familylang, *family));
+ int k = 1;
+ while (1)
{
- std::vector< lang_and_family > lang_and_families;
+ if (FcPatternGetString( pPattern, FC_FAMILYLANG, k, &familylang ) != FcResultMatch)
+ break;
+ if (FcPatternGetString( pPattern, FC_FAMILY, k, family ) != FcResultMatch)
+ break;
lang_and_families.push_back(lang_and_family(familylang, *family));
- int k = 1;
- while (1)
- {
- if (rWrapper.FcPatternGetString( pPattern, FC_FAMILYLANG, k, &familylang ) != FcResultMatch)
- break;
- if (rWrapper.FcPatternGetString( pPattern, FC_FAMILY, k, family ) != FcResultMatch)
- break;
- lang_and_families.push_back(lang_and_family(familylang, *family));
- ++k;
- }
+ ++k;
+ }
- //possible to-do, sort by UILocale instead of process locale
- rtl_Locale* pLoc;
- osl_getProcessLocale(&pLoc);
- localizedsorter aSorter(pLoc);
- *family = aSorter.bestname(lang_and_families);
+ //possible to-do, sort by UILocale instead of process locale
+ rtl_Locale* pLoc;
+ osl_getProcessLocale(&pLoc);
+ localizedsorter aSorter(pLoc);
+ *family = aSorter.bestname(lang_and_families);
- std::vector<lang_and_family>::const_iterator aEnd = lang_and_families.end();
- for (std::vector<lang_and_family>::const_iterator aIter = lang_and_families.begin(); aIter != aEnd; ++aIter)
- {
- const char *candidate = (const char*)(aIter->second);
- if (rtl_str_compare(candidate, (const char*)(*family)) != 0)
- aFontconfigNameToLocalized[OString(candidate)] = OString((const char*)(*family));
- }
+ std::vector<lang_and_family>::const_iterator aEnd = lang_and_families.end();
+ for (std::vector<lang_and_family>::const_iterator aIter = lang_and_families.begin(); aIter != aEnd; ++aIter)
+ {
+ const char *candidate = (const char*)(aIter->second);
+ if (rtl_str_compare(candidate, (const char*)(*family)) != 0)
+ m_aFontNameToLocalized[OString(candidate)] = OString((const char*)(*family));
}
+ if (rtl_str_compare((const char*)origfamily, (const char*)(*family)) != 0)
+ m_aLocalizedToCanonical[OString((const char*)(*family))] = OString((const char*)origfamily);
}
-
- return eFamilyRes;
}
-}
+ return eFamilyRes;
+}
/*
* PrintFontManager::initFontconfig
@@ -588,18 +595,16 @@ int PrintFontManager::countFontconfigFonts()
int weight = 0;
int spacing = 0;
int nCollectionEntry = -1;
- FcBool outline = false, embitmap = true, antialias = true;
+ FcBool outline = false;
FcResult eFileRes = rWrapper.FcPatternGetString( pFSet->fonts[i], FC_FILE, 0, &file );
- FcResult eFamilyRes = lcl_FamilyFromPattern(rWrapper, pFSet->fonts[i], &family, rWrapper.m_aFontconfigNameToLocalized );
+ FcResult eFamilyRes = rWrapper.FamilyFromPattern( pFSet->fonts[i], &family );
FcResult eStyleRes = rWrapper.FcPatternGetString( pFSet->fonts[i], FC_STYLE, 0, &style );
FcResult eSlantRes = rWrapper.FcPatternGetInteger( pFSet->fonts[i], FC_SLANT, 0, &slant );
FcResult eWeightRes = rWrapper.FcPatternGetInteger( pFSet->fonts[i], FC_WEIGHT, 0, &weight );
FcResult eSpacRes = rWrapper.FcPatternGetInteger( pFSet->fonts[i], FC_SPACING, 0, &spacing );
FcResult eOutRes = rWrapper.FcPatternGetBool( pFSet->fonts[i], FC_OUTLINE, 0, &outline );
FcResult eIndexRes = rWrapper.FcPatternGetInteger( pFSet->fonts[i], FC_INDEX, 0, &nCollectionEntry );
- FcResult eEmbeddedBitmap = rWrapper.FcPatternGetBool( pFSet->fonts[i], FC_EMBEDDED_BITMAP, 0, &embitmap );
- FcResult eAntialias = rWrapper.FcPatternGetBool( pFSet->fonts[i], FC_ANTIALIAS, 0, &antialias );
if( eFileRes != FcResultMatch || eFamilyRes != FcResultMatch || eOutRes != FcResultMatch )
continue;
@@ -739,15 +744,6 @@ int PrintFontManager::countFontconfigFonts()
{
pUpdate->m_aStyleName = OStringToOUString( OString( (sal_Char*)style ), RTL_TEXTENCODING_UTF8 );
}
- if( eEmbeddedBitmap == FcResultMatch )
- {
- pUpdate->m_eEmbeddedbitmap = embitmap ? fcstatus::istrue : fcstatus::isfalse;
- }
- if( eAntialias == FcResultMatch )
- {
- pUpdate->m_eAntialias = antialias ? fcstatus::istrue : fcstatus::isfalse;
- }
-
// update font cache
m_pFontCache->updateFontCacheEntry( pUpdate, false );
@@ -952,8 +948,8 @@ rtl::OUString PrintFontManager::Substitute(const rtl::OUString& rFontName,
if( eFileRes == FcResultMatch )
{
OString sFamily((sal_Char*)family);
- std::hash_map< rtl::OString, rtl::OString, rtl::OStringHash >::const_iterator aI = rWrapper.m_aFontconfigNameToLocalized.find(sFamily);
- if (aI != rWrapper.m_aFontconfigNameToLocalized.end())
+ std::hash_map< rtl::OString, rtl::OString, rtl::OStringHash >::const_iterator aI = rWrapper.m_aFontNameToLocalized.find(sFamily);
+ if (aI != rWrapper.m_aFontNameToLocalized.end())
sFamily = aI->second;
aName = rtl::OStringToOUString( sFamily, RTL_TEXTENCODING_UTF8 );
}
@@ -984,6 +980,98 @@ rtl::OUString PrintFontManager::Substitute(const rtl::OUString& rFontName,
return aName;
}
+FontConfigHints PrintFontManager::getFontConfigHints(
+ const FastPrintFontInfo& rInfo, int nSize, void (*subcallback)(void *) )
+{
+ FontConfigHints aHints;
+#ifdef ENABLE_FONTCONFIG
+ FontCfgWrapper& rWrapper = FontCfgWrapper::get();
+ if( ! rWrapper.isValid() )
+ return aHints;
+
+ FcConfig* pConfig = rWrapper.FcConfigGetCurrent();
+ FcPattern* pPattern = rWrapper.FcPatternCreate();
+
+ OString sFamily = OUStringToOString( rInfo.m_aFamilyName, RTL_TEXTENCODING_UTF8 );
+
+ std::hash_map< rtl::OString, rtl::OString, rtl::OStringHash >::const_iterator aI = rWrapper.m_aLocalizedToCanonical.find(sFamily);
+ if (aI != rWrapper.m_aLocalizedToCanonical.end())
+ sFamily = aI->second;
+ if( sFamily.getLength() )
+ rWrapper.FcPatternAddString( pPattern, FC_FAMILY, (FcChar8*)sFamily.getStr() );
+
+ addtopattern(rWrapper, pPattern, rInfo.m_eItalic, rInfo.m_eWeight, rInfo.m_eWidth, rInfo.m_ePitch);
+ rWrapper.FcPatternAddDouble( pPattern, FC_PIXEL_SIZE, nSize);
+
+ FcBool embitmap = true, antialias = true, autohint = true, hinting = true;
+ int hintstyle = FC_HINT_FULL;
+
+ rWrapper.FcConfigSubstitute( pConfig, pPattern, FcMatchPattern );
+ if (subcallback) subcallback(pPattern);
+ rWrapper.FcDefaultSubstitute( pPattern );
+
+ FcResult eResult = FcResultNoMatch;
+ FcFontSet *pFontSet = rWrapper.getFontSet();
+ FcPattern* pResult = rWrapper.FcFontSetMatch( pConfig, &pFontSet, 1, pPattern, &eResult );
+ if( pResult )
+ {
+ FcFontSet* pSet = rWrapper.FcFontSetCreate();
+ rWrapper.FcFontSetAdd( pSet, pResult );
+ if( pSet->nfont > 0 )
+ {
+ FcResult eEmbeddedBitmap = rWrapper.FcPatternGetBool(pSet->fonts[0],
+ FC_EMBEDDED_BITMAP, 0, &embitmap);
+ FcResult eAntialias = rWrapper.FcPatternGetBool(pSet->fonts[0],
+ FC_ANTIALIAS, 0, &antialias);
+ FcResult eAutoHint = rWrapper.FcPatternGetBool(pSet->fonts[0],
+ FC_AUTOHINT, 0, &autohint);
+ FcResult eHinting = rWrapper.FcPatternGetBool(pSet->fonts[0],
+ FC_HINTING, 0, &hinting);
+ FcResult eHintStyle = rWrapper.FcPatternGetInteger(pSet->fonts[0],
+ FC_HINT_STYLE, 0, &hintstyle);
+
+ if( eEmbeddedBitmap == FcResultMatch )
+ aHints.m_eEmbeddedbitmap = embitmap ? fcstatus::istrue : fcstatus::isfalse;
+ if( eAntialias == FcResultMatch )
+ aHints.m_eAntialias = antialias ? fcstatus::istrue : fcstatus::isfalse;
+ if( eAutoHint == FcResultMatch )
+ aHints.m_eAutoHint = autohint ? fcstatus::istrue : fcstatus::isfalse;
+ if( eHinting == FcResultMatch )
+ aHints.m_eHinting = hinting ? fcstatus::istrue : fcstatus::isfalse;
+ if (eHintStyle != FcResultMatch)
+ aHints.m_eHintStyle = fchint::Full;
+ else
+ {
+ switch (hintstyle)
+ {
+ case FC_HINT_NONE:
+ aHints.m_eHintStyle = fchint::Nohint;
+ break;
+ case FC_HINT_SLIGHT:
+ aHints.m_eHintStyle = fchint::Slight;
+ break;
+ case FC_HINT_MEDIUM:
+ aHints.m_eHintStyle = fchint::Medium;
+ break;
+ case FC_HINT_FULL:
+ default:
+ aHints.m_eHintStyle = fchint::Full;
+ break;
+ }
+ }
+ }
+ // info: destroying the pSet destroys pResult implicitly
+ // since pResult was "added" to pSet
+ rWrapper.FcFontSetDestroy( pSet );
+ }
+
+ // cleanup
+ rWrapper.FcPatternDestroy( pPattern );
+
+#endif
+ return aHints;
+}
+
bool PrintFontManager::matchFont( FastPrintFontInfo& rInfo, const com::sun::star::lang::Locale& rLocale )
{
FontCfgWrapper& rWrapper = FontCfgWrapper::get();
diff --git a/vcl/unx/source/fontmanager/fontmanager.cxx b/vcl/unx/source/fontmanager/fontmanager.cxx
index 99f19ba2fc31..16737974a44a 100644
--- a/vcl/unx/source/fontmanager/fontmanager.cxx
+++ b/vcl/unx/source/fontmanager/fontmanager.cxx
@@ -353,9 +353,7 @@ PrintFontManager::PrintFont::PrintFont( fonttype::type eType ) :
m_nXMax( 0 ),
m_nYMax( 0 ),
m_bHaveVerticalSubstitutedGlyphs( false ),
- m_bUserOverride( false ),
- m_eEmbeddedbitmap( fcstatus::isunset ),
- m_eAntialias( fcstatus::isunset )
+ m_bUserOverride( false )
{
}
@@ -2630,8 +2628,6 @@ void PrintFontManager::fillPrintFontInfo( PrintFont* pFont, FastPrintFontInfo& r
rInfo.m_eWeight = pFont->m_eWeight;
rInfo.m_ePitch = pFont->m_ePitch;
rInfo.m_aEncoding = pFont->m_aEncoding;
- rInfo.m_eEmbeddedbitmap = pFont->m_eEmbeddedbitmap;
- rInfo.m_eAntialias = pFont->m_eAntialias;
rInfo.m_bEmbeddable = (pFont->m_eType == fonttype::Type1);
rInfo.m_bSubsettable = (pFont->m_eType == fonttype::TrueType); // TODO: rename to SfntType
@@ -3936,8 +3932,6 @@ bool PrintFontManager::readOverrideMetrics()
BuiltinFont* pFont = new BuiltinFont();
pFont->m_nDirectory = 0;
pFont->m_bUserOverride = false;
- pFont->m_eEmbeddedbitmap = fcstatus::isunset;
- pFont->m_eAntialias = fcstatus::isunset;
pFont->m_pMetrics = new PrintFontMetrics;
memset( pFont->m_pMetrics->m_aPages, 0xff, sizeof( pFont->m_pMetrics->m_aPages ) );
pFont->m_pMetrics->m_bKernPairsQueried = true;
diff --git a/vcl/unx/source/gdi/pspgraphics.cxx b/vcl/unx/source/gdi/pspgraphics.cxx
index 227d6cd7e9b2..4e525a3532d4 100644
--- a/vcl/unx/source/gdi/pspgraphics.cxx
+++ b/vcl/unx/source/gdi/pspgraphics.cxx
@@ -885,6 +885,10 @@ void PspGraphics::GetDevFontSubstList( OutputDevice* pOutDev )
}
}
+void PspGraphics::GetFontHints( const ImplFontAttributes& rFontAttributes, int nSize, ImplFontHints& rFontHints) const
+{
+}
+
void PspGraphics::GetFontMetric( ImplFontMetricData *pMetric )
{
const psp::PrintFontManager& rMgr = psp::PrintFontManager::get();
@@ -1284,32 +1288,6 @@ ImplDevFontAttributes PspGraphics::Info2DevFontAttributes( const psp::FastPrintF
aDFA.mbSubsettable = rInfo.m_bSubsettable;
aDFA.mbEmbeddable = rInfo.m_bEmbeddable;
- switch (rInfo.m_eEmbeddedbitmap)
- {
- default:
- aDFA.meEmbeddedBitmap = EMBEDDEDBITMAP_DONTKNOW;
- break;
- case psp::fcstatus::istrue:
- aDFA.meEmbeddedBitmap = EMBEDDEDBITMAP_TRUE;
- break;
- case psp::fcstatus::isfalse:
- aDFA.meEmbeddedBitmap = EMBEDDEDBITMAP_FALSE;
- break;
- }
-
- switch (rInfo.m_eAntialias)
- {
- default:
- aDFA.meAntiAlias = ANTIALIAS_DONTKNOW;
- break;
- case psp::fcstatus::istrue:
- aDFA.meAntiAlias = ANTIALIAS_TRUE;
- break;
- case psp::fcstatus::isfalse:
- aDFA.meAntiAlias = ANTIALIAS_FALSE;
- break;
- }
-
switch( rInfo.m_eType )
{
case psp::fonttype::Builtin:
diff --git a/vcl/unx/source/gdi/salgdi3.cxx b/vcl/unx/source/gdi/salgdi3.cxx
index 5d6cd464376a..50913fd99f71 100644
--- a/vcl/unx/source/gdi/salgdi3.cxx
+++ b/vcl/unx/source/gdi/salgdi3.cxx
@@ -743,6 +743,8 @@ private:
void (*mp_set_font_matrix)(cairo_t *, const cairo_matrix_t *);
void (*mp_show_glyphs)(cairo_t *, const cairo_glyph_t *, int );
void (*mp_set_source_rgb)(cairo_t *, double , double , double );
+ void (*mp_set_font_options)(cairo_t *, const void *);
+ void (*mp_ft_font_options_substitute)(const void*, void*);
bool canEmbolden() const { return false; }
@@ -778,6 +780,10 @@ public:
{ (*mp_show_glyphs)(cr, glyphs, no_glyphs); }
void set_source_rgb(cairo_t *cr, double red, double green, double blue)
{ (*mp_set_source_rgb)(cr, red, green, blue); }
+ void set_font_options(cairo_t *cr, const void *options)
+ { (*mp_set_font_options)(cr, options); }
+ void ft_font_options_substitute(const void *options, void *pattern)
+ { (*mp_ft_font_options_substitute)(options, pattern); }
};
static CairoWrapper* pCairoInstance = NULL;
@@ -847,6 +853,10 @@ CairoWrapper::CairoWrapper()
osl_getAsciiFunctionSymbol( mpCairoLib, "cairo_show_glyphs" );
mp_set_source_rgb = (void (*)(cairo_t *, double , double , double ))
osl_getAsciiFunctionSymbol( mpCairoLib, "cairo_set_source_rgb" );
+ mp_set_font_options = (void (*)(cairo_t *, const void *options ))
+ osl_getAsciiFunctionSymbol( mpCairoLib, "cairo_set_font_options" );
+ mp_ft_font_options_substitute = (void (*)(const void *, void *))
+ osl_getAsciiFunctionSymbol( mpCairoLib, "cairo_ft_font_options_substitute" );
if( !(
mp_xlib_surface_create_with_xrender_format &&
@@ -863,7 +873,9 @@ CairoWrapper::CairoWrapper()
mp_matrix_rotate &&
mp_set_font_matrix &&
mp_show_glyphs &&
- mp_set_source_rgb
+ mp_set_source_rgb &&
+ mp_set_font_options &&
+ mp_ft_font_options_substitute
) )
{
osl_unloadModule( mpCairoLib );
@@ -1601,6 +1613,187 @@ void X11SalGraphics::GetDevFontSubstList( OutputDevice* )
// ----------------------------------------------------------------------------
+void cairosubcallback(void *pPattern)
+{
+ CairoWrapper &rCairo = CairoWrapper::get();
+ if (rCairo.isValid())
+ {
+ rCairo.ft_font_options_substitute(
+ Application::GetSettings().GetStyleSettings().GetCairoFontOptions(),
+ pPattern);
+ }
+}
+
+void X11SalGraphics::GetFontHints( const ImplFontAttributes& rFontAttributes, int nSize, ImplFontHints& rFontHints) const
+{
+ psp::FastPrintFontInfo aInfo;
+ // set family name
+ aInfo.m_aFamilyName = rFontAttributes.GetFamilyName();
+ // set italic
+ switch( rFontAttributes.GetSlant() )
+ {
+ case ITALIC_NONE:
+ aInfo.m_eItalic = psp::italic::Upright;
+ break;
+ case ITALIC_NORMAL:
+ aInfo.m_eItalic = psp::italic::Italic;
+ break;
+ case ITALIC_OBLIQUE:
+ aInfo.m_eItalic = psp::italic::Oblique;
+ break;
+ default:
+ aInfo.m_eItalic = psp::italic::Unknown;
+ break;
+
+ }
+ // set weight
+ switch( rFontAttributes.GetWeight() )
+ {
+ case WEIGHT_THIN:
+ aInfo.m_eWeight = psp::weight::Thin;
+ break;
+ case WEIGHT_ULTRALIGHT:
+ aInfo.m_eWeight = psp::weight::UltraLight;
+ break;
+ case WEIGHT_LIGHT:
+ aInfo.m_eWeight = psp::weight::Light;
+ break;
+ case WEIGHT_SEMILIGHT:
+ aInfo.m_eWeight = psp::weight::SemiLight;
+ break;
+ case WEIGHT_NORMAL:
+ aInfo.m_eWeight = psp::weight::Normal;
+ break;
+ case WEIGHT_MEDIUM:
+ aInfo.m_eWeight = psp::weight::Medium;
+ break;
+ case WEIGHT_SEMIBOLD:
+ aInfo.m_eWeight = psp::weight::SemiBold;
+ break;
+ case WEIGHT_BOLD:
+ aInfo.m_eWeight = psp::weight::Bold;
+ break;
+ case WEIGHT_ULTRABOLD:
+ aInfo.m_eWeight = psp::weight::UltraBold;
+ break;
+ case WEIGHT_BLACK:
+ aInfo.m_eWeight = psp::weight::Black;
+ break;
+ default:
+ aInfo.m_eWeight = psp::weight::Unknown;
+ break;
+ }
+ // set width
+ switch( rFontAttributes.GetWidthType() )
+ {
+ case WIDTH_ULTRA_CONDENSED:
+ aInfo.m_eWidth = psp::width::UltraCondensed;
+ break;
+ case WIDTH_EXTRA_CONDENSED:
+ aInfo.m_eWidth = psp::width::ExtraCondensed;
+ break;
+ case WIDTH_CONDENSED:
+ aInfo.m_eWidth = psp::width::Condensed;
+ break;
+ case WIDTH_SEMI_CONDENSED:
+ aInfo.m_eWidth = psp::width::SemiCondensed;
+ break;
+ case WIDTH_NORMAL:
+ aInfo.m_eWidth = psp::width::Normal;
+ break;
+ case WIDTH_SEMI_EXPANDED:
+ aInfo.m_eWidth = psp::width::SemiExpanded;
+ break;
+ case WIDTH_EXPANDED:
+ aInfo.m_eWidth = psp::width::Expanded;
+ break;
+ case WIDTH_EXTRA_EXPANDED:
+ aInfo.m_eWidth = psp::width::ExtraExpanded;
+ break;
+ case WIDTH_ULTRA_EXPANDED:
+ aInfo.m_eWidth = psp::width::UltraExpanded;
+ break;
+ default:
+ aInfo.m_eWidth = psp::width::Unknown;
+ break;
+ }
+
+ psp::FontConfigHints aHints(psp::PrintFontManager::get().getFontConfigHints(aInfo, nSize,
+ cairosubcallback));
+
+ switch (aHints.m_eEmbeddedbitmap)
+ {
+ default:
+ rFontHints.meEmbeddedBitmap = EMBEDDEDBITMAP_DONTKNOW;
+ break;
+ case psp::fcstatus::istrue:
+ rFontHints.meEmbeddedBitmap = EMBEDDEDBITMAP_TRUE;
+ break;
+ case psp::fcstatus::isfalse:
+ rFontHints.meEmbeddedBitmap = EMBEDDEDBITMAP_FALSE;
+ break;
+ }
+
+ switch (aHints.m_eAntialias)
+ {
+ default:
+ rFontHints.meAntiAlias = ANTIALIAS_DONTKNOW;
+ break;
+ case psp::fcstatus::istrue:
+ rFontHints.meAntiAlias = ANTIALIAS_TRUE;
+ break;
+ case psp::fcstatus::isfalse:
+ rFontHints.meAntiAlias = ANTIALIAS_FALSE;
+ break;
+ }
+
+ switch (aHints.m_eAutoHint)
+ {
+ default:
+ rFontHints.meAutoHint = AUTOHINT_DONTKNOW;
+ break;
+ case psp::fcstatus::istrue:
+ rFontHints.meAutoHint = AUTOHINT_TRUE;
+ break;
+ case psp::fcstatus::isfalse:
+ rFontHints.meAutoHint = AUTOHINT_FALSE;
+ break;
+ }
+
+ switch (aHints.m_eHinting)
+ {
+ default:
+ rFontHints.meHinting = HINTING_DONTKNOW;
+ break;
+ case psp::fcstatus::istrue:
+ rFontHints.meHinting = HINTING_TRUE;
+ break;
+ case psp::fcstatus::isfalse:
+ rFontHints.meHinting = HINTING_FALSE;
+ break;
+ }
+
+ switch (aHints.m_eHintStyle)
+ {
+ case psp::fchint::Nohint:
+ rFontHints.meHintStyle = HINT_NONE;
+ break;
+ case psp::fchint::Slight:
+ rFontHints.meHintStyle = HINT_SLIGHT;
+ break;
+ case psp::fchint::Medium:
+ rFontHints.meHintStyle = HINT_MEDIUM;
+ break;
+ default:
+ case psp::fchint::Full:
+ rFontHints.meHintStyle = HINT_FULL;
+ break;
+ }
+
+}
+
+// ----------------------------------------------------------------------------
+
void
X11SalGraphics::GetFontMetric( ImplFontMetricData *pMetric )
{
diff --git a/vcl/unx/source/gdi/xlfd_extd.cxx b/vcl/unx/source/gdi/xlfd_extd.cxx
index 486e69f1effe..f770a25dd6f2 100644
--- a/vcl/unx/source/gdi/xlfd_extd.cxx
+++ b/vcl/unx/source/gdi/xlfd_extd.cxx
@@ -105,9 +105,6 @@ ExtendedXlfd::ExtendedXlfd( bool bScalable )
mbSubsettable = false;
mbEmbeddable = false;
- meEmbeddedBitmap = EMBEDDEDBITMAP_DONTKNOW;
- meAntiAlias = ANTIALIAS_DONTKNOW;
-
mnQuality = -1;
}