summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKhaled Hosny <khaledhosny@eglug.org>2016-11-15 21:47:39 +0200
committerKhaled Hosny <khaledhosny@eglug.org>2016-11-15 21:52:15 +0200
commitff08ee6ab2e11360f9260462b15f5ca133007101 (patch)
tree660f0244690051cf133a6ecde88b0e69fe062551
parent087705c72dcf555951c49b95476568adbab74edf (diff)
tdf#103785: Correctly position vertical glyphs
Change-Id: Ibd0ae230f54ada55a26d24ea865e7b93070ce2a0
-rw-r--r--vcl/unx/generic/gdi/cairotextrender.cxx15
1 files changed, 11 insertions, 4 deletions
diff --git a/vcl/unx/generic/gdi/cairotextrender.cxx b/vcl/unx/generic/gdi/cairotextrender.cxx
index 5d550a4819a0..574f985f3f85 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)