Re: [LyX/master] Aesthetics: off-by-one in line drawing
On Tue, Sep 11, 2018 at 09:49:24AM +0200, Jean-Marc Lasgouttes wrote: > Le 11/09/2018 à 02:48, Scott Kostyshak a écrit : > > > Scott, would you say it is worth backporting? > > > > I would say only if we want testing (I use the 2.3.x branch the most). > > So we do not really care, right? No, but I appreciate your asking. > Let's skip it, then. Sounds good. Scott signature.asc Description: PGP signature
Re: [LyX/master] Aesthetics: off-by-one in line drawing
Le 11/09/2018 à 02:48, Scott Kostyshak a écrit : Scott, would you say it is worth backporting? I would say only if we want testing (I use the 2.3.x branch the most). So we do not really care, right? Let's skip it, then. JMarc
Re: [LyX/master] Aesthetics: off-by-one in line drawing
On Mon, Sep 10, 2018 at 03:05:43PM +0200, Jean-Marc Lasgouttes wrote: > Le 23/07/2018 à 17:19, Jean-Marc Lasgouttes a écrit : > > commit ad954a32a525828bd03bf2c8241252e60394cbc3 > > Author: Jean-Marc Lasgouttes > > Date: Mon Jul 23 17:07:48 2018 +0200 > > > > Aesthetics: off-by-one in line drawing > > It is a general problem when doing graphics to know where a line > > begins and where it ends pixel-wise. At the instigation of Scott, and > > with the use of the kmag magnifier, this commit corrects 3 areas: > > * foreign marks were larger than the row element they were supposed to > >mark. This could lead to moving lines, depending on paint ordering. > > * visible spaces were drawn outside of their box (select a single > >space to see this). > > * the `L' blinking caret would leave a cursor dropping because the > >horizontal part was too wide. > > Scott, would you say it is worth backporting? I would say only if we want testing (I use the 2.3.x branch the most). Scott signature.asc Description: PGP signature
Re: [LyX/master] Aesthetics: off-by-one in line drawing
Le 23/07/2018 à 17:19, Jean-Marc Lasgouttes a écrit : commit ad954a32a525828bd03bf2c8241252e60394cbc3 Author: Jean-Marc Lasgouttes Date: Mon Jul 23 17:07:48 2018 +0200 Aesthetics: off-by-one in line drawing It is a general problem when doing graphics to know where a line begins and where it ends pixel-wise. At the instigation of Scott, and with the use of the kmag magnifier, this commit corrects 3 areas: * foreign marks were larger than the row element they were supposed to mark. This could lead to moving lines, depending on paint ordering. * visible spaces were drawn outside of their box (select a single space to see this). * the `L' blinking caret would leave a cursor dropping because the horizontal part was too wide. Scott, would you say it is worth backporting? JMarc --- src/RowPainter.cpp|2 +- src/frontends/qt4/GuiWorkArea.cpp |4 ++-- src/insets/InsetSpace.cpp | 12 ++-- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/RowPainter.cpp b/src/RowPainter.cpp index 16b144e..efc4021 100644 --- a/src/RowPainter.cpp +++ b/src/RowPainter.cpp @@ -159,7 +159,7 @@ void RowPainter::paintForeignMark(Row::Element const & e) const int const desc = e.inset ? e.dim.descent() : 0; int const y = yo_ + min(3 * pi_.base.solidLineOffset() / 2 + desc, row_.descent() - 1); - pi_.pain.line(int(x_), y, int(x_ + e.full_width()), y, Color_language, + pi_.pain.line(int(x_), y, int(x_ + e.full_width() - 1), y, Color_language, Painter::line_solid, pi_.base.solidLineThickness()); } diff --git a/src/frontends/qt4/GuiWorkArea.cpp b/src/frontends/qt4/GuiWorkArea.cpp index e6d993c..45c4469 100644 --- a/src/frontends/qt4/GuiWorkArea.cpp +++ b/src/frontends/qt4/GuiWorkArea.cpp @@ -150,9 +150,9 @@ public: painter.setPen(color_); if (l_shape_) { if (rtl_) - painter.drawLine(x_, bot, x_ - l, bot); + painter.drawLine(x_, bot, x_ - l + 1, bot); else - painter.drawLine(x_, bot, x_ + caret_width_ + r, bot); + painter.drawLine(x_, bot, x_ + caret_width_ + r - 1, bot); } // draw completion triangle diff --git a/src/insets/InsetSpace.cpp b/src/insets/InsetSpace.cpp index fd8c261..ddb85b7 100644 --- a/src/insets/InsetSpace.cpp +++ b/src/insets/InsetSpace.cpp @@ -355,18 +355,18 @@ void InsetSpace::draw(PainterInfo & pi, int x, int y) const int const h = theFontMetrics(pi.base.font).xHeight(); int xp[4], yp[4]; - xp[0] = x; + xp[0] = x + 1; yp[0] = y - max(h / 4, 1); if (params_.kind == InsetSpaceParams::NORMAL || params_.kind == InsetSpaceParams::PROTECTED || params_.kind == InsetSpaceParams::VISIBLE) { - xp[1] = x; yp[1] = y; - xp[2] = x + w; yp[2] = y; + xp[1] = x + 1; yp[1] = y; + xp[2] = x + w - 2; yp[2] = y; } else { - xp[1] = x; yp[1] = y + max(h / 4, 1); - xp[2] = x + w; yp[2] = y + max(h / 4, 1); + xp[1] = x + 1; yp[1] = y + max(h / 4, 1); + xp[2] = x + w - 2; yp[2] = y + max(h / 4, 1); } - xp[3] = x + w; + xp[3] = x + w - 2; yp[3] = y - max(h / 4, 1); Color col = Color_special;
Re: [LyX/master] Aesthetics: off-by-one in line drawing
Le 24/07/2018 à 04:51, Richard Kimberly Heck a écrit : I am sure thee are other off-by-one errors like that, keep them coming Riki, assuming that Scott's eyes hurt less now, this is candidate for branch. Your choice, 2.3.1 or 2.3.2. Riki, Can I also backport the following commit? It is the vertical equivalent of the off-by-one thing and they touch the same code. JMarc commit 8e9e05067014a7c5fad501a0f4e8ffbb56eed165 Author: Jean-Marc Lasgouttes Date: Fri Jul 20 15:23:55 2018 +0200 Fix disappearing blue language underline. Make sure that the blue language underline is not below the bottom of the row. Otherwise, it can disappear when the next row is painted.
Re: [LyX/master] Aesthetics: off-by-one in line drawing
Le 24/07/2018 à 03:46, Scott Kostyshak a écrit : Riki, assuming that Scott's eyes hurt less now, this is candidate for branch. It would bother me if I came across it in my work-related documents, but I only came across the issue when looking into something else, so there's no rush on my behalf. I was just kidding. These things are very simple, so I will put them in 2.3.1. JMarc
Re: [LyX/master] Aesthetics: off-by-one in line drawing
On 07/23/2018 11:19 AM, Jean-Marc Lasgouttes wrote: > Le 23/07/2018 à 17:19, Jean-Marc Lasgouttes a écrit : >> commit ad954a32a525828bd03bf2c8241252e60394cbc3 >> Author: Jean-Marc Lasgouttes >> Date: Mon Jul 23 17:07:48 2018 +0200 >> >> Aesthetics: off-by-one in line drawing >> It is a general problem when doing graphics to know where a >> line >> begins and where it ends pixel-wise. At the instigation of >> Scott, and >> with the use of the kmag magnifier, this commit corrects 3 areas: >> * foreign marks were larger than the row element they were >> supposed to >> mark. This could lead to moving lines, depending on paint >> ordering. >> * visible spaces were drawn outside of their box (select a >> single >> space to see this). >> * the `L' blinking caret would leave a cursor dropping >> because the >> horizontal part was too wide. > > I am sure thee are other off-by-one errors like that, keep them coming > > Riki, assuming that Scott's eyes hurt less now, this is candidate for > branch. Your choice, 2.3.1 or 2.3.2. Riki
Re: [LyX/master] Aesthetics: off-by-one in line drawing
On Mon, Jul 23, 2018 at 03:19:51PM +, Jean-Marc Lasgouttes wrote: > Le 23/07/2018 à 17:19, Jean-Marc Lasgouttes a écrit : > > commit ad954a32a525828bd03bf2c8241252e60394cbc3 > > Author: Jean-Marc Lasgouttes > > Date: Mon Jul 23 17:07:48 2018 +0200 > > > > Aesthetics: off-by-one in line drawing > > It is a general problem when doing graphics to know where a line > > begins and where it ends pixel-wise. At the instigation of Scott, and > > with the use of the kmag magnifier, this commit corrects 3 areas: > > * foreign marks were larger than the row element they were supposed to > >mark. This could lead to moving lines, depending on paint ordering. > > * visible spaces were drawn outside of their box (select a single > >space to see this). > > * the `L' blinking caret would leave a cursor dropping because the > >horizontal part was too wide. > > I am sure thee are other off-by-one errors like that, keep them coming Thanks, just tested briefly and works well! > Riki, assuming that Scott's eyes hurt less now, this is candidate for > branch. It would bother me if I came across it in my work-related documents, but I only came across the issue when looking into something else, so there's no rush on my behalf. Scott signature.asc Description: PGP signature
Re: [LyX/master] Aesthetics: off-by-one in line drawing
Le 23/07/2018 à 17:19, Jean-Marc Lasgouttes a écrit : commit ad954a32a525828bd03bf2c8241252e60394cbc3 Author: Jean-Marc Lasgouttes Date: Mon Jul 23 17:07:48 2018 +0200 Aesthetics: off-by-one in line drawing It is a general problem when doing graphics to know where a line begins and where it ends pixel-wise. At the instigation of Scott, and with the use of the kmag magnifier, this commit corrects 3 areas: * foreign marks were larger than the row element they were supposed to mark. This could lead to moving lines, depending on paint ordering. * visible spaces were drawn outside of their box (select a single space to see this). * the `L' blinking caret would leave a cursor dropping because the horizontal part was too wide. I am sure thee are other off-by-one errors like that, keep them coming Riki, assuming that Scott's eyes hurt less now, this is candidate for branch. JMarc --- src/RowPainter.cpp|2 +- src/frontends/qt4/GuiWorkArea.cpp |4 ++-- src/insets/InsetSpace.cpp | 12 ++-- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/RowPainter.cpp b/src/RowPainter.cpp index 16b144e..efc4021 100644 --- a/src/RowPainter.cpp +++ b/src/RowPainter.cpp @@ -159,7 +159,7 @@ void RowPainter::paintForeignMark(Row::Element const & e) const int const desc = e.inset ? e.dim.descent() : 0; int const y = yo_ + min(3 * pi_.base.solidLineOffset() / 2 + desc, row_.descent() - 1); - pi_.pain.line(int(x_), y, int(x_ + e.full_width()), y, Color_language, + pi_.pain.line(int(x_), y, int(x_ + e.full_width() - 1), y, Color_language, Painter::line_solid, pi_.base.solidLineThickness()); } diff --git a/src/frontends/qt4/GuiWorkArea.cpp b/src/frontends/qt4/GuiWorkArea.cpp index e6d993c..45c4469 100644 --- a/src/frontends/qt4/GuiWorkArea.cpp +++ b/src/frontends/qt4/GuiWorkArea.cpp @@ -150,9 +150,9 @@ public: painter.setPen(color_); if (l_shape_) { if (rtl_) - painter.drawLine(x_, bot, x_ - l, bot); + painter.drawLine(x_, bot, x_ - l + 1, bot); else - painter.drawLine(x_, bot, x_ + caret_width_ + r, bot); + painter.drawLine(x_, bot, x_ + caret_width_ + r - 1, bot); } // draw completion triangle diff --git a/src/insets/InsetSpace.cpp b/src/insets/InsetSpace.cpp index fd8c261..ddb85b7 100644 --- a/src/insets/InsetSpace.cpp +++ b/src/insets/InsetSpace.cpp @@ -355,18 +355,18 @@ void InsetSpace::draw(PainterInfo & pi, int x, int y) const int const h = theFontMetrics(pi.base.font).xHeight(); int xp[4], yp[4]; - xp[0] = x; + xp[0] = x + 1; yp[0] = y - max(h / 4, 1); if (params_.kind == InsetSpaceParams::NORMAL || params_.kind == InsetSpaceParams::PROTECTED || params_.kind == InsetSpaceParams::VISIBLE) { - xp[1] = x; yp[1] = y; - xp[2] = x + w; yp[2] = y; + xp[1] = x + 1; yp[1] = y; + xp[2] = x + w - 2; yp[2] = y; } else { - xp[1] = x; yp[1] = y + max(h / 4, 1); - xp[2] = x + w; yp[2] = y + max(h / 4, 1); + xp[1] = x + 1; yp[1] = y + max(h / 4, 1); + xp[2] = x + w - 2; yp[2] = y + max(h / 4, 1); } - xp[3] = x + w; + xp[3] = x + w - 2; yp[3] = y - max(h / 4, 1); Color col = Color_special;