[Libreoffice-commits] core.git: vcl/unx

Khaled Hosny khaledhosny at eglug.org
Tue Nov 15 19:54:02 UTC 2016


 vcl/unx/generic/gdi/cairotextrender.cxx |   15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

New commits:
commit ff08ee6ab2e11360f9260462b15f5ca133007101
Author: Khaled Hosny <khaledhosny at eglug.org>
Date:   Tue Nov 15 21:47:39 2016 +0200

    tdf#103785: Correctly position vertical glyphs
    
    Change-Id: Ibd0ae230f54ada55a26d24ea865e7b93070ce2a0

diff --git a/vcl/unx/generic/gdi/cairotextrender.cxx b/vcl/unx/generic/gdi/cairotextrender.cxx
index 5d550a4..574f985 100644
--- a/vcl/unx/generic/gdi/cairotextrender.cxx
+++ b/vcl/unx/generic/gdi/cairotextrender.cxx
@@ -321,12 +321,19 @@ void CairoTextRender::DrawServerFontLayout( const GenericSalLayout& rLayout, con
             double ydiff = 0.0;
             if (nGlyphRotation == 1)
             {
-                ydiff = font_extents.ascent/nHeight;
-                xdiff = -font_extents.descent/nHeight;
                 if (SalLayout::UseCommonLayout())
                 {
-                     ydiff -= font_extents.descent/nHeight;
-                     xdiff = 0;
+                    // The y is the origin point position, but Cairo will draw
+                    // the glyph *above* that point, we need to move it down to
+                    // the glyph’s baseline.
+                    cairo_text_extents_t aExt;
+                    cairo_glyph_extents(cr, &cairo_glyphs[nStartIndex], nLen, &aExt);
+                    cairo_glyphs[nStartIndex].y += aExt.x_advance - aExt.height - aExt.y_bearing;
+                }
+                else
+                {
+                    ydiff = font_extents.ascent/nHeight;
+                    xdiff = -font_extents.descent/nHeight;
                 }
             }
             else if (nGlyphRotation == -1)


More information about the Libreoffice-commits mailing list