/[pkgs]/devel/openoffice.org/openoffice.org-2.0.2.ooo64508.vcl.honourfontconfighinting.patch
ViewVC logotype

Contents of /devel/openoffice.org/openoffice.org-2.0.2.ooo64508.vcl.honourfontconfighinting.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.26 - (show annotations) (download) (as text)
Sat Oct 10 15:48:45 2009 UTC (6 weeks, 3 days ago) by caolanm
Branch: MAIN
CVS Tags: openoffice_org-3_2_0-5_2_fc13, 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.25: +47 -48 lines
File MIME type: text/x-patch
first 3.2.0 milestone
1 Index: inc/vcl/impfont.hxx
2 ===================================================================
3 RCS file: /cvs/gsl/vcl/inc/vcl/impfont.hxx,v
4 retrieving revision 1.3
5 diff -u -r1.3 impfont.hxx
6 --- openoffice.org.orig/vcl/inc/vcl/impfont.hxx 11 Apr 2008 07:39:29 -0000 1.3
7 +++ openoffice.org/vcl/inc/vcl/impfont.hxx 30 May 2008 09:28:28 -0000
8 @@ -135,6 +135,42 @@
9 bool operator==( const ImplFontMetric& ) const;
10 };
11
12 +// ------------------
13 +// - ImplFontHints -
14 +// ------------------
15 +
16 +class ImplFontHints
17 +{
18 +public:
19 + FontEmbeddedBitmap meEmbeddedBitmap; // whether the embedded bitmaps should be used
20 + FontAntiAlias meAntiAlias; // whether the font should be antialiased
21 + FontAutoHint meAutoHint; // whether the font should be autohinted
22 + FontHinting meHinting; // whether the font should be hinted
23 + FontHintStyle meHintStyle; // type of font hinting to be used
24 +public:
25 + ImplFontHints() :
26 + meEmbeddedBitmap(EMBEDDEDBITMAP_DONTKNOW),
27 + meAntiAlias(ANTIALIAS_DONTKNOW),
28 + meAutoHint(AUTOHINT_DONTKNOW),
29 + meHinting(HINTING_DONTKNOW),
30 + meHintStyle(HINT_SLIGHT)
31 + {}
32 + ImplFontHints(FontEmbeddedBitmap eEmbeddedBitmap, FontAntiAlias eAntiAlias,
33 + FontAutoHint eAutoHint, FontHinting eHinting, FontHintStyle eHintStyle) :
34 + meEmbeddedBitmap(eEmbeddedBitmap),
35 + meAntiAlias(eAntiAlias),
36 + meAutoHint(eAutoHint),
37 + meHinting(eHinting),
38 + meHintStyle(eHintStyle)
39 + {}
40 + FontAutoHint GetUseAutoHint() const { return meAutoHint; }
41 + FontHintStyle GetHintStyle() const { return meHintStyle; }
42 + bool DontUseEmbeddedBitmaps() const { return meEmbeddedBitmap == EMBEDDEDBITMAP_FALSE; }
43 + bool DontUseAntiAlias() const { return meAntiAlias == ANTIALIAS_FALSE; }
44 + bool DontUseHinting() const { return (meHinting == HINTING_FALSE) || (GetHintStyle() == HINT_NONE); }
45 +};
46 +
47 +
48 // -------------------
49 // - ImplFontCharMap -
50 // -------------------
51 Index: inc/vcl/outdev.hxx
52 ===================================================================
53 RCS file: /cvs/gsl/vcl/inc/vcl/outdev.hxx,v
54 retrieving revision 1.6
55 diff -u -r1.6 outdev.hxx
56 --- openoffice.org.orig/vcl/inc/vcl/outdev.hxx 11 Apr 2008 07:47:31 -0000 1.6
57 +++ openoffice.org/vcl/inc/vcl/outdev.hxx 30 May 2008 09:28:33 -0000
58 @@ -77,6 +77,8 @@
59 class FontCharMap;
60 class SalLayout;
61 class ImplLayoutArgs;
62 +class ImplFontHints;
63 +class ImplFontAttributes;
64 class VirtualDevice;
65
66 namespace com {
67 @@ -555,6 +557,7 @@
68
69 SAL_DLLPRIVATE static FontEmphasisMark ImplGetEmphasisMarkStyle( const Font& rFont );
70 SAL_DLLPRIVATE static BOOL ImplIsUnderlineAbove( const Font& );
71 + SAL_DLLPRIVATE void ImplGetFontHints( const ImplFontAttributes& rFontAttributes, int nSize, ImplFontHints& rFontHints) const;
72
73
74 // tells whether this output device is RTL in an LTR UI or LTR in a RTL UI
75 Index: inc/vcl/outfont.hxx
76 ===================================================================
77 RCS file: /cvs/gsl/vcl/inc/vcl/outfont.hxx,v
78 retrieving revision 1.6
79 diff -u -r1.6 outfont.hxx
80 --- openoffice.org.orig/vcl/inc/vcl/outfont.hxx 11 Apr 2008 07:48:01 -0000 1.6
81 +++ openoffice.org/vcl/inc/vcl/outfont.hxx 30 May 2008 09:28:33 -0000
82 @@ -101,8 +101,6 @@
83 bool IsDeviceFont() const { return mbDevice; }
84 bool IsEmbeddable() const { return mbEmbeddable; }
85 bool IsSubsettable() const { return mbSubsettable; }
86 - FontEmbeddedBitmap UseEmbeddedBitmap() const { return meEmbeddedBitmap; }
87 - FontAntiAlias UseAntiAlias() const { return meAntiAlias; }
88
89 public: // TODO: hide members behind accessor methods
90 String maMapNames; // List of family name aliass separated with ';'
91 @@ -111,8 +109,6 @@
92 bool mbDevice; // true: built in font
93 bool mbSubsettable; // true: a subset of the font can be created
94 bool mbEmbeddable; // true: the font can be embedded
95 - FontEmbeddedBitmap meEmbeddedBitmap; // whether the embedded bitmaps should be used
96 - FontAntiAlias meAntiAlias; // whether the font should be antialiased
97 };
98
99 // ----------------
100 Index: inc/vcl/salgdi.hxx
101 ===================================================================
102 RCS file: /cvs/gsl/vcl/inc/vcl/salgdi.hxx,v
103 retrieving revision 1.5
104 diff -u -r1.5 salgdi.hxx
105 --- openoffice.org.orig/vcl/inc/vcl/salgdi.hxx 11 Apr 2008 07:53:59 -0000 1.5
106 +++ openoffice.org/vcl/inc/vcl/salgdi.hxx 30 May 2008 09:28:35 -0000
107 @@ -223,6 +223,8 @@
108 void ReleaseFonts() { SetFont( NULL, 0 ); }
109 // get the current font's metrics
110 virtual void GetFontMetric( ImplFontMetricData* ) = 0;
111 + virtual void GetFontHints( const ImplFontAttributes& rFontAttributes, int nSize, ImplFontHints& rFontHints) const = 0;
112 +
113 // get kernign pairs of the current font
114 // return only PairCount if (pKernPairs == NULL)
115 virtual ULONG GetKernPairs( ULONG nPairs, ImplKernPairData* pKernPairs ) = 0;
116 Index: inc/vcl/vclenum.hxx
117 ===================================================================
118 RCS file: /cvs/gsl/vcl/inc/vcl/vclenum.hxx,v
119 retrieving revision 1.5
120 diff -u -r1.5 vclenum.hxx
121 --- openoffice.org.orig/vcl/inc/vcl/vclenum.hxx 11 Apr 2008 08:07:45 -0000 1.5
122 +++ openoffice.org/vcl/inc/vcl/vclenum.hxx 30 May 2008 09:28:42 -0000
123 @@ -284,6 +284,27 @@
124
125 #endif
126
127 +#ifndef ENUM_FONTAUTOHINT_DECLARED
128 +#define ENUM_FONTAUTOHINT_DECLARED
129 +
130 +enum FontAutoHint { AUTOHINT_DONTKNOW, AUTOHINT_FALSE, AUTOHINT_TRUE };
131 +
132 +#endif
133 +
134 +#ifndef ENUM_FONTHINTING_DECLARED
135 +#define ENUM_FONTHINTING_DECLARED
136 +
137 +enum FontHinting { HINTING_DONTKNOW, HINTING_FALSE, HINTING_TRUE };
138 +
139 +#endif
140 +
141 +#ifndef ENUM_FONTHINTSTYLE_DECLARED
142 +#define ENUM_FONTHINTSTYLE_DECLARED
143 +
144 +enum FontHintStyle { HINT_NONE, HINT_SLIGHT, HINT_MEDIUM, HINT_FULL };
145 +
146 +#endif
147 +
148 // ------------------------------------------------------------
149
150 #ifndef ENUM_KEYFUNCTYPE_DECLARED
151 Index: source/gdi/outdev3.cxx
152 ===================================================================
153 RCS file: /cvs/gsl/vcl/source/gdi/outdev3.cxx,v
154 retrieving revision 1.240
155 diff -u -r1.240 outdev3.cxx
156 --- openoffice.org.orig/vcl/source/gdi/outdev3.cxx 11 Apr 2008 08:49:58 -0000 1.240
157 +++ openoffice.org/vcl/source/gdi/outdev3.cxx 30 May 2008 09:29:42 -0000
158 @@ -7332,6 +7332,14 @@
159
160 // -----------------------------------------------------------------------
161
162 +void OutputDevice::ImplGetFontHints( const ImplFontAttributes& rFontAttributes, int nSize, ImplFontHints &rHints) const
163 +{
164 + if ( mpGraphics )
165 + mpGraphics->GetFontHints( rFontAttributes, nSize, rHints );
166 +}
167 +
168 +// -----------------------------------------------------------------------
169 +
170 FontMetric OutputDevice::GetFontMetric() const
171 {
172 DBG_TRACE( "OutputDevice::GetFontMetric()" );
173 Index: source/glyphs/gcach_ftyp.cxx
174 ===================================================================
175 RCS file: /cvs/gsl/vcl/source/glyphs/gcach_ftyp.cxx,v
176 retrieving revision 1.149
177 diff -u -r1.149 gcach_ftyp.cxx
178 --- openoffice.org.orig/vcl/source/glyphs/gcach_ftyp.cxx 11 Apr 2008 08:57:28 -0000 1.149
179 +++ openoffice.org/vcl/source/glyphs/gcach_ftyp.cxx 30 May 2008 09:30:01 -0000
180 @@ -40,6 +40,7 @@
181 #include "vcl/impfont.hxx"
182 #include "vcl/bitmap.hxx"
183 #include "vcl/bmpacc.hxx"
184 +#include "vcl/virdev.hxx"
185
186 #include "tools/poly.hxx"
187 #include "basegfx/matrix/b2dhommatrix.hxx"
188 @@ -620,9 +621,6 @@
189 aDFA.mbSubsettable= false;
190 aDFA.mbEmbeddable = false;
191
192 - aDFA.meEmbeddedBitmap = EMBEDDEDBITMAP_DONTKNOW;
193 - aDFA.meAntiAlias = ANTIALIAS_DONTKNOW;
194 -
195 FT_Done_Face( aFaceFT );
196 AddFontFile( aCFileName, nFaceNum, ++mnNextFontId, aDFA, NULL );
197 ++nCount;
198 @@ -702,6 +700,7 @@
199 : ServerFont( rFSD ),
200 mnPrioEmbedded(nDefaultPrioEmbedded),
201 mnPrioAntiAlias(nDefaultPrioAntiAlias),
202 + mnPrioAutoHint(nDefaultPrioAutoHint),
203 mpFontInfo( pFI ),
204 maFaceFT( NULL ),
205 maSizeFT( NULL ),
206 @@ -835,42 +834,69 @@
207
208 mbArtItalic = (rFSD.meItalic != ITALIC_NONE && pFI->GetFontAttributes().GetSlant() == ITALIC_NONE);
209 mbArtBold = (rFSD.meWeight > WEIGHT_MEDIUM && pFI->GetFontAttributes().GetWeight() <= WEIGHT_MEDIUM);
210 + mbUseGamma = false;
211 + if (mbArtBold)
212 + {
213 + //static const int TT_CODEPAGE_RANGE_874 = (1L << 16); // Thai
214 + //static const int TT_CODEPAGE_RANGE_932 = (1L << 17); // JIS/Japan
215 + //static const int TT_CODEPAGE_RANGE_936 = (1L << 18); // Chinese: Simplified
216 + //static const int TT_CODEPAGE_RANGE_949 = (1L << 19); // Korean Wansung
217 + //static const int TT_CODEPAGE_RANGE_950 = (1L << 20); // Chinese: Traditional
218 + //static const int TT_CODEPAGE_RANGE_1361 = (1L << 21); // Korean Johab
219 + static const int TT_CODEPAGE_RANGES1_CJKT = 0x3F0000; // all of the above
220 + const TT_OS2* pOs2 = (const TT_OS2*)FT_Get_Sfnt_Table( maFaceFT, ft_sfnt_os2 );
221 + if ((pOs2) && (pOs2->ulCodePageRange1 & TT_CODEPAGE_RANGES1_CJKT )
222 + && rFSD.mnHeight < 20)
223 + mbUseGamma = true;
224 + }
225 +
226 + ImplFontHints aHints;
227 + VirtualDevice vdev( 1 );
228 + vdev.ImplGetFontHints( pFI->GetFontAttributes(), mnWidth, aHints );
229 +
230 + FontAutoHint eHint = aHints.GetUseAutoHint();
231 + if (eHint == AUTOHINT_DONTKNOW)
232 + eHint = mbUseGamma ? AUTOHINT_TRUE : AUTOHINT_FALSE;
233
234 - //static const int TT_CODEPAGE_RANGE_874 = (1L << 16); // Thai
235 - //static const int TT_CODEPAGE_RANGE_932 = (1L << 17); // JIS/Japan
236 - //static const int TT_CODEPAGE_RANGE_936 = (1L << 18); // Chinese: Simplified
237 - //static const int TT_CODEPAGE_RANGE_949 = (1L << 19); // Korean Wansung
238 - //static const int TT_CODEPAGE_RANGE_950 = (1L << 20); // Chinese: Traditional
239 - //static const int TT_CODEPAGE_RANGE_1361 = (1L << 21); // Korean Johab
240 - static const int TT_CODEPAGE_RANGES1_CJKT = 0x3F0000; // all of the above
241 - const TT_OS2* pOs2 = (const TT_OS2*)FT_Get_Sfnt_Table( maFaceFT, ft_sfnt_os2 );
242 - if ((pOs2) && (pOs2->ulCodePageRange1 & TT_CODEPAGE_RANGES1_CJKT )
243 - && rFSD.mnHeight < 20)
244 - mbUseGamma = true;
245 - else
246 - mbUseGamma = false;
247 -
248 - if (mbUseGamma)
249 + if (eHint == AUTOHINT_TRUE)
250 mnLoadFlags |= FT_LOAD_FORCE_AUTOHINT;
251
252 if( (mnSin != 0) && (mnCos != 0) ) // hinting for 0/90/180/270 degrees only
253 mnLoadFlags |= FT_LOAD_NO_HINTING;
254 mnLoadFlags |= FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH; //#88334#
255
256 - if (mpFontInfo->DontUseAntiAlias())
257 - mnPrioAntiAlias = 0;
258 - if (mpFontInfo->DontUseEmbeddedBitmaps())
259 - mnPrioEmbedded = 0;
260 + if (aHints.DontUseAntiAlias())
261 + mnPrioAntiAlias = 0;
262 + if (aHints.DontUseEmbeddedBitmaps())
263 + mnPrioEmbedded = 0;
264 + if (aHints.DontUseHinting())
265 + mnPrioAutoHint = 0;
266
267 #if (FTVERSION >= 2005) || defined(TT_CONFIG_OPTION_BYTECODE_INTERPRETER)
268 - if( nDefaultPrioAutoHint <= 0 )
269 + if( mnPrioAutoHint <= 0 )
270 #endif
271 mnLoadFlags |= FT_LOAD_NO_HINTING;
272
273 -#ifdef FT_LOAD_TARGET_LIGHT
274 - // enable "light hinting" if available
275 +#if defined(FT_LOAD_TARGET_LIGHT) && defined(FT_LOAD_TARGET_NORMAL)
276 if( !(mnLoadFlags & FT_LOAD_NO_HINTING) && (nFTVERSION >= 2103))
277 - mnLoadFlags |= FT_LOAD_TARGET_LIGHT;
278 + {
279 + mnLoadFlags |= FT_LOAD_TARGET_NORMAL;
280 + switch (aHints.GetHintStyle())
281 + {
282 + case HINT_NONE:
283 + mnLoadFlags |= FT_LOAD_NO_HINTING;
284 + break;
285 + case HINT_SLIGHT:
286 + mnLoadFlags |= FT_LOAD_TARGET_LIGHT;
287 + break;
288 + case HINT_MEDIUM:
289 + break;
290 + case HINT_FULL:
291 + default:
292 + break;
293 + }
294 + }
295 +
296 #endif
297
298 if( ((mnCos != 0) && (mnSin != 0)) || (mnPrioEmbedded <= 0) )
299 @@ -1228,13 +1254,15 @@
300 }
301 }
302
303 -#if !defined(TT_CONFIG_OPTION_BYTECODE_INTERPRETER)
304 +#if 0
305 // #95556# autohinting not yet optimized for non-western glyph styles
306 if( !(mnLoadFlags & (FT_LOAD_NO_HINTING | FT_LOAD_FORCE_AUTOHINT) )
307 && ( (aChar >= 0x0600 && aChar < 0x1E00) // south-east asian + arabic
308 ||(aChar >= 0x2900 && aChar < 0xD800) // CJKV
309 ||(aChar >= 0xF800) ) ) // presentation + symbols
310 + {
311 nGlyphFlags |= GF_UNHINTED;
312 + }
313 #endif
314
315 if( nGlyphIndex != 0 )
316 @@ -1376,11 +1404,11 @@
317 #if (FTVERSION >= 2002)
318 // for 0/90/180/270 degree fonts enable autohinting even if not advisable
319 // non-hinted and non-antialiased bitmaps just look too ugly
320 - if( (mnCos==0 || mnSin==0) && (nDefaultPrioAutoHint > 0) )
321 + if( (mnCos==0 || mnSin==0) && (mnPrioAutoHint > 0) )
322 nLoadFlags &= ~FT_LOAD_NO_HINTING;
323 #endif
324
325 - if( mnPrioEmbedded <= nDefaultPrioAutoHint )
326 + if( mnPrioEmbedded <= mnPrioAutoHint )
327 nLoadFlags |= FT_LOAD_NO_BITMAP;
328
329 FT_Error rc = -1;
330 @@ -1545,7 +1573,7 @@
331 // autohinting in FT<=2.0.4 makes antialiased glyphs look worse
332 nLoadFlags |= FT_LOAD_NO_HINTING;
333 #else
334 - if( (nGlyphFlags & GF_UNHINTED) || (nDefaultPrioAutoHint < mnPrioAntiAlias) )
335 + if( (nGlyphFlags & GF_UNHINTED) || (mnPrioAutoHint < mnPrioAntiAlias) )
336 nLoadFlags |= FT_LOAD_NO_HINTING;
337 #endif
338
339 Index: source/glyphs/gcach_ftyp.hxx
340 ===================================================================
341 RCS file: /cvs/gsl/vcl/source/glyphs/gcach_ftyp.hxx,v
342 retrieving revision 1.41
343 diff -u -r1.41 gcach_ftyp.hxx
344 --- openoffice.org.orig/vcl/source/glyphs/gcach_ftyp.hxx 11 Apr 2008 08:57:45 -0000 1.41
345 +++ openoffice.org/vcl/source/glyphs/gcach_ftyp.hxx 30 May 2008 09:30:01 -0000
346 @@ -88,10 +88,6 @@
347 int GetFaceNum() const { return mnFaceNum; }
348 int GetSynthetic() const { return mnSynthetic; }
349 sal_IntPtr GetFontId() const { return mnFontId; }
350 - bool DontUseAntiAlias() const
351 - { return maDevFontAttributes.UseAntiAlias() == ANTIALIAS_FALSE; }
352 - bool DontUseEmbeddedBitmaps() const
353 - { return maDevFontAttributes.UseEmbeddedBitmap() == EMBEDDEDBITMAP_FALSE; }
354 bool IsSymbolFont() const { return maDevFontAttributes.IsSymbolFont(); }
355 const ImplFontAttributes& GetFontAttributes() const { return maDevFontAttributes; }
356
357 @@ -216,6 +212,7 @@
358 int mnWidth;
359 int mnPrioEmbedded;
360 int mnPrioAntiAlias;
361 + int mnPrioAutoHint;
362 FtFontInfo* mpFontInfo;
363 FT_Int mnLoadFlags;
364 double mfStretch;
365 Index: unx/headless/svpgdi.cxx
366 ===================================================================
367 RCS file: /cvs/gsl/vcl/unx/headless/svpgdi.cxx,v
368 retrieving revision 1.5
369 diff -u -r1.5 svpgdi.cxx
370 --- openoffice.org.orig/vcl/unx/headless/svpgdi.cxx 11 Apr 2008 09:28:48 -0000 1.5
371 +++ openoffice.org/vcl/unx/headless/svpgdi.cxx 30 May 2008 09:30:54 -0000
372 @@ -548,3 +548,7 @@
373 {
374 return false;
375 }
376 +
377 +void SvpSalGraphics::GetFontHints( const ImplFontAttributes& , int , ImplFontHints& ) const
378 +{
379 +}
380 Index: unx/headless/svpgdi.hxx
381 ===================================================================
382 RCS file: /cvs/gsl/vcl/unx/headless/svpgdi.hxx,v
383 retrieving revision 1.5
384 diff -u -r1.5 svpgdi.hxx
385 --- openoffice.org.orig/vcl/unx/headless/svpgdi.hxx 11 Apr 2008 09:29:03 -0000 1.5
386 +++ openoffice.org/vcl/unx/headless/svpgdi.hxx 30 May 2008 09:30:54 -0000
387 @@ -170,6 +170,7 @@
388
389 virtual SystemGraphicsData GetGraphicsData() const;
390 virtual SystemFontData GetSysFontData( int nFallbacklevel ) const;
391 + virtual void GetFontHints( const ImplFontAttributes& rFontAttributes, int nSize, ImplFontHints& rFontHints) const;
392 };
393
394 #endif
395 Index: unx/headless/svppspgraphics.cxx
396 ===================================================================
397 RCS file: /cvs/gsl/vcl/unx/headless/svppspgraphics.cxx,v
398 retrieving revision 1.5
399 diff -u -r1.5 svppspgraphics.cxx
400 --- openoffice.org.orig/vcl/unx/headless/svppspgraphics.cxx 11 Apr 2008 09:30:23 -0000 1.5
401 +++ openoffice.org/vcl/unx/headless/svppspgraphics.cxx 30 May 2008 09:30:56 -0000
402 @@ -1194,32 +1194,6 @@
403 aDFA.mePitch = ToFontPitch (rInfo.m_ePitch);
404 aDFA.mbSymbolFlag = (rInfo.m_aEncoding == RTL_TEXTENCODING_SYMBOL);
405
406 - switch (rInfo.m_eEmbeddedbitmap)
407 - {
408 - default:
409 - aDFA.meEmbeddedBitmap = EMBEDDEDBITMAP_DONTKNOW;
410 - break;
411 - case psp::fcstatus::istrue:
412 - aDFA.meEmbeddedBitmap = EMBEDDEDBITMAP_TRUE;
413 - break;
414 - case psp::fcstatus::isfalse:
415 - aDFA.meEmbeddedBitmap = EMBEDDEDBITMAP_FALSE;
416 - break;
417 - }
418 -
419 - switch (rInfo.m_eAntialias)
420 - {
421 - default:
422 - aDFA.meAntiAlias = ANTIALIAS_DONTKNOW;
423 - break;
424 - case psp::fcstatus::istrue:
425 - aDFA.meAntiAlias = ANTIALIAS_TRUE;
426 - break;
427 - case psp::fcstatus::isfalse:
428 - aDFA.meAntiAlias = ANTIALIAS_FALSE;
429 - break;
430 - }
431 -
432 switch( rInfo.m_eType )
433 {
434 case psp::fonttype::Builtin:
435 @@ -1410,3 +1384,7 @@
436 return aRes;
437 }
438
439 +void PspGraphics::GetFontHints( const ImplFontAttributes& , int , ImplFontHints& ) const
440 +{
441 +}
442 +
443 Index: unx/headless/svppspgraphics.hxx
444 ===================================================================
445 RCS file: /cvs/gsl/vcl/unx/headless/svppspgraphics.hxx,v
446 retrieving revision 1.5
447 diff -u -r1.5 svppspgraphics.hxx
448 --- openoffice.org.orig/vcl/unx/headless/svppspgraphics.hxx 11 Apr 2008 09:30:40 -0000 1.5
449 +++ openoffice.org/vcl/unx/headless/svppspgraphics.hxx 30 May 2008 09:30:56 -0000
450 @@ -190,6 +190,7 @@
451
452 virtual SystemGraphicsData GetGraphicsData() const;
453 virtual SystemFontData GetSysFontData( int nFallbacklevel ) const;
454 + virtual void GetFontHints( const ImplFontAttributes& rFontAttributes, int nSize, ImplFontHints& rFontHints) const;
455 };
456
457 #endif // _SVP_PSPGRAPHICS_HXX
458 Index: unx/inc/pspgraphics.h
459 ===================================================================
460 RCS file: /cvs/gsl/vcl/unx/inc/pspgraphics.h,v
461 retrieving revision 1.18
462 diff -u -r1.18 pspgraphics.h
463 --- openoffice.org.orig/vcl/unx/inc/pspgraphics.h 11 Apr 2008 09:35:48 -0000 1.18
464 +++ openoffice.org/vcl/unx/inc/pspgraphics.h 30 May 2008 09:30:57 -0000
465 @@ -117,6 +117,7 @@
466 virtual void SetTextColor( SalColor nSalColor );
467 virtual USHORT SetFont( ImplFontSelectData*, int nFallbackLevel );
468 virtual void GetFontMetric( ImplFontMetricData* );
469 + virtual void GetFontHints( const ImplFontAttributes& rFontAttributes, int nSize, ImplFontHints& rFontHints) const;
470 virtual ULONG GetKernPairs( ULONG nPairs, ImplKernPairData* pKernPairs );
471 virtual ImplFontCharMap* GetImplFontCharMap() const;
472 virtual void GetDevFontList( ImplDevFontList* );
473 Index: unx/inc/salgdi.h
474 ===================================================================
475 RCS file: /cvs/gsl/vcl/unx/inc/salgdi.h,v
476 retrieving revision 1.45
477 diff -u -r1.45 salgdi.h
478 --- openoffice.org.orig/vcl/unx/inc/salgdi.h 11 Apr 2008 09:37:25 -0000 1.45
479 +++ openoffice.org/vcl/unx/inc/salgdi.h 30 May 2008 09:30:58 -0000
480 @@ -253,6 +253,7 @@
481 virtual void SetTextColor( SalColor nSalColor );
482 virtual USHORT SetFont( ImplFontSelectData*, int nFallbackLevel );
483 virtual void GetFontMetric( ImplFontMetricData* );
484 + virtual void GetFontHints( const ImplFontAttributes& rFontAttributes, int nSize, ImplFontHints& rFontHints) const;
485 virtual ULONG GetKernPairs( ULONG nPairs, ImplKernPairData* pKernPairs );
486 virtual ImplFontCharMap* GetImplFontCharMap() const;
487 virtual void GetDevFontList( ImplDevFontList* );
488 Index: unx/source/gdi/pspgraphics.cxx
489 ===================================================================
490 RCS file: /cvs/gsl/vcl/unx/source/gdi/pspgraphics.cxx,v
491 retrieving revision 1.29
492 diff -u -r1.29 pspgraphics.cxx
493 --- openoffice.org.orig/vcl/unx/source/gdi/pspgraphics.cxx 11 Apr 2008 09:53:14 -0000 1.29
494 +++ openoffice.org/vcl/unx/source/gdi/pspgraphics.cxx 30 May 2008 09:31:10 -0000
495 @@ -885,6 +885,10 @@
496 }
497 }
498
499 +void PspGraphics::GetFontHints( const ImplFontAttributes& rFontAttributes, int nSize, ImplFontHints& rFontHints) const
500 +{
501 +}
502 +
503 void PspGraphics::GetFontMetric( ImplFontMetricData *pMetric )
504 {
505 const psp::PrintFontManager& rMgr = psp::PrintFontManager::get();
506 @@ -1278,32 +1282,6 @@
507 aDFA.mbSubsettable = rInfo.m_bSubsettable;
508 aDFA.mbEmbeddable = rInfo.m_bEmbeddable;
509
510 - switch (rInfo.m_eEmbeddedbitmap)
511 - {
512 - default:
513 - aDFA.meEmbeddedBitmap = EMBEDDEDBITMAP_DONTKNOW;
514 - break;
515 - case psp::fcstatus::istrue:
516 - aDFA.meEmbeddedBitmap = EMBEDDEDBITMAP_TRUE;
517 - break;
518 - case psp::fcstatus::isfalse:
519 - aDFA.meEmbeddedBitmap = EMBEDDEDBITMAP_FALSE;
520 - break;
521 - }
522 -
523 - switch (rInfo.m_eAntialias)
524 - {
525 - default:
526 - aDFA.meAntiAlias = ANTIALIAS_DONTKNOW;
527 - break;
528 - case psp::fcstatus::istrue:
529 - aDFA.meAntiAlias = ANTIALIAS_TRUE;
530 - break;
531 - case psp::fcstatus::isfalse:
532 - aDFA.meAntiAlias = ANTIALIAS_FALSE;
533 - break;
534 - }
535 -
536 switch( rInfo.m_eType )
537 {
538 case psp::fonttype::Builtin:
539 Index: unx/source/gdi/salgdi3.cxx
540 ===================================================================
541 RCS file: /cvs/gsl/vcl/unx/source/gdi/salgdi3.cxx,v
542 retrieving revision 1.154
543 diff -u -r1.154 salgdi3.cxx
544 --- openoffice.org.orig/vcl/unx/source/gdi/salgdi3.cxx 11 Apr 2008 09:55:12 -0000 1.154
545 +++ openoffice.org/vcl/unx/source/gdi/salgdi3.cxx 30 May 2008 09:31:13 -0000
546 @@ -739,6 +739,7 @@
547 void (*mp_show_glyphs)(cairo_t *, const cairo_glyph_t *, int );
548 void (*mp_set_source_rgb)(cairo_t *, double , double , double );
549 void (*mp_set_font_options)(cairo_t *, const void *);
550 + void (*mp_ft_font_options_substitute)(const void*, void*);
551
552 bool canEmbolden() const { return false; }
553
554 @@ -776,6 +777,8 @@
555 { (*mp_set_source_rgb)(cr, red, green, blue); }
556 void set_font_options(cairo_t *cr, const void *options)
557 { (*mp_set_font_options)(cr, options); }
558 + void ft_font_options_substitute(const void *options, void *pattern)
559 + { (*mp_ft_font_options_substitute)(options, pattern); }
560 };
561
562 static CairoWrapper* pCairoInstance = NULL;
563 @@ -843,6 +846,8 @@
564 osl_getAsciiFunctionSymbol( mpCairoLib, "cairo_set_source_rgb" );
565 mp_set_font_options = (void (*)(cairo_t *, const void *options ))
566 osl_getAsciiFunctionSymbol( mpCairoLib, "cairo_set_font_options" );
567 + mp_ft_font_options_substitute = (void (*)(const void *, void *))
568 + osl_getAsciiFunctionSymbol( mpCairoLib, "cairo_ft_font_options_substitute" );
569
570 if( !(
571 mp_xlib_surface_create_with_xrender_format &&
572 @@ -860,7 +865,8 @@
573 mp_set_font_matrix &&
574 mp_show_glyphs &&
575 mp_set_source_rgb &&
576 - mp_set_font_options
577 + mp_set_font_options &&
578 + mp_ft_font_options_substitute
579 ) )
580 {
581 osl_unloadModule( mpCairoLib );
582 @@ -1629,6 +1635,187 @@
583
584 // ----------------------------------------------------------------------------
585
586 +void cairosubcallback(void *pPattern)
587 +{
588 + CairoWrapper &rCairo = CairoWrapper::get();
589 + if (rCairo.isValid())
590 + {
591 + rCairo.ft_font_options_substitute(
592 + Application::GetSettings().GetStyleSettings().GetCairoFontOptions(),
593 + pPattern);
594 + }
595 +}
596 +
597 +void X11SalGraphics::GetFontHints( const ImplFontAttributes& rFontAttributes, int nSize, ImplFontHints& rFontHints) const
598 +{
599 + psp::FastPrintFontInfo aInfo;
600 + // set family name
601 + aInfo.m_aFamilyName = rFontAttributes.GetFamilyName();
602 + // set italic
603 + switch( rFontAttributes.GetSlant() )
604 + {
605 + case ITALIC_NONE:
606 + aInfo.m_eItalic = psp::italic::Upright;
607 + break;
608 + case ITALIC_NORMAL:
609 + aInfo.m_eItalic = psp::italic::Italic;
610 + break;
611 + case ITALIC_OBLIQUE:
612 + aInfo.m_eItalic = psp::italic::Oblique;
613 + break;
614 + default:
615 + aInfo.m_eItalic = psp::italic::Unknown;
616 + break;
617 +
618 + }
619 + // set weight
620 + switch( rFontAttributes.GetWeight() )
621 + {
622 + case WEIGHT_THIN:
623 + aInfo.m_eWeight = psp::weight::Thin;
624 + break;
625 + case WEIGHT_ULTRALIGHT:
626 + aInfo.m_eWeight = psp::weight::UltraLight;
627 + break;
628 + case WEIGHT_LIGHT:
629 + aInfo.m_eWeight = psp::weight::Light;
630 + break;
631 + case WEIGHT_SEMILIGHT:
632 + aInfo.m_eWeight = psp::weight::SemiLight;
633 + break;
634 + case WEIGHT_NORMAL:
635 + aInfo.m_eWeight = psp::weight::Normal;
636 + break;
637 + case WEIGHT_MEDIUM:
638 + aInfo.m_eWeight = psp::weight::Medium;
639 + break;
640 + case WEIGHT_SEMIBOLD:
641 + aInfo.m_eWeight = psp::weight::SemiBold;
642 + break;
643 + case WEIGHT_BOLD:
644 + aInfo.m_eWeight = psp::weight::Bold;
645 + break;
646 + case WEIGHT_ULTRABOLD:
647 + aInfo.m_eWeight = psp::weight::UltraBold;
648 + break;
649 + case WEIGHT_BLACK:
650 + aInfo.m_eWeight = psp::weight::Black;
651 + break;
652 + default:
653 + aInfo.m_eWeight = psp::weight::Unknown;
654 + break;
655 + }
656 + // set width
657 + switch( rFontAttributes.GetWidthType() )
658 + {
659 + case WIDTH_ULTRA_CONDENSED:
660 + aInfo.m_eWidth = psp::width::UltraCondensed;
661 + break;
662 + case WIDTH_EXTRA_CONDENSED:
663 + aInfo.m_eWidth = psp::width::ExtraCondensed;
664 + break;
665 + case WIDTH_CONDENSED:
666 + aInfo.m_eWidth = psp::width::Condensed;
667 + break;
668 + case WIDTH_SEMI_CONDENSED:
669 + aInfo.m_eWidth = psp::width::SemiCondensed;
670 + break;
671 + case WIDTH_NORMAL:
672 + aInfo.m_eWidth = psp::width::Normal;
673 + break;
674 + case WIDTH_SEMI_EXPANDED:
675 + aInfo.m_eWidth = psp::width::SemiExpanded;
676 + break;
677 + case WIDTH_EXPANDED:
678 + aInfo.m_eWidth = psp::width::Expanded;
679 + break;
680 + case WIDTH_EXTRA_EXPANDED:
681 + aInfo.m_eWidth = psp::width::ExtraExpanded;
682 + break;
683 + case WIDTH_ULTRA_EXPANDED:
684 + aInfo.m_eWidth = psp::width::UltraExpanded;
685 + break;
686 + default:
687 + aInfo.m_eWidth = psp::width::Unknown;
688 + break;
689 + }
690 +
691 + psp::FontConfigHints aHints(psp::PrintFontManager::get().getFontConfigHints(aInfo, nSize,
692 + cairosubcallback));
693 +
694 + switch (aHints.m_eEmbeddedbitmap)
695 + {
696 + default:
697 + rFontHints.meEmbeddedBitmap = EMBEDDEDBITMAP_DONTKNOW;
698 + break;
699 + case psp::fcstatus::istrue:
700 + rFontHints.meEmbeddedBitmap = EMBEDDEDBITMAP_TRUE;
701 + break;
702 + case psp::fcstatus::isfalse:
703 + rFontHints.meEmbeddedBitmap = EMBEDDEDBITMAP_FALSE;
704 + break;
705 + }
706 +
707 + switch (aHints.m_eAntialias)
708 + {
709 + default:
710 + rFontHints.meAntiAlias = ANTIALIAS_DONTKNOW;
711 + break;
712 + case psp::fcstatus::istrue:
713 + rFontHints.meAntiAlias = ANTIALIAS_TRUE;
714 + break;
715 + case psp::fcstatus::isfalse:
716 + rFontHints.meAntiAlias = ANTIALIAS_FALSE;
717 + break;
718 + }
719 +
720 + switch (aHints.m_eAutoHint)
721 + {
722 + default:
723 + rFontHints.meAutoHint = AUTOHINT_DONTKNOW;
724 + break;
725 + case psp::fcstatus::istrue:
726 + rFontHints.meAutoHint = AUTOHINT_TRUE;
727 + break;
728 + case psp::fcstatus::isfalse:
729 + rFontHints.meAutoHint = AUTOHINT_FALSE;
730 + break;
731 + }
732 +
733 + switch (aHints.m_eHinting)
734 + {
735 + default:
736 + rFontHints.meHinting = HINTING_DONTKNOW;
737 + break;
738 + case psp::fcstatus::istrue:
739 + rFontHints.meHinting = HINTING_TRUE;
740 + break;
741 + case psp::fcstatus::isfalse:
742 + rFontHints.meHinting = HINTING_FALSE;
743 + break;
744 + }
745 +
746 + switch (aHints.m_eHintStyle)
747 + {
748 + case psp::fchint::Nohint:
749 + rFontHints.meHintStyle = HINT_NONE;
750 + break;
751 + case psp::fchint::Slight:
752 + rFontHints.meHintStyle = HINT_SLIGHT;
753 + break;
754 + case psp::fchint::Medium:
755 + rFontHints.meHintStyle = HINT_MEDIUM;
756 + break;
757 + default:
758 + case psp::fchint::Full:
759 + rFontHints.meHintStyle = HINT_FULL;
760 + break;
761 + }
762 +
763 +}
764 +
765 +// ----------------------------------------------------------------------------
766 +
767 void
768 X11SalGraphics::GetFontMetric( ImplFontMetricData *pMetric )
769 {
770 Index: unx/source/gdi/xlfd_extd.cxx
771 ===================================================================
772 RCS file: /cvs/gsl/vcl/unx/source/gdi/xlfd_extd.cxx,v
773 retrieving revision 1.31
774 diff -u -r1.31 xlfd_extd.cxx
775 --- openoffice.org.orig/vcl/unx/source/gdi/xlfd_extd.cxx 11 Apr 2008 09:57:12 -0000 1.31
776 +++ openoffice.org/vcl/unx/source/gdi/xlfd_extd.cxx 30 May 2008 09:31:15 -0000
777 @@ -105,9 +105,6 @@
778 mbSubsettable = false;
779 mbEmbeddable = false;
780
781 - meEmbeddedBitmap = EMBEDDEDBITMAP_DONTKNOW;
782 - meAntiAlias = ANTIALIAS_DONTKNOW;
783 -
784 mnQuality = -1;
785 }
786
787 Index: win/inc/salgdi.h
788 ===================================================================
789 RCS file: /cvs/gsl/vcl/win/inc/salgdi.h,v
790 retrieving revision 1.29
791 diff -u -r1.29 salgdi.h
792 --- openoffice.org.orig/vcl/win/inc/salgdi.h 11 Apr 2008 10:41:29 -0000 1.29
793 +++ openoffice.org/vcl/win/inc/salgdi.h 30 May 2008 09:31:31 -0000
794 @@ -274,6 +274,7 @@
795 virtual USHORT SetFont( ImplFontSelectData*, int nFallbackLevel );
796 // get the current font's etrics
797 virtual void GetFontMetric( ImplFontMetricData* );
798 + virtual void GetFontHints( const ImplFontAttributes& rFontAttributes, int nHints, ImplFontHints& rFontHints);
799 // get kernign pairs of the current font
800 // return only PairCount if (pKernPairs == NULL)
801 virtual ULONG GetKernPairs( ULONG nPairs, ImplKernPairData* pKernPairs );
802 Index: win/source/gdi/salgdi3.cxx
803 ===================================================================
804 RCS file: /cvs/gsl/vcl/win/source/gdi/salgdi3.cxx,v
805 retrieving revision 1.95
806 diff -u -r1.95 salgdi3.cxx
807 --- openoffice.org.orig/vcl/win/source/gdi/salgdi3.cxx 11 Apr 2008 10:48:39 -0000 1.95
808 +++ openoffice.org/vcl/win/source/gdi/salgdi3.cxx 30 May 2008 09:31:36 -0000
809 @@ -1388,6 +1388,12 @@
810
811 // -----------------------------------------------------------------------
812
813 +void WinSalGraphics::GetFontHints( const ImplFontAttributes& rFontAttributes, int nSize, ImplFontHints& rFontHints)
814 +{
815 +}
816 +
817 +// -----------------------------------------------------------------------
818 +
819 void WinSalGraphics::GetFontMetric( ImplFontMetricData* pMetric )
820 {
821 if ( aSalShlData.mbWNT )
822 Index: inc/psprint/fontmanager.hxx
823 ===================================================================
824 RCS file: /cvs/gsl/psprint/inc/psprint/fontmanager.hxx,v
825 retrieving revision 1.36
826 diff -u -r1.36 fontmanager.hxx
827 --- openoffice.org.orig/vcl/inc/vcl/fontmanager.hxx 11 Apr 2008 10:09:55 -0000 1.36
828 +++ openoffice.org/psprint/inc/vcl/fontmanager.hxx 18 Nov 2008 10:40:41 -0000
829 @@ -137,6 +137,33 @@
830 };
831 }
832
833 +namespace fchint
834 +{
835 +enum type {
836 + Nohint = 0,
837 + Slight = 1,
838 + Medium = 2,
839 + Full = 3
840 +};
841 +}
842 +
843 +struct FontConfigHints
844 +{
845 + fcstatus::type m_eEmbeddedbitmap;
846 + fcstatus::type m_eAntialias;
847 + fcstatus::type m_eAutoHint;
848 + fcstatus::type m_eHinting;
849 + fchint::type m_eHintStyle;
850 +
851 + FontConfigHints() :
852 + m_eEmbeddedbitmap( fcstatus::isunset ),
853 + m_eAntialias( fcstatus::isunset ),
854 + m_eAutoHint( fcstatus::isunset ),
855 + m_eHinting( fcstatus::isunset ),
856 + m_eHintStyle( fchint::Full )
857 + {}
858 +};
859 +
860 /*
861 * the difference between FastPrintFontInfo and PrintFontInfo
862 * is that the information in FastPrintFontInfo can usually
863 @@ -162,8 +189,6 @@
864 weight::type m_eWeight;
865 pitch::type m_ePitch;
866 rtl_TextEncoding m_aEncoding;
867 - fcstatus::type m_eEmbeddedbitmap;
868 - fcstatus::type m_eAntialias;
869 bool m_bSubsettable;
870 bool m_bEmbeddable;
871
872 @@ -175,9 +200,7 @@
873 m_eWidth( width::Unknown ),
874 m_eWeight( weight::Unknown ),
875 m_ePitch( pitch::Unknown ),
876 - m_aEncoding( RTL_TEXTENCODING_DONTKNOW ),
877 - m_eEmbeddedbitmap( fcstatus::isunset ),
878 - m_eAntialias( fcstatus::isunset )
879 + m_aEncoding( RTL_TEXTENCODING_DONTKNOW )
880 {}
881 };
882
883 @@ -294,9 +317,6 @@
884 bool m_bHaveVerticalSubstitutedGlyphs;
885 bool m_bUserOverride;
886
887 - fcstatus::type m_eEmbeddedbitmap;
888 - fcstatus::type m_eAntialias;
889 -
890 std::map< sal_Unicode, sal_Int32 > m_aEncodingVector;
891 std::map< sal_Unicode, rtl::OString > m_aNonEncoded;
892
893 @@ -736,6 +756,7 @@
894 false else
895 */
896 bool matchFont( FastPrintFontInfo& rInfo, const com::sun::star::lang::Locale& rLocale );
897 + FontConfigHints getFontConfigHints(const FastPrintFontInfo& rInfo, int nSize, void (*subcallback)(void *));
898
899 rtl::OUString Substitute( const rtl::OUString& rFontName, rtl::OUString& rMissingCodes,
900 const rtl::OString& rLangAttrib, italic::type eItalic, weight::type eWeight,
901 Index: source/fontmanager/fontcache.cxx
902 ===================================================================
903 RCS file: /cvs/gsl/psprint/source/fontmanager/fontcache.cxx,v
904 retrieving revision 1.26
905 diff -u -r1.26 fontcache.cxx
906 --- openoffice.org.orig/vcl/unx/source/fontmanager/fontcache.cxx 11 Apr 2008 10:12:37 -0000 1.26
907 +++ openoffiec.org/vcl/unx/source/fontmanager/fontcache.cxx 18 Nov 2008 10:40:41 -0000
908 @@ -214,9 +214,9 @@
909 aLine.Append( ';' );
910 aLine.Append( (*it)->m_bUserOverride ? "1" : "0" );
911 aLine.Append( ';' );
912 - aLine.Append( ByteString::CreateFromInt32( (*it)->m_eEmbeddedbitmap ) );
913 + aLine.Append( ByteString::CreateFromInt32( 0 ) );
914 aLine.Append( ';' );
915 - aLine.Append( ByteString::CreateFromInt32( (*it)->m_eAntialias ) );
916 + aLine.Append( ByteString::CreateFromInt32( 0 ) );
917
918 switch( (*it)->m_eType )
919 {
920 @@ -426,9 +426,6 @@
921 = atoi( pLine + nTokenPos[14] );
922 pFont->m_bUserOverride
923 = (atoi( pLine + nTokenPos[15] ) != 0);
924 - pFont->m_eEmbeddedbitmap
925 - = (fcstatus::type)atoi(pLine+nTokenPos[16]);
926 - pFont->m_eAntialias = (fcstatus::type)atoi(pLine+nTokenPos[17]);
927 int nStyleTokenNr = 18;
928 switch( eType )
929 {
930 @@ -560,8 +557,6 @@
931 pTo->m_nYMax = pFrom->m_nYMax;
932 pTo->m_bHaveVerticalSubstitutedGlyphs = pFrom->m_bHaveVerticalSubstitutedGlyphs;
933 pTo->m_bUserOverride = pFrom->m_bUserOverride;
934 - pTo->m_eEmbeddedbitmap = pFrom->m_eEmbeddedbitmap;
935 - pTo->m_eAntialias = pFrom->m_eAntialias;
936 }
937
938 /*
939 @@ -623,9 +618,7 @@
940 pRight->m_nXMax != pLeft->m_nXMax ||
941 pRight->m_nYMax != pLeft->m_nYMax ||
942 pRight->m_bHaveVerticalSubstitutedGlyphs != pLeft->m_bHaveVerticalSubstitutedGlyphs ||
943 - pRight->m_bUserOverride != pLeft->m_bUserOverride ||
944 - pRight->m_eEmbeddedbitmap != pLeft->m_eEmbeddedbitmap ||
945 - pRight->m_eAntialias != pLeft->m_eAntialias
946 + pRight->m_bUserOverride != pLeft->m_bUserOverride
947 )
948 return false;
949 std::list< int >::const_iterator lit, rit;
950 Index: source/fontmanager/fontconfig.cxx
951 ===================================================================
952 RCS file: /cvs/gsl/psprint/source/fontmanager/fontconfig.cxx,v
953 retrieving revision 1.30.20.1
954 diff -u -r1.30.20.1 fontconfig.cxx
955 --- openoffice.org.orig/vcl/unx/source/fontmanager/fontconfig.cxx 10 Sep 2008 13:53:12 -0000 1.30.20.1
956 +++ openoffice.org/vcl/unx/source/fontmanager/fontconfig.cxx 18 Nov 2008 10:40:42 -0000
957 @@ -122,6 +122,7 @@
958 FcBool (*m_pFcConfigAppFontAddDir)(FcConfig*, const FcChar8*);
959 FcBool (*m_pFcConfigSubstitute)(FcConfig*,FcPattern*,FcMatchKind);
960 FcBool (*m_pFcPatternAddInteger)(FcPattern*,const char*,int);
961 + FcBool (*m_pFcPatternAddDouble)(FcPattern*,const char*,double);
962 FcBool (*m_pFcPatternAddBool)(FcPattern*,const char*,FcBool);
963 FcBool (*m_pFcPatternAddCharSet)(FcPattern*,const char*,const FcCharSet*);
964 FcBool (*m_pFcPatternAddString)(FcPattern*,const char*,const FcChar8*);
965 @@ -226,6 +227,8 @@
966 { return m_pFcConfigSubstitute( pConfig, pPattern, eKind ); }
967 FcBool FcPatternAddInteger( FcPattern* pPattern, const char* pObject, int nValue )
968 { return m_pFcPatternAddInteger( pPattern, pObject, nValue ); }
969 + FcBool FcPatternAddDouble( FcPattern* pPattern, const char* pObject, double nValue )
970 + { return m_pFcPatternAddDouble( pPattern, pObject, nValue ); }
971 FcBool FcPatternAddString( FcPattern* pPattern, const char* pObject, const FcChar8* pString )
972 { return m_pFcPatternAddString( pPattern, pObject, pString ); }
973 FcBool FcPatternAddBool( FcPattern* pPattern, const char* pObject, bool nValue )
974 @@ -237,7 +240,9 @@
975 { return m_pFcFreeTypeCharIndex ? m_pFcFreeTypeCharIndex( face, ucs4 ) : 0; }
976
977 public: // TODO: cleanup
978 - std::hash_map< rtl::OString, rtl::OString, rtl::OStringHash > m_aFontconfigNameToLocalized;
979 + FcResult FamilyFromPattern(FcPattern* pPattern, FcChar8 **family);
980 + std::hash_map< rtl::OString, rtl::OString, rtl::OStringHash > m_aFontNameToLocalized;
981 + std::hash_map< rtl::OString, rtl::OString, rtl::OStringHash > m_aLocalizedToCanonical;
982 };
983
984 oslGenericFunction FontCfgWrapper::loadSymbol( const char* pSymbol )
985 @@ -327,6 +332,8 @@
986 loadSymbol( "FcConfigSubstitute" );
987 m_pFcPatternAddInteger = (FcBool(*)(FcPattern*,const char*,int))
988 loadSymbol( "FcPatternAddInteger" );
989 + m_pFcPatternAddDouble = (FcBool(*)(FcPattern*,const char*,double))
990 + loadSymbol( "FcPatternAddDouble" );
991 m_pFcPatternAddBool = (FcBool(*)(FcPattern*,const char*,FcBool))
992 loadSymbol( "FcPatternAddBool" );
993 m_pFcPatternAddCharSet = (FcBool(*)(FcPattern*,const char*,const FcCharSet *))
994 @@ -364,6 +371,7 @@
995 m_pFcDefaultSubstitute &&
996 m_pFcConfigSubstitute &&
997 m_pFcPatternAddInteger &&
998 + m_pFcPatternAddDouble &&
999 m_pFcPatternAddCharSet &&
1000 m_pFcPatternAddBool &&
1001 m_pFcPatternAddString
1002 @@ -498,54 +506,53 @@
1003
1004 return candidate;
1005 }
1006 +}
1007
1008 -
1009 - FcResult lcl_FamilyFromPattern(FontCfgWrapper& rWrapper, FcPattern* pPattern, FcChar8 **family,
1010 - std::hash_map< rtl::OString, rtl::OString, rtl::OStringHash > &aFontconfigNameToLocalized)
1011 +FcResult FontCfgWrapper::FamilyFromPattern(FcPattern* pPattern, FcChar8 **family)
1012 +{
1013 + FcChar8 *origfamily;
1014 + FcResult eFamilyRes = FcPatternGetString( pPattern, FC_FAMILY, 0, &origfamily );
1015 + *family = origfamily;
1016 +
1017 + if( eFamilyRes == FcResultMatch)
1018 {
1019 - FcChar8 *origfamily;
1020 - FcResult eFamilyRes = rWrapper.FcPatternGetString( pPattern, FC_FAMILY, 0, &origfamily );
1021 - *family = origfamily;
1022 -
1023 - if( eFamilyRes == FcResultMatch)
1024 + FcChar8* familylang = NULL;
1025 + if (FcPatternGetString( pPattern, FC_FAMILYLANG, 0, &familylang ) == FcResultMatch)
1026 {
1027 - FcChar8* familylang = NULL;
1028 - if (rWrapper.FcPatternGetString( pPattern, FC_FAMILYLANG, 0, &familylang ) == FcResultMatch)
1029 + std::vector< lang_and_family > lang_and_families;
1030 + lang_and_families.push_back(lang_and_family(familylang, *family));
1031 + int k = 1;
1032 + while (1)
1033 {
1034 - std::vector< lang_and_family > lang_and_families;
1035 + if (FcPatternGetString( pPattern, FC_FAMILYLANG, k, &familylang ) != FcResultMatch)
1036 + break;
1037 + if (FcPatternGetString( pPattern, FC_FAMILY, k, family ) != FcResultMatch)
1038 + break;
1039 lang_and_families.push_back(lang_and_family(familylang, *family));
1040 - int k = 1;
1041 - while (1)
1042 - {
1043 - if (rWrapper.FcPatternGetString( pPattern, FC_FAMILYLANG, k, &familylang ) != FcResultMatch)
1044 - break;
1045 - if (rWrapper.FcPatternGetString( pPattern, FC_FAMILY, k, family ) != FcResultMatch)
1046 - break;
1047 - lang_and_families.push_back(lang_and_family(familylang, *family));
1048 - ++k;
1049 - }
1050 -
1051 - //possible to-do, sort by UILocale instead of process locale
1052 - rtl_Locale* pLoc;
1053 - osl_getProcessLocale(&pLoc);
1054 - localizedsorter aSorter(pLoc);
1055 - *family = aSorter.bestname(lang_and_families);
1056 -
1057 - std::vector<lang_and_family>::const_iterator aEnd = lang_and_families.end();
1058 - for (std::vector<lang_and_family>::const_iterator aIter = lang_and_families.begin(); aIter != aEnd; ++aIter)
1059 - {
1060 - const char *candidate = (const char*)(aIter->second);
1061 - if (rtl_str_compare(candidate, (const char*)(*family)) != 0)
1062 - aFontconfigNameToLocalized[OString(candidate)] = OString((const char*)(*family));
1063 - }
1064 + ++k;
1065 + }
1066 +
1067 + //possible to-do, sort by UILocale instead of process locale
1068 + rtl_Locale* pLoc;
1069 + osl_getProcessLocale(&pLoc);
1070 + localizedsorter aSorter(pLoc);
1071 + *family = aSorter.bestname(lang_and_families);
1072 +
1073 + std::vector<lang_and_family>::const_iterator aEnd = lang_and_families.end();
1074 + for (std::vector<lang_and_family>::const_iterator aIter = lang_and_families.begin(); aIter != aEnd; ++aIter)
1075 + {
1076 + const char *candidate = (const char*)(aIter->second);
1077 + if (rtl_str_compare(candidate, (const char*)(*family)) != 0)
1078 + m_aFontNameToLocalized[OString(candidate)] = OString((const char*)(*family));
1079 }
1080 + if (rtl_str_compare((const char*)origfamily, (const char*)(*family)) != 0)
1081 + m_aLocalizedToCanonical[OString((const char*)(*family))] = OString((const char*)origfamily);
1082 }
1083 -
1084 - return eFamilyRes;
1085 }
1086 +
1087 + return eFamilyRes;
1088 }
1089
1090 -
1091 /*
1092 * PrintFontManager::initFontconfig
1093 */
1094 @@ -580,18 +587,16 @@
1095 int weight = 0;
1096 int spacing = 0;
1097 int nCollectionEntry = -1;
1098 - FcBool outline = false, embitmap = true, antialias = true;
1099 + FcBool outline = false;
1100
1101 FcResult eFileRes = rWrapper.FcPatternGetString( pFSet->fonts[i], FC_FILE, 0, &file );
1102 - FcResult eFamilyRes = lcl_FamilyFromPattern(rWrapper, pFSet->fonts[i], &family, rWrapper.m_aFontconfigNameToLocalized );
1103 + FcResult eFamilyRes = rWrapper.FamilyFromPattern( pFSet->fonts[i], &family );
1104 FcResult eStyleRes = rWrapper.FcPatternGetString( pFSet->fonts[i], FC_STYLE, 0, &style );
1105 FcResult eSlantRes = rWrapper.FcPatternGetInteger( pFSet->fonts[i], FC_SLANT, 0, &slant );
1106 FcResult eWeightRes = rWrapper.FcPatternGetInteger( pFSet->fonts[i], FC_WEIGHT, 0, &weight );
1107 FcResult eSpacRes = rWrapper.FcPatternGetInteger( pFSet->fonts[i], FC_SPACING, 0, &spacing );
1108 FcResult eOutRes = rWrapper.FcPatternGetBool( pFSet->fonts[i], FC_OUTLINE, 0, &outline );
1109 FcResult eIndexRes = rWrapper.FcPatternGetInteger( pFSet->fonts[i], FC_INDEX, 0, &nCollectionEntry );
1110 - FcResult eEmbeddedBitmap = rWrapper.FcPatternGetBool( pFSet->fonts[i], FC_EMBEDDED_BITMAP, 0, &embitmap );
1111 - FcResult eAntialias = rWrapper.FcPatternGetBool( pFSet->fonts[i], FC_ANTIALIAS, 0, &antialias );
1112
1113 if( eFileRes != FcResultMatch || eFamilyRes != FcResultMatch || eOutRes != FcResultMatch )
1114 continue;
1115 @@ -731,15 +736,6 @@
1116 {
1117 pUpdate->m_aStyleName = OStringToOUString( OString( (sal_Char*)style ), RTL_TEXTENCODING_UTF8 );
1118 }
1119 - if( eEmbeddedBitmap == FcResultMatch )
1120 - {
1121 - pUpdate->m_eEmbeddedbitmap = embitmap ? fcstatus::istrue : fcstatus::isfalse;
1122 - }
1123 - if( eAntialias == FcResultMatch )
1124 - {
1125 - pUpdate->m_eAntialias = antialias ? fcstatus::istrue : fcstatus::isfalse;
1126 - }
1127 -
1128
1129 // update font cache
1130 m_pFontCache->updateFontCacheEntry( pUpdate, false );
1131 @@ -944,8 +940,8 @@
1132 if( eFileRes == FcResultMatch )
1133 {
1134 OString sFamily((sal_Char*)family);
1135 - std::hash_map< rtl::OString, rtl::OString, rtl::OStringHash >::const_iterator aI = rWrapper.m_aFontconfigNameToLocalized.find(sFamily);
1136 - if (aI != rWrapper.m_aFontconfigNameToLocalized.end())
1137 + std::hash_map< rtl::OString, rtl::OString, rtl::OStringHash >::const_iterator aI = rWrapper.m_aFontNameToLocalized.find(sFamily);
1138 + if (aI != rWrapper.m_aFontNameToLocalized.end())
1139 sFamily = aI->second;
1140 aName = rtl::OStringToOUString( sFamily, RTL_TEXTENCODING_UTF8 );
1141 }
1142 @@ -976,6 +972,98 @@
1143 return aName;
1144 }
1145
1146 +FontConfigHints PrintFontManager::getFontConfigHints(
1147 + const FastPrintFontInfo& rInfo, int nSize, void (*subcallback)(void *) )
1148 +{
1149 + FontConfigHints aHints;
1150 +#ifdef ENABLE_FONTCONFIG
1151 + FontCfgWrapper& rWrapper = FontCfgWrapper::get();
1152 + if( ! rWrapper.isValid() )
1153 + return aHints;
1154 +
1155 + FcConfig* pConfig = rWrapper.FcConfigGetCurrent();
1156 + FcPattern* pPattern = rWrapper.FcPatternCreate();
1157 +
1158 + OString sFamily = OUStringToOString( rInfo.m_aFamilyName, RTL_TEXTENCODING_UTF8 );
1159 +
1160 + std::hash_map< rtl::OString, rtl::OString, rtl::OStringHash >::const_iterator aI = rWrapper.m_aLocalizedToCanonical.find(sFamily);
1161 + if (aI != rWrapper.m_aLocalizedToCanonical.end())
1162 + sFamily = aI->second;
1163 + if( sFamily.getLength() )
1164 + rWrapper.FcPatternAddString( pPattern, FC_FAMILY, (FcChar8*)sFamily.getStr() );
1165 +
1166 + addtopattern(rWrapper, pPattern, rInfo.m_eItalic, rInfo.m_eWeight, rInfo.m_eWidth, rInfo.m_ePitch);
1167 + rWrapper.FcPatternAddDouble( pPattern, FC_PIXEL_SIZE, nSize);
1168 +
1169 + FcBool embitmap = true, antialias = true, autohint = true, hinting = true;
1170 + int hintstyle = FC_HINT_FULL;
1171 +
1172 + rWrapper.FcConfigSubstitute( pConfig, pPattern, FcMatchPattern );
1173 + if (subcallback) subcallback(pPattern);
1174 + rWrapper.FcDefaultSubstitute( pPattern );
1175 +
1176 + FcResult eResult = FcResultNoMatch;
1177 + FcFontSet *pFontSet = rWrapper.getFontSet();
1178 + FcPattern* pResult = rWrapper.FcFontSetMatch( pConfig, &pFontSet, 1, pPattern, &eResult );
1179 + if( pResult )
1180 + {
1181 + FcFontSet* pSet = rWrapper.FcFontSetCreate();
1182 + rWrapper.FcFontSetAdd( pSet, pResult );
1183 + if( pSet->nfont > 0 )
1184 + {
1185 + FcResult eEmbeddedBitmap = rWrapper.FcPatternGetBool(pSet->fonts[0],
1186 + FC_EMBEDDED_BITMAP, 0, &embitmap);
1187 + FcResult eAntialias = rWrapper.FcPatternGetBool(pSet->fonts[0],
1188 + FC_ANTIALIAS, 0, &antialias);
1189 + FcResult eAutoHint = rWrapper.FcPatternGetBool(pSet->fonts[0],
1190 + FC_AUTOHINT, 0, &autohint);
1191 + FcResult eHinting = rWrapper.FcPatternGetBool(pSet->fonts[0],
1192 + FC_HINTING, 0, &hinting);
1193 + FcResult eHintStyle = rWrapper.FcPatternGetInteger(pSet->fonts[0],
1194 + FC_HINT_STYLE, 0, &hintstyle);
1195 +
1196 + if( eEmbeddedBitmap == FcResultMatch )
1197 + aHints.m_eEmbeddedbitmap = embitmap ? fcstatus::istrue : fcstatus::isfalse;
1198 + if( eAntialias == FcResultMatch )
1199 + aHints.m_eAntialias = antialias ? fcstatus::istrue : fcstatus::isfalse;
1200 + if( eAutoHint == FcResultMatch )
1201 + aHints.m_eAutoHint = autohint ? fcstatus::istrue : fcstatus::isfalse;
1202 + if( eHinting == FcResultMatch )
1203 + aHints.m_eHinting = hinting ? fcstatus::istrue : fcstatus::isfalse;
1204 + if (eHintStyle != FcResultMatch)
1205 + aHints.m_eHintStyle = fchint::Full;
1206 + else
1207 + {
1208 + switch (hintstyle)
1209 + {
1210 + case FC_HINT_NONE:
1211 + aHints.m_eHintStyle = fchint::Nohint;
1212 + break;
1213 + case FC_HINT_SLIGHT:
1214 + aHints.m_eHintStyle = fchint::Slight;
1215 + break;
1216 + case FC_HINT_MEDIUM:
1217 + aHints.m_eHintStyle = fchint::Medium;
1218 + break;
1219 + case FC_HINT_FULL:
1220 + default:
1221 + aHints.m_eHintStyle = fchint::Full;
1222 + break;
1223 + }
1224 + }
1225 + }
1226 + // info: destroying the pSet destroys pResult implicitly
1227 + // since pResult was "added" to pSet
1228 + rWrapper.FcFontSetDestroy( pSet );
1229 + }
1230 +
1231 + // cleanup
1232 + rWrapper.FcPatternDestroy( pPattern );
1233 +
1234 +#endif
1235 + return aHints;
1236 +}
1237 +
1238 bool PrintFontManager::matchFont( FastPrintFontInfo& rInfo, const com::sun::star::lang::Locale& rLocale )
1239 {
1240 FontCfgWrapper& rWrapper = FontCfgWrapper::get();
1241 Index: source/fontmanager/fontmanager.cxx
1242 ===================================================================
1243 RCS file: /cvs/gsl/psprint/source/fontmanager/fontmanager.cxx,v
1244 retrieving revision 1.81.18.1
1245 diff -u -r1.81.18.1 fontmanager.cxx
1246 --- openoffice.org.orig/vcl/unx/source/fontmanager/fontmanager.cxx 10 Sep 2008 13:53:28 -0000 1.81.18.1
1247 +++ openoffice.org/vcl/unx/source/fontmanager/fontmanager.cxx 18 Nov 2008 10:40:42 -0000
1248 @@ -353,9 +353,7 @@
1249 m_nXMax( 0 ),
1250 m_nYMax( 0 ),
1251 m_bHaveVerticalSubstitutedGlyphs( false ),
1252 - m_bUserOverride( false ),
1253 - m_eEmbeddedbitmap( fcstatus::isunset ),
1254 - m_eAntialias( fcstatus::isunset )
1255 + m_bUserOverride( false )
1256 {
1257 }
1258
1259 @@ -2630,8 +2628,6 @@
1260 rInfo.m_eWeight = pFont->m_eWeight;
1261 rInfo.m_ePitch = pFont->m_ePitch;
1262 rInfo.m_aEncoding = pFont->m_aEncoding;
1263 - rInfo.m_eEmbeddedbitmap = pFont->m_eEmbeddedbitmap;
1264 - rInfo.m_eAntialias = pFont->m_eAntialias;
1265
1266 rInfo.m_bEmbeddable = (pFont->m_eType == fonttype::Type1);
1267 rInfo.m_bSubsettable = (pFont->m_eType == fonttype::TrueType); // TODO: rename to SfntType
1268 @@ -3936,8 +3932,6 @@
1269 BuiltinFont* pFont = new BuiltinFont();
1270 pFont->m_nDirectory = 0;
1271 pFont->m_bUserOverride = false;
1272 - pFont->m_eEmbeddedbitmap = fcstatus::isunset;
1273 - pFont->m_eAntialias = fcstatus::isunset;
1274 pFont->m_pMetrics = new PrintFontMetrics;
1275 memset( pFont->m_pMetrics->m_aPages, 0xff, sizeof( pFont->m_pMetrics->m_aPages ) );
1276 pFont->m_pMetrics->m_bKernPairsQueried = true;

admin@fedoraproject.org
ViewVC Help
Powered by ViewVC 1.1.2