summaryrefslogtreecommitdiff
path: root/vcl/unx/source/printergfx
diff options
context:
space:
mode:
authorPhilipp Lohmann [pl] <Philipp.Lohmann@Sun.COM>2010-01-14 19:11:13 +0100
committerPhilipp Lohmann [pl] <Philipp.Lohmann@Sun.COM>2010-01-14 19:11:13 +0100
commit0dc15d0bc9adb9dcd2a1a5deea3f952b8a4e6689 (patch)
tree1fe24b3ce25cdfece23f43d4663f1adff67b6a1d /vcl/unx/source/printergfx
parent64e8661d76db6b02396d82b7d1f28dd3088a334f (diff)
parent8765a3bf9f2926a50d0f644e4263782269abe023 (diff)
rebase to DEV300_m69
Diffstat (limited to 'vcl/unx/source/printergfx')
-rw-r--r--vcl/unx/source/printergfx/common_gfx.cxx66
-rw-r--r--vcl/unx/source/printergfx/glyphset.cxx38
2 files changed, 52 insertions, 52 deletions
diff --git a/vcl/unx/source/printergfx/common_gfx.cxx b/vcl/unx/source/printergfx/common_gfx.cxx
index 632f0d70aa2f..9b305ff323ba 100644
--- a/vcl/unx/source/printergfx/common_gfx.cxx
+++ b/vcl/unx/source/printergfx/common_gfx.cxx
@@ -7,7 +7,6 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: common_gfx.cxx,v $
- * $Revision: 1.20.18.1 $
*
* This file is part of OpenOffice.org.
*
@@ -535,68 +534,47 @@ PrinterGfx::DrawPolyLineBezier (sal_uInt32 nPoints, const Point* pPath, const BY
const sal_uInt32 nBezString = 1024;
sal_Char pString[nBezString];
- if ( maLineColor.Is() && nPoints && pPath )
+ if ( nPoints > 1 && maLineColor.Is() && pPath )
{
PSSetColor (maLineColor);
PSSetColor ();
PSSetLineWidth ();
- if (pFlgAry[0] != POLY_NORMAL) //There must be a starting point to moveto
- {
- return;
- }
- else
- {
- snprintf(pString, nBezString, "%li %li moveto\n", pPath[0].X(), pPath[0].Y());
- WritePS(mpPageBody, pString);
- }
+ snprintf(pString, nBezString, "%li %li moveto\n", pPath[0].X(), pPath[0].Y());
+ WritePS(mpPageBody, pString);
// Handle the drawing of mixed lines mixed with curves
// - a normal point followed by a normal point is a line
// - a normal point followed by 2 control points and a normal point is a curve
for (unsigned int i=1; i<nPoints;)
{
- if (pFlgAry[i+1] != POLY_CONTROL) //If the next point is a POLY_NORMAL, we're drawing a line
+ if (pFlgAry[i] != POLY_CONTROL) //If the next point is a POLY_NORMAL, we're drawing a line
{
- if (i+1 >= nPoints) return; //Make sure we don't pass the end of the array
snprintf(pString, nBezString, "%li %li lineto\n", pPath[i].X(), pPath[i].Y());
i++;
}
else //Otherwise we're drawing a spline
{
- if (i+3 >= nPoints) return; //Make sure we don't pass the end of the array
- snprintf(pString, nBezString, "%li %li %li %li %li %li curveto\n",
- pPath[i+1].X(), pPath[i+1].Y(),
- pPath[i+2].X(), pPath[i+2].Y(),
- pPath[i+3].X(), pPath[i+3].Y());
+ if (i+2 >= nPoints)
+ return; //Error: wrong sequence of contol/normal points somehow
+ if ((pFlgAry[i] == POLY_CONTROL) && (pFlgAry[i+1] == POLY_CONTROL) &&
+ (pFlgAry[i+2] != POLY_CONTROL))
+ {
+ snprintf(pString, nBezString, "%li %li %li %li %li %li curveto\n",
+ pPath[i].X(), pPath[i].Y(),
+ pPath[i+1].X(), pPath[i+1].Y(),
+ pPath[i+2].X(), pPath[i+2].Y());
+ }
+ else
+ {
+ DBG_ERROR( "PrinterGfx::DrawPolyLineBezier: Strange output" );
+ }
i+=3;
}
WritePS(mpPageBody, pString);
}
- }
-
- // if eofill and stroke, save the current path
- if( maFillColor.Is() && maLineColor.Is())
- PSGSave();
-
- // first draw area
- if( maFillColor.Is() )
- {
- PSSetColor (maFillColor);
- PSSetColor ();
- WritePS (mpPageBody, "eofill\n");
- }
-
- // restore the current path
- if( maFillColor.Is() && maLineColor.Is())
- PSGRestore();
- // now draw outlines
- if( maLineColor.Is() )
- {
- PSSetColor (maLineColor);
- PSSetColor ();
- PSSetLineWidth ();
+ // now draw outlines
WritePS (mpPageBody, "stroke\n");
}
}
@@ -635,7 +613,7 @@ PrinterGfx::DrawPolygonBezier (sal_uInt32 nPoints, const Point* pPath, const BYT
}
else
{
- fprintf(stderr, "Strange output\n");
+ DBG_ERROR( "PrinterGfx::DrawPolygonBezier: Strange output" );
}
i+=3;
}
@@ -699,9 +677,7 @@ PrinterGfx::DrawPolyPolygonBezier (sal_uInt32 nPoly, const sal_uInt32 * pPoints,
}
else
{
-#if OSL_DEBUG_LEVEL > 1
- fprintf(stderr, "Strange output\n");
-#endif
+ DBG_ERROR( "PrinterGfx::DrawPolyPolygonBezier: Strange output" );
}
j+=3;
}
diff --git a/vcl/unx/source/printergfx/glyphset.cxx b/vcl/unx/source/printergfx/glyphset.cxx
index 156517d98220..5adff6683267 100644
--- a/vcl/unx/source/printergfx/glyphset.cxx
+++ b/vcl/unx/source/printergfx/glyphset.cxx
@@ -46,6 +46,7 @@
#include <set>
#include <map>
+#include <algorithm>
using namespace vcl;
using namespace psp;
@@ -785,6 +786,17 @@ GlyphSet::PSUploadEncoding(osl::File* pOutFile, PrinterGfx &rGfx)
return sal_True;
}
+struct EncEntry
+{
+ sal_uChar aEnc;
+ long aGID;
+
+ EncEntry() : aEnc( 0 ), aGID( 0 ) {}
+
+ bool operator<( const EncEntry& rRight ) const
+ { return aEnc < rRight.aEnc; }
+};
+
static void CreatePSUploadableFont( TrueTypeFont* pSrcFont, FILE* pTmpFile,
const char* pGlyphSetName, int nGlyphCount,
/*const*/ sal_uInt16* pRequestedGlyphs, /*const*/ sal_uChar* pEncoding,
@@ -796,17 +808,29 @@ static void CreatePSUploadableFont( TrueTypeFont* pSrcFont, FILE* pTmpFile,
if( bAllowType42 )
nTargetMask |= FontSubsetInfo::TYPE42_FONT;
+ std::vector< EncEntry > aSorted( nGlyphCount, EncEntry() );
+ for( int i = 0; i < nGlyphCount; i++ )
+ {
+ aSorted[i].aEnc = pEncoding[i];
+ aSorted[i].aGID = pRequestedGlyphs[i];
+ }
+
+ std::stable_sort( aSorted.begin(), aSorted.end() );
+
+ std::vector< sal_uChar > aEncoding( nGlyphCount );
+ std::vector< long > aRequestedGlyphs( nGlyphCount );
+
+ for( int i = 0; i < nGlyphCount; i++ )
+ {
+ aEncoding[i] = aSorted[i].aEnc;
+ aRequestedGlyphs[i] = aSorted[i].aGID;
+ }
+
FontSubsetInfo aInfo;
aInfo.LoadFont( pSrcFont );
-#if 1 // TODO: remove 16bit->long conversion when input args has been changed
- long aRequestedGlyphs[256];
- for( int i = 0; i < nGlyphCount; ++i )
- aRequestedGlyphs[i] = pRequestedGlyphs[i];
-#endif
-
aInfo.CreateFontSubset( nTargetMask, pTmpFile, pGlyphSetName,
- aRequestedGlyphs, pEncoding, nGlyphCount, NULL );
+ &aRequestedGlyphs[0], &aEncoding[0], nGlyphCount, NULL );
}
sal_Bool