Kaydet (Commit) b0a5a564 authored tarafından Jan-Marek Glogowski's avatar Jan-Marek Glogowski

tdf#119454 don't advance PS glyphs

The glyphs from SalLayout already have the correct position, so
one doesn't have to advance them.
This is why PS glyphs were positioned "off-by-one", which is
especially visible, if your test document has words with spaces.
"dm d" was almost rendered / printed as "d md".

This is a regression from commit 2325f9ac ("fix bug in
GlyphSet::DrawGlyph"), which assumed the dead / unused code was
a bug, introduced by commit b157b82a ("Use GlyphItem in more
places"), which out of luck, seem to have been correct.

Since nobody uses the advance anywhere, just drop the parameter.

Change-Id: I40e8f99a98f84d48446a9190566af8cfe441cd88
Reviewed-on: https://gerrit.libreoffice.org/59510Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
Reviewed-by: 's avatarJan-Marek Glogowski <glogow@fbihome.de>
Tested-by: 's avatarJan-Marek Glogowski <glogow@fbihome.de>
üst b64f4847
...@@ -256,8 +256,7 @@ public: ...@@ -256,8 +256,7 @@ public:
PrintFontManager& GetFontMgr () { return mrFontMgr; } PrintFontManager& GetFontMgr () { return mrFontMgr; }
void drawGlyph(const Point& rPoint, void drawGlyph(const Point& rPoint,
sal_GlyphId aGlyphId, sal_GlyphId aGlyphId);
sal_Int32 nDelta);
public: public:
PrinterGfx(); PrinterGfx();
~PrinterGfx(); ~PrinterGfx();
...@@ -336,8 +335,7 @@ public: ...@@ -336,8 +335,7 @@ public:
{ maTextColor = rTextColor; } { maTextColor = rTextColor; }
void DrawGlyph(const Point& rPoint, void DrawGlyph(const Point& rPoint,
const GlyphItem& rGlyph, const GlyphItem& rGlyph);
sal_Int32 nDelta);
}; };
......
...@@ -570,10 +570,7 @@ void GenPspGraphics::DrawTextLayout(const GenericSalLayout& rLayout) ...@@ -570,10 +570,7 @@ void GenPspGraphics::DrawTextLayout(const GenericSalLayout& rLayout)
Point aPos; Point aPos;
int nStart = 0; int nStart = 0;
while (rLayout.GetNextGlyph(&pGlyph, aPos, nStart)) while (rLayout.GetNextGlyph(&pGlyph, aPos, nStart))
{ m_pPrinterGfx->DrawGlyph(aPos, *pGlyph);
sal_Int32 nAdvance = pGlyph->mnNewWidth / rLayout.GetUnitsPerPixel();
m_pPrinterGfx->DrawGlyph(aPos, *pGlyph, nAdvance);
}
} }
const FontCharMapRef GenPspGraphics::GetFontCharMap() const const FontCharMapRef GenPspGraphics::GetFontCharMap() const
......
...@@ -174,8 +174,7 @@ GlyphSet::GetReencodedFontName (rtl_TextEncoding nEnc, const OString &rFontName) ...@@ -174,8 +174,7 @@ GlyphSet::GetReencodedFontName (rtl_TextEncoding nEnc, const OString &rFontName)
void GlyphSet::DrawGlyph(PrinterGfx& rGfx, void GlyphSet::DrawGlyph(PrinterGfx& rGfx,
const Point& rPoint, const Point& rPoint,
const sal_GlyphId nGlyphId, const sal_GlyphId nGlyphId)
const sal_Int32 nDelta)
{ {
unsigned char nGlyphID; unsigned char nGlyphID;
sal_Int32 nGlyphSetID; sal_Int32 nGlyphSetID;
...@@ -183,14 +182,10 @@ void GlyphSet::DrawGlyph(PrinterGfx& rGfx, ...@@ -183,14 +182,10 @@ void GlyphSet::DrawGlyph(PrinterGfx& rGfx,
// convert to font glyph id and font subset // convert to font glyph id and font subset
GetGlyphID (nGlyphId, &nGlyphID, &nGlyphSetID); GetGlyphID (nGlyphId, &nGlyphID, &nGlyphSetID);
// show the text using the PrinterGfx text api
Point aPoint = rPoint;
aPoint.Move (nDelta, 0);
OString aGlyphSetName = GetGlyphSetName(nGlyphSetID); OString aGlyphSetName = GetGlyphSetName(nGlyphSetID);
rGfx.PSSetFont (aGlyphSetName, RTL_TEXTENCODING_DONTKNOW); rGfx.PSSetFont (aGlyphSetName, RTL_TEXTENCODING_DONTKNOW);
rGfx.PSMoveTo (aPoint); rGfx.PSMoveTo (rPoint);
rGfx.PSShowGlyph(nGlyphID); rGfx.PSShowGlyph(nGlyphID);
} }
......
...@@ -74,8 +74,7 @@ public: ...@@ -74,8 +74,7 @@ public:
void DrawGlyph (PrinterGfx& rGfx, void DrawGlyph (PrinterGfx& rGfx,
const Point& rPoint, const Point& rPoint,
const sal_GlyphId nGlyphId, const sal_GlyphId nGlyphId);
const sal_Int32 nDelta);
void PSUploadFont (osl::File& rOutFile, PrinterGfx &rGfx, bool bAsType42, std::vector< OString >& rSuppliedFonts ); void PSUploadFont (osl::File& rOutFile, PrinterGfx &rGfx, bool bAsType42, std::vector< OString >& rSuppliedFonts );
}; };
......
...@@ -60,8 +60,7 @@ void PrinterGfx::SetFont( ...@@ -60,8 +60,7 @@ void PrinterGfx::SetFont(
} }
void PrinterGfx::drawGlyph(const Point& rPoint, void PrinterGfx::drawGlyph(const Point& rPoint,
sal_GlyphId aGlyphId, sal_GlyphId aGlyphId)
sal_Int32 nDelta)
{ {
// draw the string // draw the string
...@@ -71,7 +70,7 @@ void PrinterGfx::drawGlyph(const Point& rPoint, ...@@ -71,7 +70,7 @@ void PrinterGfx::drawGlyph(const Point& rPoint,
if ( (elem.GetFontID() == mnFontID) if ( (elem.GetFontID() == mnFontID)
&& (elem.IsVertical() == mbTextVertical)) && (elem.IsVertical() == mbTextVertical))
{ {
elem.DrawGlyph (*this, rPoint, aGlyphId, nDelta); elem.DrawGlyph (*this, rPoint, aGlyphId);
bGlyphFound = true; bGlyphFound = true;
break; break;
} }
...@@ -80,13 +79,12 @@ void PrinterGfx::drawGlyph(const Point& rPoint, ...@@ -80,13 +79,12 @@ void PrinterGfx::drawGlyph(const Point& rPoint,
if (!bGlyphFound) if (!bGlyphFound)
{ {
maPS3Font.emplace_back(mnFontID, mbTextVertical); maPS3Font.emplace_back(mnFontID, mbTextVertical);
maPS3Font.back().DrawGlyph (*this, rPoint, aGlyphId, nDelta); maPS3Font.back().DrawGlyph (*this, rPoint, aGlyphId);
} }
} }
void PrinterGfx::DrawGlyph(const Point& rPoint, void PrinterGfx::DrawGlyph(const Point& rPoint,
const GlyphItem& rGlyph, const GlyphItem& rGlyph)
sal_Int32 nDelta)
{ {
// move and rotate the user coordinate system // move and rotate the user coordinate system
// avoid the gsave/grestore for the simple cases since it allows // avoid the gsave/grestore for the simple cases since it allows
...@@ -125,14 +123,14 @@ void PrinterGfx::DrawGlyph(const Point& rPoint, ...@@ -125,14 +123,14 @@ void PrinterGfx::DrawGlyph(const Point& rPoint,
PSTranslate( aPoint ); PSTranslate( aPoint );
PSRotate (900); PSRotate (900);
// draw the rotated glyph // draw the rotated glyph
drawGlyph(aRotPoint, rGlyph.maGlyphId, 0); drawGlyph(aRotPoint, rGlyph.maGlyphId);
// restore previous state // restore previous state
maVirtualStatus = aSaveStatus; maVirtualStatus = aSaveStatus;
PSGRestore(); PSGRestore();
} }
else else
drawGlyph(aPoint, rGlyph.maGlyphId, nDelta); drawGlyph(aPoint, rGlyph.maGlyphId);
// restore the user coordinate system // restore the user coordinate system
if (nCurrentTextAngle != 0) if (nCurrentTextAngle != 0)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment