/[pkgs]/rpms/openoffice.org/devel/openoffice.org-3.0.0.ooo87970.vcl.samenamesubs.patch
ViewVC logotype

Contents of /rpms/openoffice.org/devel/openoffice.org-3.0.0.ooo87970.vcl.samenamesubs.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.5 - (show annotations) (download) (as text)
Sat Oct 10 15:48:45 2009 UTC (6 weeks, 1 day ago) by caolanm
Branch: MAIN
CVS Tags: openoffice_org-3_2_0-2_5_fc13, openoffice_org-3_2_0-2_4_fc13, openoffice_org-3_2_0-1_2_fc13, openoffice_org-3_2_0-4_1_fc13, openoffice_org-3_2_0-2_3_fc13, openoffice_org-3_2_0-3_1_fc13, openoffice_org-3_2_0-3_2_fc13, openoffice_org-3_2_0-1_1_fc13, openoffice_org-3_2_0-3_4_fc13, openoffice_org-3_2_0-2_2_fc13, openoffice_org-3_2_0-2_1_fc13, openoffice_org-3_2_0-4_2_fc13, openoffice_org-3_2_0-5_1_fc13, HEAD
Changes since 1.4: +6 -6 lines
File MIME type: text/x-patch
first 3.2.0 milestone
1 diff -ru vcl/inc/vcl/fontmanager.hxx vcl/inc/vcl/fontmanager.hxx
2 --- openoffice.org.orig/vcl/inc/vcl/fontmanager.hxx 2008-05-26 15:48:28.000000000 +0100
3 +++ openoffice.org/vcl/inc/vcl/fontmanager.hxx 2008-05-26 15:50:13.000000000 +0100
4 @@ -765,8 +765,8 @@
5 FontConfigHints getFontConfigHints(const FastPrintFontInfo& rInfo, int nSize, void (*subcallback)(void *));
6
7 rtl::OUString Substitute( const rtl::OUString& rFontName, rtl::OUString& rMissingCodes,
8 - const rtl::OString& rLangAttrib, italic::type eItalic, weight::type eWeight,
9 - width::type eWidth, pitch::type ePitch) const;
10 + const rtl::OString& rLangAttrib, italic::type& rItalic, weight::type& rWeight,
11 + width::type& rWidth, pitch::type& rPitch) const;
12 bool hasFontconfig() const { return m_bFontconfigSuccess; }
13
14 int FreeTypeCharIndex( void *pFace, sal_uInt32 aChar );
15 diff -ru vcl/unx/source/fontmanager/fontconfig.cxx vcl/unx/source/fontmanager/fontconfig.cxx
16 --- openoffice.org.orig/vcl/unx/source/fontmanager/fontconfig.cxx 2008-05-26 15:48:28.000000000 +0100
17 +++ openoffice.org/vcl/unx/source/fontmanager/fontconfig.cxx 2008-05-26 16:07:30.000000000 +0100
18 @@ -560,6 +560,72 @@
19 return true;
20 }
21
22 +namespace
23 +{
24 + weight::type convertWeight(int weight)
25 + {
26 + // set weight
27 + if( weight <= FC_WEIGHT_THIN )
28 + return weight::Thin;
29 + else if( weight <= FC_WEIGHT_ULTRALIGHT )
30 + return weight::UltraLight;
31 + else if( weight <= FC_WEIGHT_LIGHT )
32 + return weight::Light;
33 + else if( weight <= FC_WEIGHT_BOOK )
34 + return weight::SemiLight;
35 + else if( weight <= FC_WEIGHT_NORMAL )
36 + return weight::Normal;
37 + else if( weight <= FC_WEIGHT_MEDIUM )
38 + return weight::Medium;
39 + else if( weight <= FC_WEIGHT_SEMIBOLD )
40 + return weight::SemiBold;
41 + else if( weight <= FC_WEIGHT_BOLD )
42 + return weight::Bold;
43 + else if( weight <= FC_WEIGHT_ULTRABOLD )
44 + return weight::UltraBold;
45 + return weight::Black;
46 + }
47 +
48 + italic::type convertSlant(int slant)
49 + {
50 + // set italic
51 + if( slant == FC_SLANT_ITALIC )
52 + return italic::Italic;
53 + else if( slant == FC_SLANT_OBLIQUE )
54 + return italic::Oblique;
55 + return italic::Upright;
56 + }
57 +
58 + pitch::type convertSpacing(int spacing)
59 + {
60 + // set pitch
61 + if( spacing == FC_MONO || spacing == FC_CHARCELL )
62 + return pitch::Fixed;
63 + return pitch::Variable;
64 + }
65 +
66 + width::type convertWidth(int width)
67 + {
68 + if (width == FC_WIDTH_ULTRACONDENSED)
69 + return width::UltraCondensed;
70 + else if (width == FC_WIDTH_EXTRACONDENSED)
71 + return width::ExtraCondensed;
72 + else if (width == FC_WIDTH_CONDENSED)
73 + return width::Condensed;
74 + else if (width == FC_WIDTH_SEMICONDENSED)
75 + return width::SemiCondensed;
76 + else if (width == FC_WIDTH_SEMIEXPANDED)
77 + return width::SemiExpanded;
78 + else if (width == FC_WIDTH_EXPANDED)
79 + return width::Expanded;
80 + else if (width == FC_WIDTH_EXTRAEXPANDED)
81 + return width::ExtraExpanded;
82 + else if (width == FC_WIDTH_ULTRAEXPANDED)
83 + return width::UltraExpanded;
84 + return width::Normal;
85 + }
86 +}
87 +
88 int PrintFontManager::countFontconfigFonts()
89 {
90 int nFonts = 0;
91 @@ -687,47 +753,11 @@
92 pUpdate->m_nFamilyName = nFamilyName;
93 }
94 if( eWeightRes == FcResultMatch )
95 - {
96 - // set weight
97 - if( weight <= FC_WEIGHT_THIN )
98 - pUpdate->m_eWeight = weight::Thin;
99 - else if( weight <= FC_WEIGHT_ULTRALIGHT )
100 - pUpdate->m_eWeight = weight::UltraLight;
101 - else if( weight <= FC_WEIGHT_LIGHT )
102 - pUpdate->m_eWeight = weight::Light;
103 - else if( weight <= FC_WEIGHT_BOOK )
104 - pUpdate->m_eWeight = weight::SemiLight;
105 - else if( weight <= FC_WEIGHT_NORMAL )
106 - pUpdate->m_eWeight = weight::Normal;
107 - else if( weight <= FC_WEIGHT_MEDIUM )
108 - pUpdate->m_eWeight = weight::Medium;
109 - else if( weight <= FC_WEIGHT_SEMIBOLD )
110 - pUpdate->m_eWeight = weight::SemiBold;
111 - else if( weight <= FC_WEIGHT_BOLD )
112 - pUpdate->m_eWeight = weight::Bold;
113 - else if( weight <= FC_WEIGHT_ULTRABOLD )
114 - pUpdate->m_eWeight = weight::UltraBold;
115 - else
116 - pUpdate->m_eWeight = weight::Black;
117 - }
118 + pUpdate->m_eWeight = convertWeight(weight);
119 if( eSpacRes == FcResultMatch )
120 - {
121 - // set pitch
122 - if( spacing == FC_PROPORTIONAL )
123 - pUpdate->m_ePitch = pitch::Variable;
124 - else if( spacing == FC_MONO || spacing == FC_CHARCELL )
125 - pUpdate->m_ePitch = pitch::Fixed;
126 - }
127 + pUpdate->m_ePitch = convertSpacing(spacing);
128 if( eSlantRes == FcResultMatch )
129 - {
130 - // set italic
131 - if( slant == FC_SLANT_ROMAN )
132 - pUpdate->m_eItalic = italic::Upright;
133 - else if( slant == FC_SLANT_ITALIC )
134 - pUpdate->m_eItalic = italic::Italic;
135 - else if( slant == FC_SLANT_OBLIQUE )
136 - pUpdate->m_eItalic = italic::Oblique;
137 - }
138 + pUpdate->m_eItalic = convertSlant(slant);
139 if( eStyleRes == FcResultMatch )
140 {
141 pUpdate->m_aStyleName = OStringToOUString( OString( (sal_Char*)style ), RTL_TEXTENCODING_UTF8 );
142 @@ -867,8 +897,8 @@
143
144 rtl::OUString PrintFontManager::Substitute(const rtl::OUString& rFontName,
145 rtl::OUString& rMissingCodes, const rtl::OString &rLangAttrib,
146 - italic::type eItalic, weight::type eWeight,
147 - width::type eWidth, pitch::type ePitch) const
148 + italic::type &rItalic, weight::type &rWeight,
149 + width::type &rWidth, pitch::type &rPitch) const
150 {
151 rtl::OUString aName;
152 FontCfgWrapper& rWrapper = FontCfgWrapper::get();
153 @@ -903,7 +933,7 @@
154 rWrapper.FcCharSetDestroy( unicodes );
155 }
156
157 - addtopattern(rWrapper, pPattern, eItalic, eWeight, eWidth, ePitch);
158 + addtopattern(rWrapper, pPattern, rItalic, rWeight, rWidth, rPitch);
159
160 // query fontconfig for a substitute
161 rWrapper.FcConfigSubstitute( rWrapper.FcConfigGetCurrent(), pPattern, FcMatchPattern );
162 @@ -940,6 +970,17 @@
163 if (aI != rWrapper.m_aFontNameToLocalized.end())
164 sFamily = aI->second;
165 aName = rtl::OStringToOUString( sFamily, RTL_TEXTENCODING_UTF8 );
166 +
167 +
168 + int val = 0;
169 + if ( FcResultMatch == rWrapper.FcPatternGetInteger( pSet->fonts[0], FC_WEIGHT, 0, &val))
170 + rWeight = convertWeight(val);
171 + if ( FcResultMatch == rWrapper.FcPatternGetInteger( pSet->fonts[0], FC_SLANT, 0, &val))
172 + rItalic = convertSlant(val);
173 + if ( FcResultMatch == rWrapper.FcPatternGetInteger( pSet->fonts[0], FC_SPACING, 0, &val))
174 + rPitch = convertSpacing(val);
175 + if ( FcResultMatch == rWrapper.FcPatternGetInteger( pSet->fonts[0], FC_WIDTH, 0, &val))
176 + rWidth = convertWidth(val);
177 }
178
179 // update rMissingCodes by removing resolved unicodes
180 diff -ru vcl/unx/source/gdi/salgdi3.cxx vcl/unx/source/gdi/salgdi3.cxx
181 --- openoffice.org.orig/vcl/unx/source/gdi/salgdi3.cxx 2008-05-26 16:46:52.000000000 +0100
182 +++ openoffice.org/vcl/unx/source/gdi/salgdi3.cxx 2008-05-26 16:46:28.000000000 +0100
183 @@ -2069,8 +2069,10 @@
184
185 // -----------------------------------------------------------------------
186
187 -static rtl::OUString GetFcSubstitute(const ImplFontSelectData &rFontSelData, OUString& rMissingCodes )
188 +static ImplFontSelectData GetFcSubstitute(const ImplFontSelectData &rFontSelData, OUString& rMissingCodes )
189 {
190 + ImplFontSelectData aRet(rFontSelData);
191 +
192 const rtl::OString aLangAttrib; //TODO: = MsLangId::convertLanguageToIsoByteString( rFontSelData.meLanguage );
193
194 psp::italic::type eItalic = psp::italic::Unknown;
195 @@ -2138,7 +2140,72 @@
196 }
197
198 const psp::PrintFontManager& rMgr = psp::PrintFontManager::get();
199 - return rMgr.Substitute( rFontSelData.maTargetName, rMissingCodes, aLangAttrib, eItalic, eWeight, eWidth, ePitch);
200 + aRet.maSearchName = rMgr.Substitute( rFontSelData.maTargetName, rMissingCodes, aLangAttrib, eItalic, eWeight, eWidth, ePitch);
201 +
202 + switch (eItalic)
203 + {
204 + case psp::italic::Upright: aRet.meItalic = ITALIC_NONE; break;
205 + case psp::italic::Italic: aRet.meItalic = ITALIC_NORMAL; break;
206 + case psp::italic::Oblique: aRet.meItalic = ITALIC_OBLIQUE; break;
207 + default:
208 + break;
209 + }
210 +
211 + switch (eWeight)
212 + {
213 + case psp::weight::Thin: aRet.meWeight = WEIGHT_THIN; break;
214 + case psp::weight::UltraLight: aRet.meWeight = WEIGHT_ULTRALIGHT; break;
215 + case psp::weight::Light: aRet.meWeight = WEIGHT_LIGHT; break;
216 + case psp::weight::SemiLight: aRet.meWeight = WEIGHT_SEMILIGHT; break;
217 + case psp::weight::Normal: aRet.meWeight = WEIGHT_NORMAL; break;
218 + case psp::weight::Medium: aRet.meWeight = WEIGHT_MEDIUM; break;
219 + case psp::weight::SemiBold: aRet.meWeight = WEIGHT_SEMIBOLD; break;
220 + case psp::weight::Bold: aRet.meWeight = WEIGHT_BOLD; break;
221 + case psp::weight::UltraBold: aRet.meWeight = WEIGHT_ULTRABOLD; break;
222 + case psp::weight::Black: aRet.meWeight = WEIGHT_BLACK; break;
223 + default:
224 + break;
225 + }
226 +
227 + switch (eWidth)
228 + {
229 + case psp::width::UltraCondensed: aRet.meWidthType = WIDTH_ULTRA_CONDENSED; break;
230 + case psp::width::ExtraCondensed: aRet.meWidthType = WIDTH_EXTRA_CONDENSED; break;
231 + case psp::width::Condensed: aRet.meWidthType = WIDTH_CONDENSED; break;
232 + case psp::width::SemiCondensed: aRet.meWidthType = WIDTH_SEMI_CONDENSED; break;
233 + case psp::width::Normal: aRet.meWidthType = WIDTH_NORMAL; break;
234 + case psp::width::SemiExpanded: aRet.meWidthType = WIDTH_SEMI_EXPANDED; break;
235 + case psp::width::Expanded: aRet.meWidthType = WIDTH_EXPANDED; break;
236 + case psp::width::ExtraExpanded: aRet.meWidthType = WIDTH_EXTRA_EXPANDED; break;
237 + case psp::width::UltraExpanded: aRet.meWidthType = WIDTH_ULTRA_EXPANDED; break;
238 + default:
239 + break;
240 + }
241 +
242 + switch (ePitch)
243 + {
244 + case psp::pitch::Fixed: aRet.mePitch = PITCH_FIXED; break;
245 + case psp::pitch::Variable: aRet.mePitch = PITCH_VARIABLE; break;
246 + default:
247 + break;
248 + }
249 +
250 + return aRet;
251 +}
252 +
253 +namespace
254 +{
255 + bool uselessmatch(const ImplFontSelectData &rOrig, const ImplFontSelectData &rNew)
256 + {
257 + return
258 + (
259 + rOrig.maTargetName == rNew.maSearchName &&
260 + rOrig.meWeight == rNew.meWeight &&
261 + rOrig.meItalic == rNew.meItalic &&
262 + rOrig.mePitch == rNew.mePitch &&
263 + rOrig.meWidthType == rNew.meWidthType
264 + );
265 + }
266 }
267
268 //--------------------------------------------------------------------------
269 @@ -2154,20 +2221,19 @@
270 return false;
271
272 rtl::OUString aDummy;
273 - const rtl::OUString aOUName = GetFcSubstitute( rFontSelData, aDummy );
274 - if( !aOUName.getLength() )
275 + const ImplFontSelectData aOut = GetFcSubstitute( rFontSelData, aDummy );
276 + if (!aOut.maSearchName.Len())
277 return false;
278 - const String aName( aOUName );
279 - if( aName == rFontSelData.maTargetName )
280 + if( uselessmatch(rFontSelData, aOut ) )
281 return false;
282
283 #ifdef DEBUG
284 ByteString aOrigName( rFontSelData.maTargetName, RTL_TEXTENCODING_UTF8 );
285 - ByteString aSubstName( aName, RTL_TEXTENCODING_UTF8 );
286 + ByteString aSubstName( aOut.maSearchName, RTL_TEXTENCODING_UTF8 );
287 printf( "FcPreMatchSubstititution \"%s\" -> \"%s\"\n",
288 aOrigName.GetBuffer(), aSubstName.GetBuffer() );
289 #endif
290 - rFontSelData.maSearchName = aName;
291 + rFontSelData = aOut;
292 return true;
293 }
294
295 @@ -2184,21 +2250,20 @@
296 || 0 == rFontSelData.maSearchName.CompareIgnoreCaseToAscii( "opensymbol", 10) )
297 return false;
298
299 - const rtl::OUString aOUName = GetFcSubstitute( rFontSelData, rMissingCodes );
300 + const ImplFontSelectData aOut = GetFcSubstitute( rFontSelData, rMissingCodes );
301 // TODO: cache the unicode+font specific result
302 - if( !aOUName.getLength() )
303 + if (!aOut.maSearchName.Len())
304 return false;
305 - const String aName( aOUName );
306 - if( aName == rFontSelData.maTargetName )
307 + if (uselessmatch(rFontSelData, aOut))
308 return false;
309
310 #ifdef DEBUG
311 ByteString aOrigName( rFontSelData.maTargetName, RTL_TEXTENCODING_UTF8 );
312 - ByteString aSubstName( aName, RTL_TEXTENCODING_UTF8 );
313 + ByteString aSubstName( aOut.maSearchName, RTL_TEXTENCODING_UTF8 );
314 printf( "FcGlyphFallbackSubstititution \"%s\" -> \"%s\"\n",
315 aOrigName.GetBuffer(), aSubstName.GetBuffer() );
316 #endif
317 - rFontSelData.maSearchName = aName;
318 + rFontSelData = aOut;
319 return true;
320 }
321

admin@fedoraproject.org
ViewVC Help
Powered by ViewVC 1.1.2