summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--vcl/generic/print/genpspgraphics.cxx16
-rw-r--r--vcl/headless/svptext.cxx3
-rw-r--r--vcl/inc/cairotextrender.hxx1
-rw-r--r--vcl/inc/generic/genpspgraphics.h3
-rw-r--r--vcl/inc/headless/svpgdi.hxx1
-rw-r--r--vcl/inc/quartz/salgdi.h1
-rw-r--r--vcl/inc/salgdi.hxx6
-rw-r--r--vcl/inc/textrender.hxx1
-rw-r--r--vcl/inc/unx/salgdi.h1
-rw-r--r--vcl/inc/win/salgdi.h1
-rw-r--r--vcl/quartz/salgdi.cxx1
-rw-r--r--vcl/source/gdi/embeddedfontshelper.cxx8
-rw-r--r--vcl/source/gdi/pdfwriter_impl.cxx5
-rw-r--r--vcl/unx/generic/gdi/cairotextrender.cxx4
-rw-r--r--vcl/unx/generic/gdi/salgdi3.cxx4
-rw-r--r--vcl/win/source/gdi/salgdi3.cxx4
16 files changed, 32 insertions, 28 deletions
diff --git a/vcl/generic/print/genpspgraphics.cxx b/vcl/generic/print/genpspgraphics.cxx
index f9a6e3a5bec0..2269bcbd54c3 100644
--- a/vcl/generic/print/genpspgraphics.cxx
+++ b/vcl/generic/print/genpspgraphics.cxx
@@ -1226,7 +1226,7 @@ void GenPspGraphics::DoFreeEmbedFontData( const void* pData, long nLen )
#endif
}
-const void* GenPspGraphics::DoGetEmbedFontData( psp::fontID aFont, const sal_Ucs* pUnicodes, sal_Int32* pWidths, FontSubsetInfo& rInfo, long* pDataLen )
+const void* GenPspGraphics::DoGetEmbedFontData( psp::fontID aFont, const sal_Ucs* pUnicodes, sal_Int32* pWidths, size_t nLen, FontSubsetInfo& rInfo, long* pDataLen )
{
psp::PrintFontManager& rMgr = psp::PrintFontManager::get();
@@ -1243,15 +1243,15 @@ const void* GenPspGraphics::DoGetEmbedFontData( psp::fontID aFont, const sal_Ucs
int xMin, yMin, xMax, yMax;
rMgr.getFontBoundingBox( aFont, xMin, yMin, xMax, yMax );
- psp::CharacterMetric aMetrics[256];
- sal_Ucs aUnicodes[256];
+ psp::CharacterMetric aMetrics[nLen];
+ sal_Ucs aUnicodes[nLen];
if( aFontInfo.m_aEncoding == RTL_TEXTENCODING_SYMBOL && aFontInfo.m_eType == psp::fonttype::Type1 )
{
- for( int i = 0; i < 256; i++ )
+ for (size_t i = 0; i < nLen; ++i)
aUnicodes[i] = pUnicodes[i] < 0x0100 ? pUnicodes[i] + 0xf000 : pUnicodes[i];
pUnicodes = aUnicodes;
}
- if( ! rMgr.getMetrics( aFont, pUnicodes, 256, aMetrics ) )
+ if (!rMgr.getMetrics(aFont, pUnicodes, nLen, aMetrics))
return NULL;
OString aSysPath = rMgr.getFontFileSysPath( aFont );
@@ -1294,7 +1294,7 @@ const void* GenPspGraphics::DoGetEmbedFontData( psp::fontID aFont, const sal_Ucs
rInfo.m_aFontBBox = Rectangle( Point( xMin, yMin ), Size( xMax-xMin, yMax-yMin ) );
rInfo.m_nCapHeight = yMax; // Well ...
- for( int i = 0; i < 256; i++ )
+ for (size_t i = 0; i < nLen; ++i)
pWidths[i] = (aMetrics[i].width > 0 ? aMetrics[i].width : 0);
switch( aFontInfo.m_eType )
@@ -1320,7 +1320,7 @@ void GenPspGraphics::FreeEmbedFontData( const void* pData, long nLen )
DoFreeEmbedFontData( pData, nLen );
}
-const void* GenPspGraphics::GetEmbedFontData( const PhysicalFontFace* pFont, const sal_Ucs* pUnicodes, sal_Int32* pWidths, FontSubsetInfo& rInfo, long* pDataLen )
+const void* GenPspGraphics::GetEmbedFontData( const PhysicalFontFace* pFont, const sal_Ucs* pUnicodes, sal_Int32* pWidths, size_t nLen, FontSubsetInfo& rInfo, long* pDataLen )
{
// in this context the pFont->GetFontId() is a valid PSP
// font since they are the only ones left after the PDF
@@ -1328,7 +1328,7 @@ const void* GenPspGraphics::GetEmbedFontData( const PhysicalFontFace* pFont, con
// which this method was created). The correct way would
// be to have the GlyphCache search for the PhysicalFontFace pFont
psp::fontID aFont = pFont->GetFontId();
- return DoGetEmbedFontData( aFont, pUnicodes, pWidths, rInfo, pDataLen );
+ return DoGetEmbedFontData(aFont, pUnicodes, pWidths, nLen, rInfo, pDataLen);
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/headless/svptext.cxx b/vcl/headless/svptext.cxx
index 8fc51ced7ddb..84a35e103325 100644
--- a/vcl/headless/svptext.cxx
+++ b/vcl/headless/svptext.cxx
@@ -336,6 +336,7 @@ const void* SvpSalGraphics::GetEmbedFontData(
const PhysicalFontFace* pFont,
const sal_Ucs* pUnicodes,
sal_Int32* pWidths,
+ size_t nLen,
FontSubsetInfo& rInfo,
long* pDataLen
)
@@ -346,7 +347,7 @@ const void* SvpSalGraphics::GetEmbedFontData(
// which this method was created). The correct way would
// be to have the GlyphCache search for the PhysicalFontFace pFont
psp::fontID aFont = pFont->GetFontId();
- return GenPspGraphics::DoGetEmbedFontData( aFont, pUnicodes, pWidths, rInfo, pDataLen );
+ return GenPspGraphics::DoGetEmbedFontData( aFont, pUnicodes, pWidths, nLen, rInfo, pDataLen );
}
void SvpSalGraphics::FreeEmbedFontData( const void* pData, long nLen )
diff --git a/vcl/inc/cairotextrender.hxx b/vcl/inc/cairotextrender.hxx
index d59d75cd2036..d94596847ee5 100644
--- a/vcl/inc/cairotextrender.hxx
+++ b/vcl/inc/cairotextrender.hxx
@@ -114,6 +114,7 @@ public:
const PhysicalFontFace*,
const sal_Ucs* pUnicodes,
sal_Int32* pWidths,
+ size_t nLen,
FontSubsetInfo& rInfo,
long* pDataLen ) SAL_OVERRIDE;
diff --git a/vcl/inc/generic/genpspgraphics.h b/vcl/inc/generic/genpspgraphics.h
index 34782382afb1..b4ac3137e5d9 100644
--- a/vcl/inc/generic/genpspgraphics.h
+++ b/vcl/inc/generic/genpspgraphics.h
@@ -54,7 +54,7 @@ public:
// helper methods
static const void * DoGetEmbedFontData ( psp::fontID aFont, const sal_Ucs* pUnicodes,
- sal_Int32* pWidths, FontSubsetInfo& rInfo,
+ sal_Int32* pWidths, size_t nLen, FontSubsetInfo& rInfo,
long* pDataLen );
static void DoFreeEmbedFontData( const void* pData, long nLen );
@@ -111,6 +111,7 @@ public:
virtual const void* GetEmbedFontData( const PhysicalFontFace*,
const sal_Ucs* pUnicodes,
sal_Int32* pWidths,
+ size_t nLen,
FontSubsetInfo& rInfo,
long* pDataLen ) SAL_OVERRIDE;
virtual void FreeEmbedFontData( const void* pData, long nDataLen ) SAL_OVERRIDE;
diff --git a/vcl/inc/headless/svpgdi.hxx b/vcl/inc/headless/svpgdi.hxx
index 39f81767725e..dc0c62ffd7c4 100644
--- a/vcl/inc/headless/svpgdi.hxx
+++ b/vcl/inc/headless/svpgdi.hxx
@@ -131,6 +131,7 @@ public:
virtual const void* GetEmbedFontData( const PhysicalFontFace*,
const sal_Ucs* pUnicodes,
sal_Int32* pWidths,
+ size_t nLen,
FontSubsetInfo& rInfo,
long* pDataLen ) SAL_OVERRIDE;
virtual void FreeEmbedFontData( const void* pData, long nDataLen ) SAL_OVERRIDE;
diff --git a/vcl/inc/quartz/salgdi.h b/vcl/inc/quartz/salgdi.h
index 87c35c1fa7da..9c9c741d93cc 100644
--- a/vcl/inc/quartz/salgdi.h
+++ b/vcl/inc/quartz/salgdi.h
@@ -393,6 +393,7 @@ public:
virtual const void* GetEmbedFontData( const PhysicalFontFace*,
const sal_Ucs* pUnicodes,
sal_Int32* pWidths,
+ size_t nLen,
FontSubsetInfo& rInfo,
long* pDataLen ) SAL_OVERRIDE;
// frees the font data again
diff --git a/vcl/inc/salgdi.hxx b/vcl/inc/salgdi.hxx
index 17e2233f85b9..b42e0b4a2ea1 100644
--- a/vcl/inc/salgdi.hxx
+++ b/vcl/inc/salgdi.hxx
@@ -193,16 +193,16 @@ public:
// GetEmbedFontData: gets the font data for a font marked
// embeddable by GetDevFontList or NULL in case of error
// parameters: pFont: describes the font in question
- // pUnicodes: contains the Unicodes assigned to
- // code points 0 to 255; must contain at least 256 members
+ // pUnicodes: contains the Unicodes assigned to code points 0 to 255
// pWidths: the widths of all glyphs from char code 0 to 255
- // pWidths MUST support at least 256 members;
+ // nLen: the number of elements in each of pWidths and pUnicodes
// rInfo: additional outgoing information
// pDataLen: out parameter, contains the byte length of the returned buffer
virtual const void* GetEmbedFontData(
const PhysicalFontFace* pFont,
const sal_Ucs* pUnicodes,
sal_Int32* pWidths,
+ size_t nLen,
FontSubsetInfo& rInfo,
long* pDataLen ) = 0;
diff --git a/vcl/inc/textrender.hxx b/vcl/inc/textrender.hxx
index bdb55bdfb486..4a635c5d1543 100644
--- a/vcl/inc/textrender.hxx
+++ b/vcl/inc/textrender.hxx
@@ -64,6 +64,7 @@ public:
const PhysicalFontFace*,
const sal_Ucs* pUnicodes,
sal_Int32* pWidths,
+ size_t nLen,
FontSubsetInfo& rInfo,
long* pDataLen ) = 0;
diff --git a/vcl/inc/unx/salgdi.h b/vcl/inc/unx/salgdi.h
index 2ca876e82614..4486e8cb928c 100644
--- a/vcl/inc/unx/salgdi.h
+++ b/vcl/inc/unx/salgdi.h
@@ -138,6 +138,7 @@ public:
const PhysicalFontFace*,
const sal_Ucs* pUnicodes,
sal_Int32* pWidths,
+ size_t nLen,
FontSubsetInfo& rInfo,
long* pDataLen ) SAL_OVERRIDE;
diff --git a/vcl/inc/win/salgdi.h b/vcl/inc/win/salgdi.h
index 6ce3a6118cd0..5ff953061498 100644
--- a/vcl/inc/win/salgdi.h
+++ b/vcl/inc/win/salgdi.h
@@ -423,6 +423,7 @@ public:
virtual const void* GetEmbedFontData( const PhysicalFontFace*,
const sal_Ucs* pUnicodes,
sal_Int32* pWidths,
+ size_t nLen,
FontSubsetInfo& rInfo,
long* pDataLen );
// frees the font data again
diff --git a/vcl/quartz/salgdi.cxx b/vcl/quartz/salgdi.cxx
index 2cb8271c570c..49ad051dacbf 100644
--- a/vcl/quartz/salgdi.cxx
+++ b/vcl/quartz/salgdi.cxx
@@ -738,6 +738,7 @@ const Ucs2SIntMap* AquaSalGraphics::GetFontEncodingVector(
const void* AquaSalGraphics::GetEmbedFontData( const PhysicalFontFace*,
const sal_Ucs* /*pUnicodes*/,
sal_Int32* /*pWidths*/,
+ size_t /*nLen*/,
FontSubsetInfo&,
long* /*pDataLen*/ )
{
diff --git a/vcl/source/gdi/embeddedfontshelper.cxx b/vcl/source/gdi/embeddedfontshelper.cxx
index 037cfcf9d0a0..ba67e76f8c64 100644
--- a/vcl/source/gdi/embeddedfontshelper.cxx
+++ b/vcl/source/gdi/embeddedfontshelper.cxx
@@ -265,15 +265,9 @@ OUString EmbeddedFontsHelper::fontFileUrl( const OUString& familyName, FontFamil
}
if( selected != NULL )
{
- sal_Ucs unicodes[ 256 ];
- for( int i = 0;
- i < 256;
- ++i )
- unicodes[ i ] = 'A'; // Just something, not needed, but GetEmbedFontData() needs it.
- sal_Int32 widths[ 256 ];
FontSubsetInfo info;
long size;
- if( const void* data = graphics->GetEmbedFontData( selected, unicodes, widths, info, &size ))
+ if( const void* data = graphics->GetEmbedFontData( selected, NULL, NULL, 0, info, &size ))
{
if( sufficientTTFRights( data, size, rights ))
{
diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx
index 528a74c330fc..2affdd43f237 100644
--- a/vcl/source/gdi/pdfwriter_impl.cxx
+++ b/vcl/source/gdi/pdfwriter_impl.cxx
@@ -2969,7 +2969,8 @@ std::map< sal_Int32, sal_Int32 > PDFWriterImpl::emitSystemFont( const PhysicalFo
sal_Ucs nEncodedCodes[256];
sal_Int32 pEncWidths[256];
- pFontData = (const unsigned char*)pGraphics->GetEmbedFontData( pFont, nEncodedCodes, pEncWidths, aInfo, &nFontLen );
+ //TODO: surely this is utterly broken because GetEmbedFontData loops over the uninitialized nEncodedCodes as input
+ pFontData = (const unsigned char*)pGraphics->GetEmbedFontData( pFont, nEncodedCodes, pEncWidths, 256, aInfo, &nFontLen );
if( pFontData )
{
@@ -3147,7 +3148,7 @@ std::map< sal_Int32, sal_Int32 > PDFWriterImpl::emitEmbeddedFont( const Physical
sal_Int32 nLength1, nLength2;
try
{
- if( (pFontData = (const unsigned char*)pGraphics->GetEmbedFontData( pFont, nEncodedCodes, pWidths, aInfo, &nFontLen )) != NULL )
+ if( (pFontData = (const unsigned char*)pGraphics->GetEmbedFontData(pFont, nEncodedCodes, pWidths, 256, aInfo, &nFontLen)) != NULL )
{
if( (aInfo.m_nFontType & FontSubsetInfo::ANY_TYPE1) == 0 )
throw FontException();
diff --git a/vcl/unx/generic/gdi/cairotextrender.cxx b/vcl/unx/generic/gdi/cairotextrender.cxx
index 7b0438ea49bf..2e83c39ca5cd 100644
--- a/vcl/unx/generic/gdi/cairotextrender.cxx
+++ b/vcl/unx/generic/gdi/cairotextrender.cxx
@@ -621,7 +621,7 @@ bool CairoTextRender::CreateFontSubset(
return bSuccess;
}
-const void* CairoTextRender::GetEmbedFontData( const PhysicalFontFace* pFont, const sal_Ucs* pUnicodes, sal_Int32* pWidths, FontSubsetInfo& rInfo, long* pDataLen )
+const void* CairoTextRender::GetEmbedFontData( const PhysicalFontFace* pFont, const sal_Ucs* pUnicodes, sal_Int32* pWidths, size_t nLen, FontSubsetInfo& rInfo, long* pDataLen )
{
// in this context the pFont->GetFontId() is a valid PSP
// font since they are the only ones left after the PDF
@@ -629,7 +629,7 @@ const void* CairoTextRender::GetEmbedFontData( const PhysicalFontFace* pFont, co
// which this method was created). The correct way would
// be to have the GlyphCache search for the PhysicalFontFace pFont
psp::fontID aFont = pFont->GetFontId();
- return GenPspGraphics::DoGetEmbedFontData( aFont, pUnicodes, pWidths, rInfo, pDataLen );
+ return GenPspGraphics::DoGetEmbedFontData( aFont, pUnicodes, pWidths, nLen, rInfo, pDataLen );
}
void CairoTextRender::FreeEmbedFontData( const void* pData, long nLen )
diff --git a/vcl/unx/generic/gdi/salgdi3.cxx b/vcl/unx/generic/gdi/salgdi3.cxx
index f0a69ee406e2..6f5eadff7979 100644
--- a/vcl/unx/generic/gdi/salgdi3.cxx
+++ b/vcl/unx/generic/gdi/salgdi3.cxx
@@ -177,9 +177,9 @@ bool X11SalGraphics::CreateFontSubset(
pGlyphIds, pEncoding, pWidths, nGlyphCount, rInfo);
}
-const void* X11SalGraphics::GetEmbedFontData( const PhysicalFontFace* pFont, const sal_Ucs* pUnicodes, sal_Int32* pWidths, FontSubsetInfo& rInfo, long* pDataLen )
+const void* X11SalGraphics::GetEmbedFontData( const PhysicalFontFace* pFont, const sal_Ucs* pUnicodes, sal_Int32* pWidths, size_t nLen, FontSubsetInfo& rInfo, long* pDataLen )
{
- return mpTextRenderImpl->GetEmbedFontData(pFont, pUnicodes, pWidths, rInfo, pDataLen);
+ return mpTextRenderImpl->GetEmbedFontData(pFont, pUnicodes, pWidths, nLen, rInfo, pDataLen);
}
void X11SalGraphics::FreeEmbedFontData( const void* pData, long nLen )
diff --git a/vcl/win/source/gdi/salgdi3.cxx b/vcl/win/source/gdi/salgdi3.cxx
index 01e31a1066b3..763e2ea7ee90 100644
--- a/vcl/win/source/gdi/salgdi3.cxx
+++ b/vcl/win/source/gdi/salgdi3.cxx
@@ -2596,7 +2596,7 @@ bool WinSalGraphics::CreateFontSubset( const OUString& rToFile,
}
const void* WinSalGraphics::GetEmbedFontData( const PhysicalFontFace* pFont,
- const sal_Unicode* pUnicodes, sal_Int32* pCharWidths,
+ const sal_Unicode* pUnicodes, sal_Int32* pCharWidths, size_t nLen,
FontSubsetInfo& rInfo, long* pDataLen )
{
// create matching FontSelectPattern
@@ -2634,7 +2634,7 @@ const void* WinSalGraphics::GetEmbedFontData( const PhysicalFontFace* pFont,
rInfo.m_nCapHeight = aTm.tmAscent; // Well ...
// get individual character widths
- for( int i = 0; i < 256; ++i )
+ for (size_t i = 0; i < nLen; ++i)
{
int nCharWidth = 0;
const sal_Unicode cChar = pUnicodes[i];