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:
PrintFontManager& GetFontMgr () { return mrFontMgr; }
void drawGlyph(const Point& rPoint,
sal_GlyphId aGlyphId,
sal_Int32 nDelta);
sal_GlyphId aGlyphId);
public:
PrinterGfx();
~PrinterGfx();
......@@ -336,8 +335,7 @@ public:
{ maTextColor = rTextColor; }
void DrawGlyph(const Point& rPoint,
const GlyphItem& rGlyph,
sal_Int32 nDelta);
const GlyphItem& rGlyph);
};
......
......@@ -570,10 +570,7 @@ void GenPspGraphics::DrawTextLayout(const GenericSalLayout& rLayout)
Point aPos;
int nStart = 0;
while (rLayout.GetNextGlyph(&pGlyph, aPos, nStart))
{
sal_Int32 nAdvance = pGlyph->mnNewWidth / rLayout.GetUnitsPerPixel();
m_pPrinterGfx->DrawGlyph(aPos, *pGlyph, nAdvance);
}
m_pPrinterGfx->DrawGlyph(aPos, *pGlyph);
}
const FontCharMapRef GenPspGraphics::GetFontCharMap() const
......
......@@ -174,8 +174,7 @@ GlyphSet::GetReencodedFontName (rtl_TextEncoding nEnc, const OString &rFontName)
void GlyphSet::DrawGlyph(PrinterGfx& rGfx,
const Point& rPoint,
const sal_GlyphId nGlyphId,
const sal_Int32 nDelta)
const sal_GlyphId nGlyphId)
{
unsigned char nGlyphID;
sal_Int32 nGlyphSetID;
......@@ -183,14 +182,10 @@ void GlyphSet::DrawGlyph(PrinterGfx& rGfx,
// convert to font glyph id and font subset
GetGlyphID (nGlyphId, &nGlyphID, &nGlyphSetID);
// show the text using the PrinterGfx text api
Point aPoint = rPoint;
aPoint.Move (nDelta, 0);
OString aGlyphSetName = GetGlyphSetName(nGlyphSetID);
rGfx.PSSetFont (aGlyphSetName, RTL_TEXTENCODING_DONTKNOW);
rGfx.PSMoveTo (aPoint);
rGfx.PSMoveTo (rPoint);
rGfx.PSShowGlyph(nGlyphID);
}
......
......@@ -74,8 +74,7 @@ public:
void DrawGlyph (PrinterGfx& rGfx,
const Point& rPoint,
const sal_GlyphId nGlyphId,
const sal_Int32 nDelta);
const sal_GlyphId nGlyphId);
void PSUploadFont (osl::File& rOutFile, PrinterGfx &rGfx, bool bAsType42, std::vector< OString >& rSuppliedFonts );
};
......
......@@ -60,8 +60,7 @@ void PrinterGfx::SetFont(
}
void PrinterGfx::drawGlyph(const Point& rPoint,
sal_GlyphId aGlyphId,
sal_Int32 nDelta)
sal_GlyphId aGlyphId)
{
// draw the string
......@@ -71,7 +70,7 @@ void PrinterGfx::drawGlyph(const Point& rPoint,
if ( (elem.GetFontID() == mnFontID)
&& (elem.IsVertical() == mbTextVertical))
{
elem.DrawGlyph (*this, rPoint, aGlyphId, nDelta);
elem.DrawGlyph (*this, rPoint, aGlyphId);
bGlyphFound = true;
break;
}
......@@ -80,13 +79,12 @@ void PrinterGfx::drawGlyph(const Point& rPoint,
if (!bGlyphFound)
{
maPS3Font.emplace_back(mnFontID, mbTextVertical);
maPS3Font.back().DrawGlyph (*this, rPoint, aGlyphId, nDelta);
maPS3Font.back().DrawGlyph (*this, rPoint, aGlyphId);
}
}
void PrinterGfx::DrawGlyph(const Point& rPoint,
const GlyphItem& rGlyph,
sal_Int32 nDelta)
const GlyphItem& rGlyph)
{
// move and rotate the user coordinate system
// avoid the gsave/grestore for the simple cases since it allows
......@@ -125,14 +123,14 @@ void PrinterGfx::DrawGlyph(const Point& rPoint,
PSTranslate( aPoint );
PSRotate (900);
// draw the rotated glyph
drawGlyph(aRotPoint, rGlyph.maGlyphId, 0);
drawGlyph(aRotPoint, rGlyph.maGlyphId);
// restore previous state
maVirtualStatus = aSaveStatus;
PSGRestore();
}
else
drawGlyph(aPoint, rGlyph.maGlyphId, nDelta);
drawGlyph(aPoint, rGlyph.maGlyphId);
// restore the user coordinate system
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