1 |
From cc8f350a5829405832af1177fd32de7c41c30724 Mon Sep 17 00:00:00 2001 |
2 |
From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= <caolanm@redhat.com> |
3 |
Date: Wed, 16 Mar 2011 14:18:42 +0000 |
4 |
Subject: [PATCH] Related: rhbz#680460 don't bother with an interim FontSet |
5 |
|
6 |
I can't see why bother adding it to a FontSet and then |
7 |
throw away the fontset, why not just use the pattern |
8 |
directly and throw it away afterwards directly. |
9 |
--- |
10 |
vcl/unx/source/fontmanager/fontconfig.cxx | 63 +++++++++++++---------------- |
11 |
1 files changed, 28 insertions(+), 35 deletions(-) |
12 |
|
13 |
diff --git a/vcl/unx/source/fontmanager/fontconfig.cxx b/vcl/unx/source/fontmanager/fontconfig.cxx |
14 |
index 3c2f636..92632c7 100644 |
15 |
--- a/vcl/unx/source/fontmanager/fontconfig.cxx |
16 |
+++ b/vcl/unx/source/fontmanager/fontconfig.cxx |
17 |
@@ -1130,43 +1130,36 @@ ImplFontOptions* PrintFontManager::getFontOptions( |
18 |
FcPattern* pResult = rWrapper.FcFontSetMatch( pConfig, &pFontSet, 1, pPattern, &eResult ); |
19 |
if( pResult ) |
20 |
{ |
21 |
- FcFontSet* pSet = rWrapper.FcFontSetCreate(); |
22 |
- rWrapper.FcFontSetAdd( pSet, pResult ); |
23 |
- if( pSet->nfont > 0 ) |
24 |
+ FcResult eEmbeddedBitmap = rWrapper.FcPatternGetBool(pResult, |
25 |
+ FC_EMBEDDED_BITMAP, 0, &embitmap); |
26 |
+ FcResult eAntialias = rWrapper.FcPatternGetBool(pResult, |
27 |
+ FC_ANTIALIAS, 0, &antialias); |
28 |
+ FcResult eAutoHint = rWrapper.FcPatternGetBool(pResult, |
29 |
+ FC_AUTOHINT, 0, &autohint); |
30 |
+ FcResult eHinting = rWrapper.FcPatternGetBool(pResult, |
31 |
+ FC_HINTING, 0, &hinting); |
32 |
+ /*FcResult eHintStyle =*/ rWrapper.FcPatternGetInteger(pResult, |
33 |
+ FC_HINT_STYLE, 0, &hintstyle); |
34 |
+ rWrapper.FcPatternDestroy(pResult); |
35 |
+ |
36 |
+ pOptions = new ImplFontOptions; |
37 |
+ |
38 |
+ if( eEmbeddedBitmap == FcResultMatch ) |
39 |
+ pOptions->meEmbeddedBitmap = embitmap ? EMBEDDEDBITMAP_TRUE : EMBEDDEDBITMAP_FALSE; |
40 |
+ if( eAntialias == FcResultMatch ) |
41 |
+ pOptions->meAntiAlias = antialias ? ANTIALIAS_TRUE : ANTIALIAS_FALSE; |
42 |
+ if( eAutoHint == FcResultMatch ) |
43 |
+ pOptions->meAutoHint = autohint ? AUTOHINT_TRUE : AUTOHINT_FALSE; |
44 |
+ if( eHinting == FcResultMatch ) |
45 |
+ pOptions->meHinting = hinting ? HINTING_TRUE : HINTING_FALSE; |
46 |
+ switch (hintstyle) |
47 |
{ |
48 |
- FcResult eEmbeddedBitmap = rWrapper.FcPatternGetBool(pSet->fonts[0], |
49 |
- FC_EMBEDDED_BITMAP, 0, &embitmap); |
50 |
- FcResult eAntialias = rWrapper.FcPatternGetBool(pSet->fonts[0], |
51 |
- FC_ANTIALIAS, 0, &antialias); |
52 |
- FcResult eAutoHint = rWrapper.FcPatternGetBool(pSet->fonts[0], |
53 |
- FC_AUTOHINT, 0, &autohint); |
54 |
- FcResult eHinting = rWrapper.FcPatternGetBool(pSet->fonts[0], |
55 |
- FC_HINTING, 0, &hinting); |
56 |
- /*FcResult eHintStyle =*/ rWrapper.FcPatternGetInteger( pSet->fonts[0], |
57 |
- FC_HINT_STYLE, 0, &hintstyle); |
58 |
- |
59 |
- pOptions = new ImplFontOptions; |
60 |
- |
61 |
- if( eEmbeddedBitmap == FcResultMatch ) |
62 |
- pOptions->meEmbeddedBitmap = embitmap ? EMBEDDEDBITMAP_TRUE : EMBEDDEDBITMAP_FALSE; |
63 |
- if( eAntialias == FcResultMatch ) |
64 |
- pOptions->meAntiAlias = antialias ? ANTIALIAS_TRUE : ANTIALIAS_FALSE; |
65 |
- if( eAutoHint == FcResultMatch ) |
66 |
- pOptions->meAutoHint = autohint ? AUTOHINT_TRUE : AUTOHINT_FALSE; |
67 |
- if( eHinting == FcResultMatch ) |
68 |
- pOptions->meHinting = hinting ? HINTING_TRUE : HINTING_FALSE; |
69 |
- switch (hintstyle) |
70 |
- { |
71 |
- case FC_HINT_NONE: pOptions->meHintStyle = HINT_NONE; break; |
72 |
- case FC_HINT_SLIGHT: pOptions->meHintStyle = HINT_SLIGHT; break; |
73 |
- case FC_HINT_MEDIUM: pOptions->meHintStyle = HINT_MEDIUM; break; |
74 |
- default: // fall through |
75 |
- case FC_HINT_FULL: pOptions->meHintStyle = HINT_FULL; break; |
76 |
- } |
77 |
+ case FC_HINT_NONE: pOptions->meHintStyle = HINT_NONE; break; |
78 |
+ case FC_HINT_SLIGHT: pOptions->meHintStyle = HINT_SLIGHT; break; |
79 |
+ case FC_HINT_MEDIUM: pOptions->meHintStyle = HINT_MEDIUM; break; |
80 |
+ default: // fall through |
81 |
+ case FC_HINT_FULL: pOptions->meHintStyle = HINT_FULL; break; |
82 |
} |
83 |
- // info: destroying the pSet destroys pResult implicitly |
84 |
- // since pResult was "added" to pSet |
85 |
- rWrapper.FcFontSetDestroy( pSet ); |
86 |
} |
87 |
|
88 |
// cleanup |
89 |
-- |
90 |
1.7.4.1 |
91 |
|
92 |
|