commit d371a43865ee414308a2b4e2ec4d587ccc3d13ec
Author: Jean-Marc Lasgouttes <[email protected]>
Date: Fri Jul 20 00:26:41 2018 +0200
Draw top/bottom rules heavier for booktab
This gives a better idea of the TeX output, even though the thicknesses are
not correct. Like in LaTeX, this happens only for full top/bottom rules.
(cherry picked from commit 8651cd89f6cc16c4e17f197fbbcfe979d09f01c9)
(cherry picked from commit 84328c85388cc577d8435066062ef9bbb9711af1)
---
src/insets/InsetTabular.cpp | 35 +++++++++++++++++++++--------------
status.23x | 2 ++
2 files changed, 23 insertions(+), 14 deletions(-)
diff --git a/src/insets/InsetTabular.cpp b/src/insets/InsetTabular.cpp
index ff9f5f2..101bf33 100644
--- a/src/insets/InsetTabular.cpp
+++ b/src/insets/InsetTabular.cpp
@@ -3938,35 +3938,44 @@ void InsetTabular::drawSelection(PainterInfo & pi, int
x, int y) const
}
+namespace {
+
+void tabline(PainterInfo const & pi, int x1, int y1, int x2, int y2,
+ bool drawline, bool heavy = false)
+{
+ ColorCode const col = drawline ? Color_tabularline :
Color_tabularonoffline;
+ pi.pain.line(x1, y1, x2, y2, pi.textColor(col),
+ drawline ? Painter::line_solid :
Painter::line_onoffdash,
+ (heavy ? 2 : 1) * Painter::thin_line);
+}
+
+}
+
+
void InsetTabular::drawCellLines(PainterInfo & pi, int x, int y,
row_type row, idx_type cell) const
{
y -= tabular.rowAscent(row);
int const w = tabular.cellWidth(cell);
int const h = tabular.cellHeight(cell);
- Color const linecolor = pi.textColor(Color_tabularline);
- Color const gridcolor = pi.textColor(Color_tabularonoffline);
// Top
bool drawline = tabular.topLine(cell)
|| (row > 0 && tabular.bottomLine(tabular.cellAbove(cell)));
- pi.pain.line(x, y, x + w, y,
- drawline ? linecolor : gridcolor,
- drawline ? Painter::line_solid : Painter::line_onoffdash);
+ bool heavy = tabular.use_booktabs && row == 0 &&
tabular.rowTopLine(row);
+ tabline(pi, x, y, x + w, y, drawline, heavy);
// Bottom
drawline = tabular.bottomLine(cell);
- pi.pain.line(x, y + h, x + w, y + h,
- drawline ? linecolor : gridcolor,
- drawline ? Painter::line_solid : Painter::line_onoffdash);
+ heavy = tabular.use_booktabs && row == tabular.nrows() - 1
+ && tabular.rowBottomLine(row);
+ tabline(pi, x, y + h, x + w, y + h, drawline, heavy);
// Left
col_type const col = tabular.cellColumn(cell);
drawline = tabular.leftLine(cell)
|| (col > 0 && tabular.rightLine(tabular.cellIndex(row, col -
1)));
- pi.pain.line(x, y, x, y + h,
- drawline ? linecolor : gridcolor,
- drawline ? Painter::line_solid : Painter::line_onoffdash);
+ tabline(pi, x, y, x, y + h, drawline);
// Right
x -= tabular.interColumnSpace(cell);
@@ -3977,9 +3986,7 @@ void InsetTabular::drawCellLines(PainterInfo & pi, int x,
int y,
drawline = tabular.rightLine(cell)
|| (next_cell_col < tabular.ncols()
&& tabular.leftLine(tabular.cellIndex(row,
next_cell_col)));
- pi.pain.line(x + w, y, x + w, y + h,
- drawline ? linecolor : gridcolor,
- drawline ? Painter::line_solid : Painter::line_onoffdash);
+ tabline(pi, x + w, y, x + w, y + h, drawline);
}
diff --git a/status.23x b/status.23x
index ad33297..fbd2fcf 100644
--- a/status.23x
+++ b/status.23x
@@ -49,6 +49,8 @@ What's new
- Allow to change multiple table columns' width at once (bug 11205).
+- When using formal tables, draw top/bottom rules thicker when adequate.
+
* DOCUMENTATION AND LOCALIZATION