summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan-Marek Glogowski <glogow@fbihome.de>2018-08-23 16:37:12 +0200
committerJan-Marek Glogowski <glogow@fbihome.de>2018-08-23 19:10:56 +0200
commitb0a5a564c359adc55f953c7545f52740e90a6e2e (patch)
treec38739d187eae4d7f77a4ae2bba73c9136bc04ec
parentb64f4847cceef666ba3c86950df729f3c94a1bd9 (diff)
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 2325f9ac789c ("fix bug in GlyphSet::DrawGlyph"), which assumed the dead / unused code was a bug, introduced by commit b157b82a6d92 ("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/59510 Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Reviewed-by: Jan-Marek Glogowski <glogow@fbihome.de> Tested-by: Jan-Marek Glogowski <glogow@fbihome.de>
-rw-r--r--vcl/inc/unx/printergfx.hxx6
-rw-r--r--vcl/unx/generic/print/genpspgraphics.cxx5
-rw-r--r--vcl/unx/generic/print/glyphset.cxx9
-rw-r--r--vcl/unx/generic/print/glyphset.hxx3
-rw-r--r--vcl/unx/generic/print/text_gfx.cxx14
5 files changed, 12 insertions, 25 deletions
diff --git a/vcl/inc/unx/printergfx.hxx b/vcl/inc/unx/printergfx.hxx
index e9603b51f2be..e6e32e461f9b 100644
--- a/vcl/inc/unx/printergfx.hxx
+++ b/vcl/inc/unx/printergfx.hxx
@@ -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);
};
diff --git a/vcl/unx/generic/print/genpspgraphics.cxx b/vcl/unx/generic/print/genpspgraphics.cxx
index 0fcaad04dc78..a9c9483890f0 100644
--- a/vcl/unx/generic/print/genpspgraphics.cxx
+++ b/vcl/unx/generic/print/genpspgraphics.cxx
@@ -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
diff --git a/vcl/unx/generic/print/glyphset.cxx b/vcl/unx/generic/print/glyphset.cxx
index 38045ce2d10a..0f259ab5b669 100644
--- a/vcl/unx/generic/print/glyphset.cxx
+++ b/vcl/unx/generic/print/glyphset.cxx
@@ -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);
}
diff --git a/vcl/unx/generic/print/glyphset.hxx b/vcl/unx/generic/print/glyphset.hxx
index ff9310523ce7..7c058dd3fc16 100644
--- a/vcl/unx/generic/print/glyphset.hxx
+++ b/vcl/unx/generic/print/glyphset.hxx
@@ -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 );
};
diff --git a/vcl/unx/generic/print/text_gfx.cxx b/vcl/unx/generic/print/text_gfx.cxx
index cf312cbcc9fe..c6528c8a34c3 100644
--- a/vcl/unx/generic/print/text_gfx.cxx
+++ b/vcl/unx/generic/print/text_gfx.cxx
@@ -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)