summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKhaled Hosny <khaledhosny@eglug.org>2018-05-01 10:50:50 +0200
committerKhaled Hosny <khaledhosny@eglug.org>2018-05-01 12:33:54 +0200
commit5ebc6786c69e930c422536947f2c16d8dffeb082 (patch)
tree9fa7c29692d7dd5721412306dd33ef5f1de209e4
parentcdef99c2b40b86db6043fa80159e140362fc1b98 (diff)
Store a pointer to GlyphItem in PDFGlyph
Instead of ad hoc bits and pieces of it as we go. Change-Id: Ife826405850efbd84d84b19cba6a80d735864d3e Reviewed-on: https://gerrit.libreoffice.org/53683 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Khaled Hosny <khaledhosny@eglug.org>
-rw-r--r--vcl/source/gdi/pdfwriter_impl.cxx17
-rw-r--r--vcl/source/gdi/pdfwriter_impl.hxx16
2 files changed, 12 insertions, 21 deletions
diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx
index a4766f502751..c10dbf1cb2f6 100644
--- a/vcl/source/gdi/pdfwriter_impl.cxx
+++ b/vcl/source/gdi/pdfwriter_impl.cxx
@@ -6382,7 +6382,7 @@ void PDFWriterImpl::drawVerticalGlyphs(
double fSkewA = 0.0;
Point aDeltaPos;
- if (rGlyphs[i].m_bVertical)
+ if (rGlyphs[i].m_pGlyph->IsVertical())
{
fDeltaAngle = M_PI/2.0;
aDeltaPos.setX( m_pReferenceDevice->GetFontMetric().GetAscent() );
@@ -6400,7 +6400,7 @@ void PDFWriterImpl::drawVerticalGlyphs(
long nOffsetY = rGlyphs[i+1].m_aPos.Y() - rGlyphs[i].m_aPos.Y();
nXOffset += static_cast<int>(sqrt(double(nOffsetX*nOffsetX + nOffsetY*nOffsetY)));
}
- if( ! rGlyphs[i].m_nGlyphId )
+ if( ! rGlyphs[i].m_pGlyph->maGlyphId )
continue;
aDeltaPos = rRotScale.transform( aDeltaPos );
@@ -6750,14 +6750,11 @@ void PDFWriterImpl::drawLayout( SalLayout& rLayout, const OUString& rText, bool
nCharPos = pGlyph->mnCharPos;
aGlyphs.emplace_back(aPos,
+ pGlyph,
nGlyphWidth,
- pGlyph->maGlyphId,
nMappedFontObject,
nMappedGlyph,
- pGlyph->IsVertical(),
- pGlyph->IsRTLGlyph(),
- nCharPos,
- pGlyph->mnCharCount);
+ nCharPos);
}
// Avoid fill color when map mode is in pixels, the below code assumes
@@ -6819,15 +6816,15 @@ void PDFWriterImpl::drawLayout( SalLayout& rLayout, const OUString& rText, bool
std::vector<PDFGlyph> aRun(aGlyphs.begin() + nStart, aGlyphs.begin() + nEnd);
int nCharPos, nCharCount;
- if (!aRun.front().m_bRTL)
+ if (!aRun.front().m_pGlyph->IsRTLGlyph())
{
nCharPos = aRun.front().m_nCharPos;
- nCharCount = aRun.front().m_nCharCount;
+ nCharCount = aRun.front().m_pGlyph->mnCharCount;
}
else
{
nCharPos = aRun.back().m_nCharPos;
- nCharCount = aRun.back().m_nCharCount;
+ nCharCount = aRun.back().m_pGlyph->mnCharCount;
}
if (nCharPos >= 0 && nCharCount)
diff --git a/vcl/source/gdi/pdfwriter_impl.hxx b/vcl/source/gdi/pdfwriter_impl.hxx
index 6635e083556f..cedc12c71805 100644
--- a/vcl/source/gdi/pdfwriter_impl.hxx
+++ b/vcl/source/gdi/pdfwriter_impl.hxx
@@ -587,28 +587,22 @@ public:
struct PDFGlyph
{
Point m_aPos;
+ const GlyphItem* m_pGlyph;
sal_Int32 m_nNativeWidth;
- sal_Int32 m_nGlyphId;
sal_Int32 m_nMappedFontId;
sal_uInt8 m_nMappedGlyphId;
- bool m_bVertical;
- bool m_bRTL;
int m_nCharPos;
int m_nCharCount;
PDFGlyph( const Point& rPos,
+ const GlyphItem* pGlyph,
sal_Int32 nNativeWidth,
- sal_Int32 nGlyphId,
sal_Int32 nFontId,
sal_uInt8 nMappedGlyphId,
- bool bVertical,
- bool bRTL,
- int nCharPos,
- int nCharCount )
- : m_aPos( rPos ), m_nNativeWidth( nNativeWidth ), m_nGlyphId( nGlyphId ),
+ int nCharPos )
+ : m_aPos( rPos ), m_pGlyph(pGlyph), m_nNativeWidth( nNativeWidth ),
m_nMappedFontId( nFontId ), m_nMappedGlyphId( nMappedGlyphId ),
- m_bVertical(bVertical), m_bRTL(bRTL),
- m_nCharPos(nCharPos), m_nCharCount(nCharCount)
+ m_nCharPos(nCharPos)
{}
};