Re: alpha dot
On Wed, Feb 15, 2017 at 01:18:41PM +0100, Guillaume Munch wrote: > I have a series of patches (attached) that make the decoration thickness > increase with zoom, to improve the appearance on high-dpi. The > decorations do not look worse than without the added thickness. I have > not committed it yet because I have not found a way to keep it simple, > and there are still some issues. But you might like to try them. The patch works well for me. It is fun to see how the decorations look zoomed in. > For \dot in particular it looks like a square rather than a line. Agreed. Scott signature.asc Description: PGP signature
Re: alpha dot
Le 15/02/2017 à 13:46, Guenter Milde a écrit : On 2017-02-15, Guillaume Munch wrote: [-- Type: text/plain, Encoding: 8bit --] Le 15/02/2017 à 05:02, Scott Kostyshak a écrit : On Wed, Jan 04, 2017 at 09:00:44AM +0100, Wolfgang Engelmann wrote: On 03.01.2017 21:32, Scott Kostyshak wrote: On Mon, Jan 02, 2017 at 11:25:07AM +0100, Wolfgang Engelmann wrote: How could I get a dot on an alpha by using the math function of lyx? Or do I have to use a tex insert: $\dot \alpha$ Instead of a tex insert (ERT), use a mathed inset (Ctrl-M, say) and insert \dot \alpha there. This is converted to the right symbol(s) in both, LyX and output document. Click on the "frame decorations" icon in the math toolbar. See the screenshot. Does that work for you? This gives the same result. In the LyX math preview (i.e. without instant preview), the "dot" looks more like a small line. Do you agree or does it look correct to you? Yes, Scott, in the instant preview it does look like a short line, but its correct in the pdf output. I tried to fix it, but it seems that in this part of the code we can't really draw circles; we can only trick the user into thinking its a little circle by drawing a short line. We could draw a polygon with many sides (I guess this is how all circles are drawn on screens?). Is there a program that outputs coordinates in the format required by the code in src/mathed/MathSupport.cpp ? Another interesting issue is that the math decorations do not zoom with the font; (because)? if they did, our approximations would look pretty rough I guess. I'm actually amazed with how well most of them work. I never realized a problem before. I have a series of patches (attached) that make the decoration thickness increase with zoom, to improve the appearance on high-dpi. The decorations do not look worse than without the added thickness. I have not committed it yet because I have not found a way to keep it simple, and there are still some issues. But you might like to try them. For \dot in particular it looks like a square rather than a line. Did you think about using Unicode and, e.g., the STIX fonts for mathed? I know this is a major change but it should solve issues like scaling and curved lines. Harfbuzz has been providing access to the the math table of opentype fonts since very recently, and even computes the glyph assemblies for decorations. So in theory it is possible to implement variable-size decorations with opentype fonts. See http://www.lyx.org/trac/ticket/9014#comment:7. But that's a big project. For the "frame decorators", one could explore the use of combining characters - maybe there are issues with placement but α̇ or 𝛼̇ looks better in mathed than the current "square dot". Indeed, for standard-sized decorations, it would be simpler to implement.
Re: alpha dot
On 2017-02-15, Guillaume Munch wrote: > [-- Type: text/plain, Encoding: 8bit --] > Le 15/02/2017 à 05:02, Scott Kostyshak a écrit : >> On Wed, Jan 04, 2017 at 09:00:44AM +0100, Wolfgang Engelmann wrote: >>> On 03.01.2017 21:32, Scott Kostyshak wrote: On Mon, Jan 02, 2017 at 11:25:07AM +0100, Wolfgang Engelmann wrote: > How could I get a dot on an alpha by using the math function of > lyx? Or do I have to use a tex insert: > $\dot \alpha$ Instead of a tex insert (ERT), use a mathed inset (Ctrl-M, say) and insert \dot \alpha there. This is converted to the right symbol(s) in both, LyX and output document. Click on the "frame decorations" icon in the math toolbar. See the screenshot. Does that work for you? This gives the same result. In the LyX math preview (i.e. without instant preview), the "dot" looks more like a small line. Do you agree or does it look correct to you? >>> Yes, Scott, in the instant preview it does look like a short line, but its >>> correct in the pdf output. >> I tried to fix it, but it seems that in this part of the code we can't >> really draw circles; we can only trick the user into thinking its a >> little circle by drawing a short line. We could draw a polygon with many >> sides (I guess this is how all circles are drawn on screens?). Is there >> a program that outputs coordinates in the format required by the code in >> src/mathed/MathSupport.cpp ? >> Another interesting issue is that the math decorations do not zoom with >> the font; (because)? if they did, our approximations would look pretty >> rough I guess. I'm actually amazed with how well most of them work. I >> never realized a problem before. > I have a series of patches (attached) that make the decoration thickness > increase with zoom, to improve the appearance on high-dpi. The > decorations do not look worse than without the added thickness. I have > not committed it yet because I have not found a way to keep it simple, > and there are still some issues. But you might like to try them. > For \dot in particular it looks like a square rather than a line. Did you think about using Unicode and, e.g., the STIX fonts for mathed? I know this is a major change but it should solve issues like scaling and curved lines. For the "frame decorators", one could explore the use of combining characters - maybe there are issues with placement but α̇ or 𝛼̇ looks better in mathed than the current "square dot". Günter
Re: alpha dot
Le 15/02/2017 à 05:02, Scott Kostyshak a écrit : On Wed, Jan 04, 2017 at 09:00:44AM +0100, Wolfgang Engelmann wrote: On 03.01.2017 21:32, Scott Kostyshak wrote: On Mon, Jan 02, 2017 at 11:25:07AM +0100, Wolfgang Engelmann wrote: How could I get a dot on an alpha by using the math function of lyx? Or do I have to use a tex insert: $\dot \alpha$ Click on the "frame decorations" icon in the math toolbar. See the screenshot. Does that work for you? In the LyX math preview (i.e. without instant preview), the "dot" looks more like a small line. Do you agree or does it look correct to you? Scott Yes, Scott, in the instant preview it does look like a short line, but its correct in the pdf output. I tried to fix it, but it seems that in this part of the code we can't really draw circles; we can only trick the user into thinking its a little circle by drawing a short line. We could draw a polygon with many sides (I guess this is how all circles are drawn on screens?). Is there a program that outputs coordinates in the format required by the code in src/mathed/MathSupport.cpp ? Another interesting issue is that the math decorations do not zoom with the font; (because)? if they did, our approximations would look pretty rough I guess. I'm actually amazed with how well most of them work. I never realized a problem before. I have a series of patches (attached) that make the decoration thickness increase with zoom, to improve the appearance on high-dpi. The decorations do not look worse than without the added thickness. I have not committed it yet because I have not found a way to keep it simple, and there are still some issues. But you might like to try them. For \dot in particular it looks like a square rather than a line. Guillaume >From 45d8c5edc2c8e26065468c691f90a1d50ddc20a9 Mon Sep 17 00:00:00 2001 From: Guillaume Munch Date: Mon, 28 Nov 2016 03:27:30 +0100 Subject: [PATCH 1/3] Increase thickness of math delimiter with zoom --- src/mathed/InsetMathAMSArray.cpp | 15 ++- src/mathed/InsetMathBig.cpp| 19 +-- src/mathed/InsetMathCases.cpp | 4 +++- src/mathed/InsetMathDecoration.cpp | 15 +-- src/mathed/InsetMathDelim.cpp | 25 ++--- src/mathed/InsetMathDots.cpp | 13 + src/mathed/InsetMathFrac.cpp | 11 +++ src/mathed/InsetMathXArrow.cpp | 19 +-- src/mathed/MathSupport.cpp | 26 +++--- src/mathed/MathSupport.h | 10 +- 10 files changed, 110 insertions(+), 47 deletions(-) diff --git a/src/mathed/InsetMathAMSArray.cpp b/src/mathed/InsetMathAMSArray.cpp index 9a9a349..df022b6 100644 --- a/src/mathed/InsetMathAMSArray.cpp +++ b/src/mathed/InsetMathAMSArray.cpp @@ -88,19 +88,24 @@ void InsetMathAMSArray::metrics(MetricsInfo & mi, Dimension & dim) const Changer dummy2 = mi.base.changeEnsureMath(); Changer dummy = mi.base.changeArray(); InsetMathGrid::metrics(mi, dim); + mathed_deco_metrics(mi.base, dim); } void InsetMathAMSArray::draw(PainterInfo & pi, int x, int y) const { Changer dummy2 = pi.base.changeEnsureMath(); + { + Changer dummy = pi.base.changeArray(); + InsetMathGrid::draw(pi, x, y); + } Dimension const dim = dimension(*pi.base.bv); int const yy = y - dim.ascent(); - // Drawing the deco after changeStyle does not work - mathed_draw_deco(pi, x + 1, yy, 5, dim.height(), from_ascii(name_left())); - mathed_draw_deco(pi, x + dim.width() - 8, yy, 5, dim.height(), from_ascii(name_right())); - Changer dummy = pi.base.changeArray(); - InsetMathGrid::draw(pi, x, y); + int const t = mathed_deco_thickness(pi.base); + mathed_draw_deco(pi, x + 1 - t/2, yy, + 5, dim.height(), from_ascii(name_left())); + mathed_draw_deco(pi, x + dim.width() - t/2 - 8, yy, + 5, dim.height(), from_ascii(name_right())); } diff --git a/src/mathed/InsetMathBig.cpp b/src/mathed/InsetMathBig.cpp index 889f8d4..e5848aa 100644 --- a/src/mathed/InsetMathBig.cpp +++ b/src/mathed/InsetMathBig.cpp @@ -24,6 +24,10 @@ #include "support/docstream.h" #include "support/lstrings.h" +#include + +using namespace std; + namespace lyx { @@ -90,10 +94,12 @@ void InsetMathBig::metrics(MetricsInfo & mi, Dimension & dim) const { Changer dummy = mi.base.changeEnsureMath(); double const h = theFontMetrics(mi.base.font).ascent('I'); - double const f = increase(); - dim.wid = 6; - dim.asc = int(h + f * h); - dim.des = int(f * h); + double const height = h * (1 + 2 * increase()); + int const axis = axis_height(mi.base); + dim.wid = max(6, mathed_mu(mi.base.font, 6.0)); + dim.asc = int(height/2 + axis); + dim.des = int(height/2 - axis); + mathed_deco_metrics(mi.base, dim); } @@ -115,8 +121,9 @@ void InsetMathBig::draw(PainterInfo & pi, int x, int y) const { Changer dummy = pi.base.changeEnsureMath(); Dimension const dim = dimension(*pi.base.bv); - mathed_draw_deco(pi, x + 1, y - dim.ascent(),