From cc8f350a5829405832af1177fd32de7c41c30724 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= Date: Wed, 16 Mar 2011 14:18:42 +0000 Subject: [PATCH] Related: rhbz#680460 don't bother with an interim FontSet I can't see why bother adding it to a FontSet and then throw away the fontset, why not just use the pattern directly and throw it away afterwards directly. --- vcl/unx/source/fontmanager/fontconfig.cxx | 63 +++++++++++++---------------- 1 files changed, 28 insertions(+), 35 deletions(-) diff --git a/vcl/unx/source/fontmanager/fontconfig.cxx b/vcl/unx/source/fontmanager/fontconfig.cxx index 3c2f636..92632c7 100644 --- a/vcl/unx/source/fontmanager/fontconfig.cxx +++ b/vcl/unx/source/fontmanager/fontconfig.cxx @@ -1130,43 +1130,36 @@ ImplFontOptions* PrintFontManager::getFontOptions( 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(pResult, + FC_EMBEDDED_BITMAP, 0, &embitmap); + FcResult eAntialias = rWrapper.FcPatternGetBool(pResult, + FC_ANTIALIAS, 0, &antialias); + FcResult eAutoHint = rWrapper.FcPatternGetBool(pResult, + FC_AUTOHINT, 0, &autohint); + FcResult eHinting = rWrapper.FcPatternGetBool(pResult, + FC_HINTING, 0, &hinting); + /*FcResult eHintStyle =*/ rWrapper.FcPatternGetInteger(pResult, + FC_HINT_STYLE, 0, &hintstyle); + rWrapper.FcPatternDestroy(pResult); + + pOptions = new ImplFontOptions; + + if( eEmbeddedBitmap == FcResultMatch ) + pOptions->meEmbeddedBitmap = embitmap ? EMBEDDEDBITMAP_TRUE : EMBEDDEDBITMAP_FALSE; + if( eAntialias == FcResultMatch ) + pOptions->meAntiAlias = antialias ? ANTIALIAS_TRUE : ANTIALIAS_FALSE; + if( eAutoHint == FcResultMatch ) + pOptions->meAutoHint = autohint ? AUTOHINT_TRUE : AUTOHINT_FALSE; + if( eHinting == FcResultMatch ) + pOptions->meHinting = hinting ? HINTING_TRUE : HINTING_FALSE; + switch (hintstyle) { - 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); - - pOptions = new ImplFontOptions; - - if( eEmbeddedBitmap == FcResultMatch ) - pOptions->meEmbeddedBitmap = embitmap ? EMBEDDEDBITMAP_TRUE : EMBEDDEDBITMAP_FALSE; - if( eAntialias == FcResultMatch ) - pOptions->meAntiAlias = antialias ? ANTIALIAS_TRUE : ANTIALIAS_FALSE; - if( eAutoHint == FcResultMatch ) - pOptions->meAutoHint = autohint ? AUTOHINT_TRUE : AUTOHINT_FALSE; - if( eHinting == FcResultMatch ) - pOptions->meHinting = hinting ? HINTING_TRUE : HINTING_FALSE; - switch (hintstyle) - { - case FC_HINT_NONE: pOptions->meHintStyle = HINT_NONE; break; - case FC_HINT_SLIGHT: pOptions->meHintStyle = HINT_SLIGHT; break; - case FC_HINT_MEDIUM: pOptions->meHintStyle = HINT_MEDIUM; break; - default: // fall through - case FC_HINT_FULL: pOptions->meHintStyle = HINT_FULL; break; - } + case FC_HINT_NONE: pOptions->meHintStyle = HINT_NONE; break; + case FC_HINT_SLIGHT: pOptions->meHintStyle = HINT_SLIGHT; break; + case FC_HINT_MEDIUM: pOptions->meHintStyle = HINT_MEDIUM; break; + default: // fall through + case FC_HINT_FULL: pOptions->meHintStyle = HINT_FULL; break; } - // info: destroying the pSet destroys pResult implicitly - // since pResult was "added" to pSet - rWrapper.FcFontSetDestroy( pSet ); } // cleanup -- 1.7.4.1