[Libreoffice-commits] core.git: Branch 'libreoffice-5-4' - vcl/source

Khaled Hosny khaledhosny at eglug.org
Thu Nov 9 19:19:26 UTC 2017


 vcl/source/gdi/pdfwriter_impl.cxx |   14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

New commits:
commit 86707e80c32c8deeef9c0992ca3ff184f42faed7
Author: Khaled Hosny <khaledhosny at eglug.org>
Date:   Thu Nov 9 00:15:53 2017 +0200

    tdf#113428: Fix glyph positions in PDF export
    
    Not sure what is going on, but PDF export is the only place we call
    GetNextGlyphs() with nLen > 1 and it seems I broke something here in
    b894104a0b02a9b074c76feb925389d7bee6a493. Instead of trying to figure out
    what the old code was trying to do, lets just calculate glyph positions
    for the extra glyphs as GetNextGlyphs() does for the first one, making
    PDF export closer to how the rendering on screen works.
    
    Reviewed-on: https://gerrit.libreoffice.org/44514
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Khaled Hosny <khaledhosny at eglug.org>
    (cherry picked from commit fb72ec9b6222c8a18445c078c0367e7d507720af)
    
    Change-Id: I3f516e954ccfbe38abcf6985efe3bb1f998e967f
    Reviewed-on: https://gerrit.libreoffice.org/44541
    Reviewed-by: Khaled Hosny <khaledhosny at eglug.org>
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Adolfo Jayme Barrientos <fitojb at ubuntu.com>

diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx
index c0ebe40f2c88..cdbabb4ffd92 100644
--- a/vcl/source/gdi/pdfwriter_impl.cxx
+++ b/vcl/source/gdi/pdfwriter_impl.cxx
@@ -8702,16 +8702,22 @@ void PDFWriterImpl::drawLayout( SalLayout& rLayout, const OUString& rText, bool
 
         for( int i = 0; i < nGlyphs; i++ )
         {
+            // tdf#113428: calculate the position of the next glyphs the same
+            // way GetNextGlyphs() would do if we asked for a single glyph at
+            // time.
+            if (i > 0)
+            {
+                Point aPos = pGlyphs[i]->maLinearPos;
+                aPos.X() /= rLayout.GetUnitsPerPixel();
+                aPos.Y() /= rLayout.GetUnitsPerPixel();
+                aGNGlyphPos = rLayout.GetDrawPosition(aPos);
+            }
             aGlyphs.push_back( PDFGlyph( aGNGlyphPos,
                                          pGlyphWidths[i],
                                          pGlyphs[i]->maGlyphId,
                                          pMappedFontObjects[i],
                                          pMappedGlyphs[i],
                                          pGlyphs[i]->IsVertical() ) );
-            if( bVertical )
-                aGNGlyphPos.Y() += pGlyphs[i]->mnNewWidth/rLayout.GetUnitsPerPixel();
-            else
-                aGNGlyphPos.X() += pGlyphs[i]->mnNewWidth/rLayout.GetUnitsPerPixel();
         }
     }
 


More information about the Libreoffice-commits mailing list