[Libreoffice-commits] core.git: Branch 'feature/cib_contract891c' - vcl/source
Armin Le Grand (Allotropia) (via logerrit)
logerrit at kemper.freedesktop.org
Fri Aug 20 16:43:05 UTC 2021
vcl/source/gdi/pdfwriter_impl.cxx | 11 +++++++++++
1 file changed, 11 insertions(+)
New commits:
commit 2f4ed9f048b904f1228c58a20d4f4bcfb87294fd
Author: Armin Le Grand (Allotropia) <armin.le.grand at me.com>
AuthorDate: Fri Aug 20 17:51:14 2021 +0200
Commit: Armin Le Grand (Allotropia) <armin.le.grand at me.com>
CommitDate: Fri Aug 20 17:51:14 2021 +0200
AKDB-465: Correct usage of aCodeUnitsPerGlyph
aCodeUnitsPerGlyph needs to be reset together with
aCodeUnits, else if e.g. two code units for an already
created glyph exists at the beginning that will by
error be reused throughout the conversion of the
given rText. Exactly that creates the described
error. In the PDF, the /ToUnicode entry was created
wrong due to this error. With this fix the same
/ToUnicode list as in master gets created.
Change-Id: I2feb8b1cb7d3bbaf3372ed369ab3b4b470071d4e
diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx
index 62f75b8a82ae..19ba5b76c3a3 100644
--- a/vcl/source/gdi/pdfwriter_impl.cxx
+++ b/vcl/source/gdi/pdfwriter_impl.cxx
@@ -8662,6 +8662,17 @@ void PDFWriterImpl::drawLayout( SalLayout& rLayout, const OUString& rText, bool
while ((nGlyphs = rLayout.GetNextGlyphs(nTmpMaxGlyphs, pGlyphs, aGNGlyphPos, nIndex, pFallbackFonts)) != 0)
{
aCodeUnits.clear();
+
+ // AKDB-465 aCodeUnitsPerGlyph needs to be reset here, too, else the
+ // units per glyph from former texts *will* wrongly be reused.
+ // Experimented by not using aCodeUnits.data() & aCodeUnitsPerGlyph.data()
+ // for the call to registerGlyphs below directly, but adding a live-offset
+ // to these. That again would make it necessary to also grow aCodeUnits
+ // all the time and the offsets would be not the same for both.
+ // Went out to be too complicated. AFAIU the simple solution below does
+ // not loose needed infos, so go with it. ProoveOfConcept: it works.
+ aCodeUnitsPerGlyph.clear();
+
for( int i = 0; i < nGlyphs; i++ )
{
// default case: 1 glyph is one unicode
More information about the Libreoffice-commits
mailing list