summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan-Marek Glogowski <glogow@fbihome.de>2018-08-23 16:37:12 +0200
committerCaolán McNamara <caolanm@redhat.com>2018-08-27 08:57:54 +0200
commitfeed12d932ffa9c5d76868a384c6ccea8eb095b4 (patch)
treed8dc7992b5195965a5897c932310450ae977ac2e
parent83c5d42fe04d1cee30d4c683da3e1919a9915e44 (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> (cherry picked from commit b0a5a564c359adc55f953c7545f52740e90a6e2e) Reviewed-on: https://gerrit.libreoffice.org/59545 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com> (cherry picked from commit 447b5706355d6b8e257e63925bf5818e7e963aeb) Reviewed-on: https://gerrit.libreoffice.org/59632
-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 5d0eeeaa405a..eb094f64b733 100644
--- a/vcl/unx/generic/print/genpspgraphics.cxx
+++ b/vcl/unx/generic/print/genpspgraphics.cxx
@@ -571,10 +571,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 b6e94afc1978..e019049f5d4e 100644
--- a/vcl/unx/generic/print/glyphset.cxx
+++ b/vcl/unx/generic/print/glyphset.cxx
@@ -176,8 +176,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;
@@ -185,14 +184,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 a8484bd7a5a8..de1792d9ff5d 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)