summaryrefslogtreecommitdiff
path: root/vcl/unx
diff options
context:
space:
mode:
Diffstat (limited to 'vcl/unx')
-rw-r--r--vcl/unx/source/fontmanager/fontconfig.cxx41
-rw-r--r--vcl/unx/source/gdi/salgdi3.cxx20
2 files changed, 50 insertions, 11 deletions
diff --git a/vcl/unx/source/fontmanager/fontconfig.cxx b/vcl/unx/source/fontmanager/fontconfig.cxx
index 031fac4e6641..602a82430cdb 100644
--- a/vcl/unx/source/fontmanager/fontconfig.cxx
+++ b/vcl/unx/source/fontmanager/fontconfig.cxx
@@ -56,6 +56,9 @@ using namespace psp;
#define FC_HINT_MEDIUM 2
#define FC_HINT_FULL 3
#endif
+ #ifndef FC_FT_FACE
+ #define FC_FT_FACE "ftface"
+ #endif
#else
typedef void FcConfig;
typedef void FcObjectSet;
@@ -141,6 +144,7 @@ class FontCfgWrapper
FcBool (*m_pFcPatternAddCharSet)(FcPattern*,const char*,const FcCharSet*);
FcBool (*m_pFcPatternAddString)(FcPattern*,const char*,const FcChar8*);
FT_UInt (*m_pFcFreeTypeCharIndex)(FT_Face,FcChar32);
+ FcBool (*m_pFcPatternAddFTFace)(FcPattern*,const char*,const FT_Face);
oslGenericFunction loadSymbol( const char* );
void addFontSet( FcSetName );
@@ -257,10 +261,14 @@ public:
{ return m_pFcPatternAddBool( pPattern, pObject, nValue ); }
FcBool FcPatternAddCharSet(FcPattern* pPattern,const char* pObject,const FcCharSet*pCharSet)
{ return m_pFcPatternAddCharSet(pPattern,pObject,pCharSet); }
-
FT_UInt FcFreeTypeCharIndex( FT_Face face, FcChar32 ucs4 )
{ return m_pFcFreeTypeCharIndex ? m_pFcFreeTypeCharIndex( face, ucs4 ) : 0; }
-
+ FcBool FcPatternAddFTFace( FcPattern* pPattern, const char* pObject, const FT_Face nValue )
+ {
+ return m_pFcPatternAddFTFace
+ ? m_pFcPatternAddFTFace( pPattern, pObject, nValue )
+ : false;
+ }
public:
FcResult LocalizedElementFromPattern(FcPattern* pPattern, FcChar8 **family,
const char *elementtype, const char *elementlangtype);
@@ -372,6 +380,8 @@ FontCfgWrapper::FontCfgWrapper()
loadSymbol( "FcPatternAddString" );
m_pFcFreeTypeCharIndex = (FT_UInt(*)(FT_Face,FcChar32))
loadSymbol( "FcFreeTypeCharIndex" );
+ m_pFcPatternAddFTFace = (FcBool(*)(FcPattern*,const char*,const FT_Face))
+ loadSymbol( "FcPatternAddFTFace" );
m_nFcVersion = FcGetVersion();
#if (OSL_DEBUG_LEVEL > 1)
@@ -1093,6 +1103,26 @@ rtl::OUString PrintFontManager::Substitute(const rtl::OUString& rFontName,
return aName;
}
+class FontConfigFontOptions : public ImplFontOptions
+{
+public:
+ FontConfigFontOptions() : mpPattern(0) {}
+ ~FontConfigFontOptions()
+ {
+ FontCfgWrapper& rWrapper = FontCfgWrapper::get();
+ if( rWrapper.isValid() )
+ rWrapper.FcPatternDestroy( mpPattern );
+ }
+ virtual void *GetPattern(void * face) const
+ {
+ FontCfgWrapper& rWrapper = FontCfgWrapper::get();
+ if( rWrapper.isValid() )
+ rWrapper.FcPatternAddFTFace(mpPattern, FC_FT_FACE, static_cast<FT_Face>(face));
+ return mpPattern;
+ }
+ FcPattern* mpPattern;
+};
+
ImplFontOptions* PrintFontManager::getFontOptions(
const FastPrintFontInfo& rInfo, int nSize, void (*subcallback)(void*)) const
{
@@ -1103,7 +1133,7 @@ ImplFontOptions* PrintFontManager::getFontOptions(
if( ! rWrapper.isValid() )
return NULL;
- ImplFontOptions *pOptions = NULL;
+ FontConfigFontOptions* pOptions = NULL;
FcConfig* pConfig = rWrapper.FcConfigGetCurrent();
FcPattern* pPattern = rWrapper.FcPatternCreate();
@@ -1140,9 +1170,10 @@ ImplFontOptions* PrintFontManager::getFontOptions(
FC_HINTING, 0, &hinting);
/*FcResult eHintStyle =*/ rWrapper.FcPatternGetInteger(pResult,
FC_HINT_STYLE, 0, &hintstyle);
- rWrapper.FcPatternDestroy(pResult);
- pOptions = new ImplFontOptions;
+ pOptions = new FontConfigFontOptions;
+
+ pOptions->mpPattern = pResult;
if( eEmbeddedBitmap == FcResultMatch )
pOptions->meEmbeddedBitmap = embitmap ? EMBEDDEDBITMAP_TRUE : EMBEDDEDBITMAP_FALSE;
diff --git a/vcl/unx/source/gdi/salgdi3.cxx b/vcl/unx/source/gdi/salgdi3.cxx
index a7e8eec1050b..5dacaf8022d7 100644
--- a/vcl/unx/source/gdi/salgdi3.cxx
+++ b/vcl/unx/source/gdi/salgdi3.cxx
@@ -89,7 +89,6 @@ struct cairo_surface_t;
struct cairo_t;
struct cairo_font_face_t;
typedef void* FT_Face;
-typedef void* FcPattern;
struct cairo_matrix_t {
double xx; double yx;
double xy; double yy;
@@ -742,7 +741,7 @@ private:
void (*mp_clip)(cairo_t*);
void (*mp_rectangle)(cairo_t*, double, double, double, double);
cairo_font_face_t * (*mp_ft_font_face_create_for_ft_face)(FT_Face, int);
- cairo_font_face_t * (*mp_ft_font_face_create_for_pattern)(FcPattern*);
+ cairo_font_face_t * (*mp_ft_font_face_create_for_pattern)(void*);
void (*mp_set_font_face)(cairo_t *, cairo_font_face_t *);
void (*mp_font_face_destroy)(cairo_font_face_t *);
void (*mp_matrix_init_identity)(cairo_matrix_t *);
@@ -772,8 +771,12 @@ public:
{ (*mp_rectangle)(cr, x, y, width, height); }
cairo_font_face_t* ft_font_face_create_for_ft_face(FT_Face face, int load_flags)
{ return (*mp_ft_font_face_create_for_ft_face)(face, load_flags); }
- cairo_font_face_t* ft_font_face_create_for_pattern(FcPattern *pattern)
- { return (*mp_ft_font_face_create_for_pattern)(pattern); }
+ cairo_font_face_t* ft_font_face_create_for_pattern(void *pattern)
+ {
+ return mp_ft_font_face_create_for_pattern
+ ? (*mp_ft_font_face_create_for_pattern)(pattern)
+ : NULL;
+ }
void set_font_face(cairo_t *cr, cairo_font_face_t *font_face)
{ (*mp_set_font_face)(cr, font_face); }
void font_face_destroy(cairo_font_face_t *font_face)
@@ -847,7 +850,7 @@ CairoWrapper::CairoWrapper()
osl_getAsciiFunctionSymbol( mpCairoLib, "cairo_rectangle" );
mp_ft_font_face_create_for_ft_face = (cairo_font_face_t * (*)(FT_Face, int))
osl_getAsciiFunctionSymbol( mpCairoLib, "cairo_ft_font_face_create_for_ft_face" );
- mp_ft_font_face_create_for_pattern = (cairo_font_face_t * (*)(FcPattern*))
+ mp_ft_font_face_create_for_pattern = (cairo_font_face_t * (*)(void*))
osl_getAsciiFunctionSymbol( mpCairoLib, "cairo_ft_font_face_create_for_pattern" );
mp_set_font_face = (void (*)(cairo_t *, cairo_font_face_t *))
osl_getAsciiFunctionSymbol( mpCairoLib, "cairo_set_font_face" );
@@ -1016,7 +1019,12 @@ void X11SalGraphics::DrawCairoAAFontString( const ServerFontLayout& rLayout )
font_face = (cairo_font_face_t*)m_aCairoFontsCache.FindCachedFont(pId);
if (!font_face)
{
- font_face = rCairo.ft_font_face_create_for_ft_face(pId, rFont.GetLoadFlags());
+ const ImplFontOptions *pOptions = rFont.GetFontOptions();
+ void *pPattern = pOptions ? pOptions->GetPattern(pId) : NULL;
+ if (pPattern)
+ font_face = rCairo.ft_font_face_create_for_pattern(pPattern);
+ if (!font_face)
+ font_face = rCairo.ft_font_face_create_for_ft_face(pId, rFont.GetLoadFlags());
m_aCairoFontsCache.CacheFont(font_face, pId);
}