From dc182537b4b29b5732af65ac6806f304bfd32a23 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Uwe=20St=C3=B6hr?= Date: Thu, 25 Nov 2010 22:49:05 +0000 Subject: [PATCH] InsetTabular.cpp: fine-tune vertical table alignment to get exactly the result of the latex output git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@36494 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/insets/InsetTabular.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/insets/InsetTabular.cpp b/src/insets/InsetTabular.cpp index 478f6facc1..428228da94 100644 --- a/src/insets/InsetTabular.cpp +++ b/src/insets/InsetTabular.cpp @@ -3463,16 +3463,19 @@ void InsetTabular::metrics(MetricsInfo & mi, Dimension & dim) const tabular.row_info[r].bottom_space.inPixels(mi.base.textwidth); tabular.setRowDescent(r, maxdes + ADD_TO_HEIGHT + bottom_space); } - + + // for top-alignment the first horizontal table line must be exactly at + // the position of the base line of the surrounding text line + // for bottom alignment, the same is for the last table line switch (tabular.tabular_valignment) { case Tabular::LYX_VALIGN_BOTTOM: offset_valign_ = tabular.rowAscent(0) - tabular.height(); break; case Tabular::LYX_VALIGN_MIDDLE: - offset_valign_ = (tabular.rowAscent(0) - tabular.height()) / 2; + offset_valign_ = (- tabular.height()) / 2 + tabular.rowAscent(0); break; case Tabular::LYX_VALIGN_TOP: - offset_valign_ = 0; + offset_valign_ = tabular.rowAscent(0); break; } -- 2.39.2