/[packages]/cauldron/libreoffice/pristine/SOURCES/0001-rhbz-1177022-vcl-fix-PDF-embedding-of-Type-1-fonts.patch
ViewVC logotype

Contents of /cauldron/libreoffice/pristine/SOURCES/0001-rhbz-1177022-vcl-fix-PDF-embedding-of-Type-1-fonts.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 812930 - (show annotations) (download)
Sat Jan 31 22:00:57 2015 UTC (8 years, 1 month ago) by schedbot
File size: 25302 byte(s)
Copying release 4.4.0.3-6.mga5 to pristine/ directory.
1 From 509c57e91c324decada94ac1f70a58fdf52a6372 Mon Sep 17 00:00:00 2001
2 From: Michael Stahl <mstahl@redhat.com>
3 Date: Tue, 27 Jan 2015 00:20:58 +0100
4 Subject: [PATCH] rhbz#1177022: vcl: fix PDF embedding of Type 1 fonts
5
6 Problem is that for the "CM Typewriter" font the Width for "space" (32)
7 is exported as 0 instead of 525, which is the correct value in the AFM.
8
9 The reason is that PDFWriterImpl::emitEmbeddedFont() has various arrays
10 to map from font code points to Unicode code points, and there are
11 duplicate mappings, so the 160->32 mapping overrides 32->32.
12
13 The PrintFontManager::PrintFont::readAfmMetrics() actually creates a
14 Unicode to font code mapping (which may legitimately be n:1) that is
15 then inverted; add an additional hack to store a set of "preferred"
16 Unicodes so that PDFWriterImpl can pick the right Unicode.
17
18 Presumably the code that is stored explicitly via "C" or "CH" in the
19 AFM should take priority over more generic mappings.
20
21 Conflicts:
22 vcl/inc/cairotextrender.hxx
23 vcl/inc/textrender.hxx
24 vcl/inc/unx/salgdi.h
25 vcl/source/gdi/pdfwriter_impl.cxx
26
27 Change-Id: Id4205a1cd45ba6a0a5facee1e39f70c3535e7dd4
28 ---
29 vcl/generic/fontmanager/fontmanager.cxx | 25 +++++++++++++++++++++-
30 vcl/generic/print/genpspgraphics.cxx | 8 +++----
31 vcl/headless/svptext.cxx | 4 ++--
32 vcl/inc/cairotextrender.hxx | 2 +-
33 vcl/inc/fontmanager.hxx | 7 ++++++-
34 vcl/inc/generic/genpspgraphics.h | 6 ++++--
35 vcl/inc/headless/svpgdi.hxx | 2 +-
36 vcl/inc/quartz/salgdi.h | 2 +-
37 vcl/inc/salgdi.hxx | 4 +++-
38 vcl/inc/textrender.hxx | 2 +-
39 vcl/inc/unx/salgdi.h | 2 +-
40 vcl/inc/win/salgdi.h | 2 +-
41 vcl/quartz/salgdi.cxx | 2 +-
42 vcl/source/gdi/pdfwriter_impl.cxx | 37 +++++++++++++++++++++++++++++++--
43 vcl/unx/generic/gdi/cairotextrender.cxx | 4 ++--
44 vcl/unx/generic/gdi/salgdi3.cxx | 4 ++--
45 vcl/win/source/gdi/salgdi3.cxx | 2 +-
46 17 files changed, 90 insertions(+), 25 deletions(-)
47
48 diff --git a/vcl/generic/fontmanager/fontmanager.cxx b/vcl/generic/fontmanager/fontmanager.cxx
49 index 33fb4ed..d5b481f 100644
50 --- a/vcl/generic/fontmanager/fontmanager.cxx
51 +++ b/vcl/generic/fontmanager/fontmanager.cxx
52 @@ -291,6 +291,7 @@ bool PrintFontManager::PrintFont::readAfmMetrics( MultiAtomProvider* pProvider,
53 }
54
55 m_aEncodingVector.clear();
56 + m_aEncodingVectorPriority.clear();
57 // fill in global info
58
59 // PSName
60 @@ -504,7 +505,10 @@ bool PrintFontManager::PrintFont::readAfmMetrics( MultiAtomProvider* pProvider,
61 {
62 pUnicodes[i] = pChar->code + 0xf000;
63 if( bFillEncodingvector )
64 + {
65 m_aEncodingVector[ pUnicodes[i] ] = pChar->code;
66 + m_aEncodingVectorPriority.insert(pUnicodes[i]);
67 + }
68 continue;
69 }
70
71 @@ -565,7 +569,10 @@ bool PrintFontManager::PrintFont::readAfmMetrics( MultiAtomProvider* pProvider,
72 {
73 m_pMetrics->m_aMetrics[ pUnicodes[i] ] = aMetric;
74 if( bFillEncodingvector )
75 + {
76 m_aEncodingVector[ pUnicodes[i] ] = pChar->code;
77 + m_aEncodingVectorPriority.insert(pUnicodes[i]);
78 + }
79 }
80 else if( pChar->name )
81 {
82 @@ -593,13 +600,21 @@ bool PrintFontManager::PrintFont::readAfmMetrics( MultiAtomProvider* pProvider,
83 ::std::pair< ::boost::unordered_multimap< sal_uInt8, sal_Unicode >::const_iterator,
84 ::boost::unordered_multimap< sal_uInt8, sal_Unicode >::const_iterator >
85 aCodes = rManager.getUnicodeFromAdobeCode( pChar->code );
86 + bool bFirst = true;
87 while( aCodes.first != aCodes.second )
88 {
89 if( (*aCodes.first).second != 0 )
90 {
91 m_pMetrics->m_aMetrics[ (*aCodes.first).second ] = aMetric;
92 if( bFillEncodingvector )
93 + {
94 m_aEncodingVector[ (*aCodes.first).second ] = pChar->code;
95 + if (bFirst) // arbitrarily prefer the first one
96 + {
97 + m_aEncodingVectorPriority.insert((*aCodes.first).second);
98 + bFirst = false;
99 + }
100 + }
101 }
102 ++aCodes.first;
103 }
104 @@ -613,7 +628,10 @@ bool PrintFontManager::PrintFont::readAfmMetrics( MultiAtomProvider* pProvider,
105 m_pMetrics->m_aMetrics[ code ] = aMetric;
106 // maybe should try to find the name in the convtabs ?
107 if( bFillEncodingvector )
108 + {
109 m_aEncodingVector[ code ] = pChar->code;
110 + m_aEncodingVectorPriority.insert(code);
111 + }
112 }
113 }
114 }
115 @@ -2140,7 +2158,7 @@ void PrintFontManager::getGlyphWidths( fontID nFont,
116 }
117 }
118
119 -const std::map< sal_Unicode, sal_Int32 >* PrintFontManager::getEncodingMap( fontID nFont, const std::map< sal_Unicode, OString >** pNonEncoded ) const
120 +const std::map< sal_Unicode, sal_Int32 >* PrintFontManager::getEncodingMap( fontID nFont, const std::map< sal_Unicode, OString >** pNonEncoded, std::set<sal_Unicode> const** ppPriority ) const
121 {
122 PrintFont* pFont = getFont( nFont );
123 if( !pFont || pFont->m_eType != fonttype::Type1 )
124 @@ -2152,6 +2170,11 @@ const std::map< sal_Unicode, sal_Int32 >* PrintFontManager::getEncodingMap( font
125 if( pNonEncoded )
126 *pNonEncoded = pFont->m_aNonEncoded.size() ? &pFont->m_aNonEncoded : NULL;
127
128 + if (ppPriority)
129 + {
130 + *ppPriority = &pFont->m_aEncodingVectorPriority;
131 + }
132 +
133 return pFont->m_aEncodingVector.size() ? &pFont->m_aEncodingVector : NULL;
134 }
135
136 diff --git a/vcl/generic/print/genpspgraphics.cxx b/vcl/generic/print/genpspgraphics.cxx
137 index 1e63ab0..58991c3 100644
138 --- a/vcl/generic/print/genpspgraphics.cxx
139 +++ b/vcl/generic/print/genpspgraphics.cxx
140 @@ -1009,7 +1009,7 @@ bool GenPspGraphics::CreateFontSubset(
141 return bSuccess;
142 }
143
144 -const Ucs2SIntMap* GenPspGraphics::GetFontEncodingVector( const PhysicalFontFace* pFont, const Ucs2OStrMap** pNonEncoded )
145 +const Ucs2SIntMap* GenPspGraphics::GetFontEncodingVector( const PhysicalFontFace* pFont, const Ucs2OStrMap** pNonEncoded, std::set<sal_Unicode> const** ppPriority)
146 {
147 // in this context the pFont->GetFontId() is a valid PSP
148 // font since they are the only ones left after the PDF
149 @@ -1017,7 +1017,7 @@ const Ucs2SIntMap* GenPspGraphics::GetFontEncodingVector( const PhysicalFontFace
150 // which this method was created). The correct way would
151 // be to have the GlyphCache search for the PhysicalFontFace pFont
152 psp::fontID aFont = pFont->GetFontId();
153 - return GenPspGraphics::DoGetFontEncodingVector( aFont, pNonEncoded );
154 + return GenPspGraphics::DoGetFontEncodingVector( aFont, pNonEncoded, ppPriority );
155 }
156
157 void GenPspGraphics::GetGlyphWidths( const PhysicalFontFace* pFont,
158 @@ -1034,7 +1034,7 @@ void GenPspGraphics::GetGlyphWidths( const PhysicalFontFace* pFont,
159 GenPspGraphics::DoGetGlyphWidths( aFont, bVertical, rWidths, rUnicodeEnc );
160 }
161
162 -const Ucs2SIntMap* GenPspGraphics::DoGetFontEncodingVector( fontID aFont, const Ucs2OStrMap** pNonEncoded )
163 +const Ucs2SIntMap* GenPspGraphics::DoGetFontEncodingVector( fontID aFont, const Ucs2OStrMap** pNonEncoded, std::set<sal_Unicode> const** ppPriority)
164 {
165 psp::PrintFontManager& rMgr = psp::PrintFontManager::get();
166
167 @@ -1046,7 +1046,7 @@ const Ucs2SIntMap* GenPspGraphics::DoGetFontEncodingVector( fontID aFont, const
168 return NULL;
169 }
170
171 - return rMgr.getEncodingMap( aFont, pNonEncoded );
172 + return rMgr.getEncodingMap( aFont, pNonEncoded, ppPriority );
173 }
174
175 void GenPspGraphics::DoGetGlyphWidths( psp::fontID aFont,
176 diff --git a/vcl/headless/svptext.cxx b/vcl/headless/svptext.cxx
177 index 8fc51ce..5fb0af8 100644
178 --- a/vcl/headless/svptext.cxx
179 +++ b/vcl/headless/svptext.cxx
180 @@ -321,7 +321,7 @@ bool SvpSalGraphics::CreateFontSubset(
181 return bSuccess;
182 }
183
184 -const Ucs2SIntMap* SvpSalGraphics::GetFontEncodingVector( const PhysicalFontFace* pFont, const Ucs2OStrMap** pNonEncoded )
185 +const Ucs2SIntMap* SvpSalGraphics::GetFontEncodingVector( const PhysicalFontFace* pFont, const Ucs2OStrMap** pNonEncoded, std::set<sal_Unicode> const** ppPriority)
186 {
187 // in this context the pFont->GetFontId() is a valid PSP
188 // font since they are the only ones left after the PDF
189 @@ -329,7 +329,7 @@ const Ucs2SIntMap* SvpSalGraphics::GetFontEncodingVector( const PhysicalFontFace
190 // which this method was created). The correct way would
191 // be to have the GlyphCache search for the PhysicalFontFace pFont
192 psp::fontID aFont = pFont->GetFontId();
193 - return GenPspGraphics::DoGetFontEncodingVector( aFont, pNonEncoded );
194 + return GenPspGraphics::DoGetFontEncodingVector(aFont, pNonEncoded, ppPriority);
195 }
196
197 const void* SvpSalGraphics::GetEmbedFontData(
198 diff --git a/vcl/inc/cairotextrender.hxx b/vcl/inc/cairotextrender.hxx
199 index 2b8a21e..fdbc001 100644
200 --- a/vcl/inc/cairotextrender.hxx
201 +++ b/vcl/inc/cairotextrender.hxx
202 @@ -104,7 +104,7 @@ public:
203 int nGlyphs,
204 FontSubsetInfo& rInfo
205 ) SAL_OVERRIDE;
206 - virtual const Ucs2SIntMap* GetFontEncodingVector( const PhysicalFontFace*, const Ucs2OStrMap** ppNonEncoded ) SAL_OVERRIDE;
207 + virtual const Ucs2SIntMap* GetFontEncodingVector( const PhysicalFontFace*, const Ucs2OStrMap** ppNonEncoded, std::set<sal_Unicode> const** ) SAL_OVERRIDE;
208 virtual const void* GetEmbedFontData( const PhysicalFontFace*,
209 const sal_Ucs* pUnicodes,
210 sal_Int32* pWidths,
211 diff --git a/vcl/inc/fontmanager.hxx b/vcl/inc/fontmanager.hxx
212 index e1203bd..0091849 100644
213 --- a/vcl/inc/fontmanager.hxx
214 +++ b/vcl/inc/fontmanager.hxx
215 @@ -202,7 +202,12 @@ class VCL_PLUGIN_PUBLIC PrintFontManager
216 bool m_bHaveVerticalSubstitutedGlyphs;
217 bool m_bUserOverride;
218
219 + /// mapping from unicode (well, UCS-2) to font code
220 std::map< sal_Unicode, sal_Int32 > m_aEncodingVector;
221 + /// HACK for Type 1 fonts: if multiple UCS-2 codes map to the same
222 + /// font code, this set contains the preferred one, i.e., the one that
223 + /// is specified explicitly via "C" or "CH" in the AFM file
224 + std::set<sal_Unicode> m_aEncodingVectorPriority;
225 std::map< sal_Unicode, OString > m_aNonEncoded;
226
227 explicit PrintFont( fonttype::type eType );
228 @@ -438,7 +443,7 @@ public:
229 // if ppNonEncoded is set and non encoded type1 glyphs exist
230 // then *ppNonEncoded is set to the mapping for nonencoded glyphs.
231 // the encoding vector contains -1 for non encoded glyphs
232 - const std::map< sal_Unicode, sal_Int32 >* getEncodingMap( fontID nFontID, const std::map< sal_Unicode, OString >** ppNonEncoded ) const;
233 + const std::map< sal_Unicode, sal_Int32 >* getEncodingMap( fontID nFontID, const std::map< sal_Unicode, OString >** ppNonEncoded, std::set<sal_Unicode> const ** ppPriority ) const;
234
235 // evaluates copyright flags for TrueType fonts for printing/viewing
236 // type1 fonts do not have such a feature, so return for them is true
237 diff --git a/vcl/inc/generic/genpspgraphics.h b/vcl/inc/generic/genpspgraphics.h
238 index 18a434f..b2cf527 100644
239 --- a/vcl/inc/generic/genpspgraphics.h
240 +++ b/vcl/inc/generic/genpspgraphics.h
241 @@ -60,7 +60,8 @@ public:
242
243 // helper methods for sharing with X11SalGraphics
244 static const Ucs2SIntMap* DoGetFontEncodingVector( psp::fontID aFont,
245 - const Ucs2OStrMap** pNonEncoded );
246 + const Ucs2OStrMap** pNonEncoded,
247 + std::set<sal_Unicode> const** ppPriority);
248 static void DoGetGlyphWidths( psp::fontID aFont,
249 bool bVertical,
250 Int32Vector& rWidths,
251 @@ -107,7 +108,8 @@ public:
252 int nGlyphs,
253 FontSubsetInfo& rInfo ) SAL_OVERRIDE;
254 virtual const Ucs2SIntMap* GetFontEncodingVector( const PhysicalFontFace*,
255 - const Ucs2OStrMap** ppNonEncoded ) SAL_OVERRIDE;
256 + const Ucs2OStrMap** ppNonEncoded,
257 + std::set<sal_Unicode> const** ppPriority) SAL_OVERRIDE;
258 virtual const void* GetEmbedFontData( const PhysicalFontFace*,
259 const sal_Ucs* pUnicodes,
260 sal_Int32* pWidths,
261 diff --git a/vcl/inc/headless/svpgdi.hxx b/vcl/inc/headless/svpgdi.hxx
262 index 9ae3d05..87bf5e0e 100644
263 --- a/vcl/inc/headless/svpgdi.hxx
264 +++ b/vcl/inc/headless/svpgdi.hxx
265 @@ -176,7 +176,7 @@ public:
266 int nGlyphs,
267 FontSubsetInfo& rInfo
268 ) SAL_OVERRIDE;
269 - virtual const Ucs2SIntMap* GetFontEncodingVector( const PhysicalFontFace*, const Ucs2OStrMap** ppNonEncoded ) SAL_OVERRIDE;
270 + virtual const Ucs2SIntMap* GetFontEncodingVector( const PhysicalFontFace*, const Ucs2OStrMap** ppNonEncoded, std::set<sal_Unicode> const** ) SAL_OVERRIDE;
271 virtual const void* GetEmbedFontData( const PhysicalFontFace*,
272 const sal_Ucs* pUnicodes,
273 sal_Int32* pWidths,
274 diff --git a/vcl/inc/quartz/salgdi.h b/vcl/inc/quartz/salgdi.h
275 index 9a5d4da..e9c51cbd 100644
276 --- a/vcl/inc/quartz/salgdi.h
277 +++ b/vcl/inc/quartz/salgdi.h
278 @@ -368,7 +368,7 @@ public:
279 // glyphs with only a name) exist it is set to the corresponding
280 // map for non encoded glyphs; the encoding vector contains -1
281 // as encoding for these cases
282 - virtual const Ucs2SIntMap* GetFontEncodingVector( const PhysicalFontFace*, const Ucs2OStrMap** ppNonEncoded ) SAL_OVERRIDE;
283 + virtual const Ucs2SIntMap* GetFontEncodingVector( const PhysicalFontFace*, const Ucs2OStrMap** ppNonEncoded, std::set<sal_Unicode> const** ) SAL_OVERRIDE;
284
285 // GetEmbedFontData: gets the font data for a font marked
286 // embeddable by GetDevFontList or NULL in case of error
287 diff --git a/vcl/inc/salgdi.hxx b/vcl/inc/salgdi.hxx
288 index ff6271c..2849cc1 100644
289 --- a/vcl/inc/salgdi.hxx
290 +++ b/vcl/inc/salgdi.hxx
291 @@ -34,6 +34,7 @@
292 #include "sallayout.hxx"
293
294 #include <map>
295 +#include <set>
296
297 class PhysicalFontCollection;
298 class SalBitmap;
299 @@ -188,7 +189,8 @@ public:
300 // as encoding for these cases
301 virtual const Ucs2SIntMap* GetFontEncodingVector(
302 const PhysicalFontFace*,
303 - const Ucs2OStrMap** ppNonEncoded ) = 0;
304 + const Ucs2OStrMap** ppNonEncoded,
305 + std::set<sal_Unicode> const** ppPriority) = 0;
306
307 // GetEmbedFontData: gets the font data for a font marked
308 // embeddable by GetDevFontList or NULL in case of error
309 diff --git a/vcl/inc/textrender.hxx b/vcl/inc/textrender.hxx
310 index f4dcc83..48f1a74 100644
311 --- a/vcl/inc/textrender.hxx
312 +++ b/vcl/inc/textrender.hxx
313 @@ -58,7 +58,7 @@ public:
314 int nGlyphs,
315 FontSubsetInfo& rInfo
316 ) = 0;
317 - virtual const Ucs2SIntMap* GetFontEncodingVector( const PhysicalFontFace*, const Ucs2OStrMap** ppNonEncoded ) = 0;
318 + virtual const Ucs2SIntMap* GetFontEncodingVector( const PhysicalFontFace*, const Ucs2OStrMap** ppNonEncoded, std::set<sal_Unicode> const** ppPriority ) = 0;
319 virtual const void* GetEmbedFontData( const PhysicalFontFace*,
320 const sal_Ucs* pUnicodes,
321 sal_Int32* pWidths,
322 diff --git a/vcl/inc/unx/salgdi.h b/vcl/inc/unx/salgdi.h
323 index 29697a9..a550c96 100644
324 --- a/vcl/inc/unx/salgdi.h
325 +++ b/vcl/inc/unx/salgdi.h
326 @@ -179,7 +179,7 @@ public:
327 int nGlyphs,
328 FontSubsetInfo& rInfo
329 ) SAL_OVERRIDE;
330 - virtual const Ucs2SIntMap* GetFontEncodingVector( const PhysicalFontFace*, const Ucs2OStrMap** ppNonEncoded ) SAL_OVERRIDE;
331 + virtual const Ucs2SIntMap* GetFontEncodingVector( const PhysicalFontFace*, const Ucs2OStrMap** ppNonEncoded, std::set<sal_Unicode> const** ppPriority ) SAL_OVERRIDE;
332 virtual const void* GetEmbedFontData( const PhysicalFontFace*,
333 const sal_Ucs* pUnicodes,
334 sal_Int32* pWidths,
335 diff --git a/vcl/inc/win/salgdi.h b/vcl/inc/win/salgdi.h
336 index 5a46cb1f..358eae5 100644
337 --- a/vcl/inc/win/salgdi.h
338 +++ b/vcl/inc/win/salgdi.h
339 @@ -411,7 +411,7 @@ public:
340 // glyphs with only a name) exist it is set to the corresponding
341 // map for non encoded glyphs; the encoding vector contains -1
342 // as encoding for these cases
343 - virtual const Ucs2SIntMap* GetFontEncodingVector( const PhysicalFontFace*, const Ucs2OStrMap** ppNonEncoded );
344 + virtual const Ucs2SIntMap* GetFontEncodingVector( const PhysicalFontFace*, const Ucs2OStrMap** ppNonEncoded, std::set<sal_Unicode> const** );
345
346 // GetEmbedFontData: gets the font data for a font marked
347 // embeddable by GetDevFontList or NULL in case of error
348 diff --git a/vcl/quartz/salgdi.cxx b/vcl/quartz/salgdi.cxx
349 index 0b1ffef..79d30bf 100644
350 --- a/vcl/quartz/salgdi.cxx
351 +++ b/vcl/quartz/salgdi.cxx
352 @@ -751,7 +751,7 @@ void AquaSalGraphics::GetGlyphWidths( const PhysicalFontFace* pFontData, bool bV
353 }
354
355 const Ucs2SIntMap* AquaSalGraphics::GetFontEncodingVector(
356 - const PhysicalFontFace*, const Ucs2OStrMap** /*ppNonEncoded*/ )
357 + const PhysicalFontFace*, const Ucs2OStrMap** /*ppNonEncoded*/, std::set<sal_Unicode> const** )
358 {
359 return NULL;
360 }
361 diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx
362 index 93efd94..2ad37ce 100644
363 --- a/vcl/source/gdi/pdfwriter_impl.cxx
364 +++ b/vcl/source/gdi/pdfwriter_impl.cxx
365 @@ -3087,7 +3087,9 @@ std::map< sal_Int32, sal_Int32 > PDFWriterImpl::emitEmbeddedFont( const Physical
366 sal_Int32 nFontDescriptor = 0;
367
368 // prepare font encoding
369 - const Ucs2SIntMap* pEncoding = m_pReferenceDevice->mpGraphics->GetFontEncodingVector( pFont, NULL );
370 + std::set<sal_Unicode> const * pPriority(0);
371 + const Ucs2SIntMap *const pEncoding =
372 + m_pReferenceDevice->mpGraphics->GetFontEncodingVector( pFont, NULL, &pPriority );
373 sal_Int32 nToUnicodeStream = 0;
374 sal_uInt8 nEncoding[256];
375 sal_Ucs nEncodedCodes[256];
376 @@ -3106,6 +3108,37 @@ std::map< sal_Int32, sal_Int32 > PDFWriterImpl::emitEmbeddedFont( const Physical
377 if( it->second != -1 )
378 {
379 sal_Int32 nCode = (sal_Int32)(it->second & 0x000000ff);
380 + SAL_WARN_IF(nCode != it->second, "vcl.gdi", "emitEmbeddedFont: FIXME: cannot handle Type 1 font with code points > 256");
381 + if (nEncoding[nCode] != 0)
382 + {
383 + // should not have 2 identical mappings
384 + assert(nEncodedCodes[nCode] != it->first);
385 + if (pPriority)
386 + {
387 + bool bExist = pPriority->find(nEncodedCodes[nCode]) != pPriority->end();
388 + bool bIter = pPriority->find(it->first) != pPriority->end();
389 + SAL_WARN_IF(bExist && bIter, "vcl.gdi", "both are preferred? odd...");
390 + if (bExist)
391 + {
392 + continue;
393 + }
394 + // note: aUnicodes will contain the old one but that
395 + // does not matter because there's nothing iterating it
396 + }
397 + else
398 + {
399 + // is this fallback important? let's prefer lower one
400 + if (nEncodedCodes[nCode] < it->first)
401 + {
402 + SAL_WARN("vcl.gdi", "emitEmbeddedFont: ignoring code " << nCode << " mapping to " << it->first << " in favor of " << nEncodedCodes[nCode]);
403 + continue;
404 + }
405 + else
406 + {
407 + SAL_WARN("vcl.gdi", "emitEmbeddedFont: ignoring code " << nCode << " mapping to " << nEncodedCodes[nCode] << " in favor of " << it->first);
408 + }
409 + }
410 + }
411 nEncoding[ nCode ] = static_cast<sal_uInt8>( nCode );
412 nEncodedCodes[ nCode ] = it->first;
413 pEncToUnicodeIndex[ nCode ] = static_cast<sal_Int32>(aUnicodes.size());
414 @@ -7230,7 +7263,7 @@ bool PDFWriterImpl::registerGlyphs( int nGlyphs,
415 const Ucs2OStrMap* pNonEncoded = NULL;
416 if (!getReferenceDevice()->AcquireGraphics())
417 return false;
418 - pEncoding = m_pReferenceDevice->mpGraphics->GetFontEncodingVector( pCurrentFont, &pNonEncoded );
419 + pEncoding = m_pReferenceDevice->mpGraphics->GetFontEncodingVector( pCurrentFont, &pNonEncoded, 0);
420
421 Ucs2SIntMap::const_iterator enc_it;
422 Ucs2OStrMap::const_iterator nonenc_it;
423 diff --git a/vcl/unx/generic/gdi/cairotextrender.cxx b/vcl/unx/generic/gdi/cairotextrender.cxx
424 index 589b53a..229e408 100644
425 --- a/vcl/unx/generic/gdi/cairotextrender.cxx
426 +++ b/vcl/unx/generic/gdi/cairotextrender.cxx
427 @@ -637,7 +637,7 @@ void CairoTextRender::FreeEmbedFontData( const void* pData, long nLen )
428 GenPspGraphics::DoFreeEmbedFontData( pData, nLen );
429 }
430
431 -const Ucs2SIntMap* CairoTextRender::GetFontEncodingVector( const PhysicalFontFace* pFont, const Ucs2OStrMap** pNonEncoded )
432 +const Ucs2SIntMap* CairoTextRender::GetFontEncodingVector( const PhysicalFontFace* pFont, const Ucs2OStrMap** pNonEncoded, std::set<sal_Unicode> const** ppPriority)
433 {
434 // in this context the pFont->GetFontId() is a valid PSP
435 // font since they are the only ones left after the PDF
436 @@ -645,7 +645,7 @@ const Ucs2SIntMap* CairoTextRender::GetFontEncodingVector( const PhysicalFontFac
437 // which this method was created). The correct way would
438 // be to have the GlyphCache search for the PhysicalFontFace pFont
439 psp::fontID aFont = pFont->GetFontId();
440 - return GenPspGraphics::DoGetFontEncodingVector( aFont, pNonEncoded );
441 + return GenPspGraphics::DoGetFontEncodingVector(aFont, pNonEncoded, ppPriority);
442 }
443
444 void CairoTextRender::GetGlyphWidths( const PhysicalFontFace* pFont,
445 diff --git a/vcl/unx/generic/gdi/salgdi3.cxx b/vcl/unx/generic/gdi/salgdi3.cxx
446 index 1809923..16918a4 100644
447 --- a/vcl/unx/generic/gdi/salgdi3.cxx
448 +++ b/vcl/unx/generic/gdi/salgdi3.cxx
449 @@ -188,9 +188,9 @@ void X11SalGraphics::FreeEmbedFontData( const void* pData, long nLen )
450 mpTextRenderImpl->FreeEmbedFontData(pData, nLen);
451 }
452
453 -const Ucs2SIntMap* X11SalGraphics::GetFontEncodingVector( const PhysicalFontFace* pFont, const Ucs2OStrMap** pNonEncoded )
454 +const Ucs2SIntMap* X11SalGraphics::GetFontEncodingVector( const PhysicalFontFace* pFont, const Ucs2OStrMap** pNonEncoded, std::set<sal_Unicode> const** ppPriority)
455 {
456 - return mpTextRenderImpl->GetFontEncodingVector(pFont, pNonEncoded);
457 + return mpTextRenderImpl->GetFontEncodingVector(pFont, pNonEncoded, ppPriority);
458 }
459
460 void X11SalGraphics::GetGlyphWidths( const PhysicalFontFace* pFont,
461 diff --git a/vcl/win/source/gdi/salgdi3.cxx b/vcl/win/source/gdi/salgdi3.cxx
462 index ba3f5d7e..830538e 100644
463 --- a/vcl/win/source/gdi/salgdi3.cxx
464 +++ b/vcl/win/source/gdi/salgdi3.cxx
465 @@ -2655,7 +2655,7 @@ void WinSalGraphics::FreeEmbedFontData( const void* pData, long /*nLen*/ )
466 delete[] reinterpret_cast<char*>(const_cast<void*>(pData));
467 }
468
469 -const Ucs2SIntMap* WinSalGraphics::GetFontEncodingVector( const PhysicalFontFace* pFont, const Ucs2OStrMap** pNonEncoded )
470 +const Ucs2SIntMap* WinSalGraphics::GetFontEncodingVector( const PhysicalFontFace* pFont, const Ucs2OStrMap** pNonEncoded, std::set<sal_Unicode> const**)
471 {
472 // TODO: even for builtin fonts we get here... why?
473 if( !pFont->IsEmbeddable() )
474 --
475 1.9.3
476

  ViewVC Help
Powered by ViewVC 1.1.28