summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2011-03-16 14:18:42 +0000
committerCaolán McNamara <caolanm@redhat.com>2011-03-16 14:18:42 +0000
commit15857a3690f2ee4649934ac36a7493b40c9de7c1 (patch)
tree919df6cc58674bc0a32209c55cb303c9575f2836 /vcl
parent8c680335faf902b6c5dc89d539a68ed63e939c40 (diff)
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.
Diffstat (limited to 'vcl')
-rw-r--r--vcl/unx/source/fontmanager/fontconfig.cxx63
1 files changed, 28 insertions, 35 deletions
diff --git a/vcl/unx/source/fontmanager/fontconfig.cxx b/vcl/unx/source/fontmanager/fontconfig.cxx
index 0fa6a951b682..031fac4e6641 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