Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

0.4.0 Avalonia Update has been released! #112

Closed
Happypig375 opened this issue Apr 10, 2020 · 19 comments
Closed

0.4.0 Avalonia Update has been released! #112

Happypig375 opened this issue Apr 10, 2020 · 19 comments
Labels
Resolution/Superceded The described announcement or pull request has been superceded. Type/Announcement

Comments

@Happypig375
Copy link
Collaborator

With the co[DEMONETIZED]us🦠 shutting down schools, I have had more time to work on CSharpMath lol 🚀

New additions

  1. A massive refactor and rename across CSharpMath (left: 0.3.0, right: 0.4.0)
    • 4x test increase!
      image
  2. A new Avalonia front end! (Thanks @jp2masa!)
    Avalonia
  3. CSharpMath.Editor improvements
  4. New math mode symbol commands!
    // Table 20: AMS Arrows
    //{ "dashrightarrow", new Relation("⇢") }, // Glyph not in Latin Modern Math
    //{ "dashleftarrow", new Relation("⇠") }, // Glyph not in Latin Modern Math
    { "leftleftarrows", new Relation("⇇") },
    { "leftrightarrows", new Relation("⇆") },
    { "Lleftarrow", new Relation("⇚") },
    { "twoheadleftarrow", new Relation("↞") },
    { "leftarrowtail", new Relation("↢") },
    { "looparrowleft", new Relation("↫") },
    { "leftrightharpoons", new Relation("⇋") },
    { "curvearrowleft", new Relation("↶") },
    { "circlearrowleft", new Relation("↺") },
    { "Lsh", new Relation("↰") },
    { "upuparrows", new Relation("⇈") },
    { "upharpoonleft", new Relation("↿") },
    { "downharpoonleft", new Relation("⇃") },
    { "multimap", new Relation("⊸") },
    { "leftrightsquigarrow", new Relation("↭") },
    { "rightrightarrows", new Relation("⇉") },
    { "rightleftarrows", new Relation("⇄") },
    // Duplicate entry in LaTeX Symbol list: \rightrightarrows
    // Duplicate entry in LaTeX Symbol list: \rightleftarrows
    { "twoheadrightarrow", new Relation("↠") },
    { "rightarrowtail", new Relation("↣") },
    { "looparrowright", new Relation("↬") },
    // \rightleftharpoons defined in Table 10
    { "curvearrowright", new Relation("↷") },
    { "circlearrowright", new Relation("↻") },
    { "Rsh", new Relation("↱") },
    { "downdownarrows", new Relation("⇊") },
    { "upharpoonright", new Relation("↾") },
    { "downharpoonright", new Relation("⇂") },
    { "rightsquigarrow", new Relation("⇝") },
    // Table 21: AMS Negated Arrows
    { "nleftarrow", new Relation("↚") },
    { "nrightarrow", new Relation("↛") },
    { "nLeftarrow", new Relation("⇍") },
    { "nRightarrow", new Relation("⇏") },
    { "nleftrightarrow", new Relation("↮") },
    { "nLeftrightarrow", new Relation("⇎") },
    // Table 22: AMS Greek
    // { "digamma", new Variable("ϝ") }, // Glyph not in Latin Modern Math
    { "varkappa", new Variable("ϰ") },
    // Table 23: AMS Hebrew
    { "beth", new Ordinary("ℶ") },
    { "daleth", new Ordinary("ℸ") },
    { "gimel", new Ordinary("ℷ") },
    // Table 24: AMS Miscellaneous
    // \hbar defined in Table 11
    { "hslash", new Ordinary("ℏ") }, // Same as \hbar
    { "vartriangle", new Ordinary("△") }, // ▵ not in Latin Modern Math // ▵ is actually a triangle, not an inverted v as displayed in Visual Studio
    { "triangledown", new Ordinary("▽") }, // ▿ not in Latin Modern Math
    { "square", Placeholder },
    { "lozenge", new Ordinary("◊") },
    // { "circledS", new Ordinary("Ⓢ") }, // Glyph not in Latin Modern Math
    // \angle defined in Table 11
    { "measuredangle", new Ordinary("∡") },
    { "nexists", new Ordinary("∄") },
    // \mho defined in Table 11
    // { "Finv", new Ordinary("Ⅎ") }, // Glyph not in Latin Modern Math
    // { "Game", new Ordinary("⅁") }, // Glyph not in Latin Modern Math
    { "Bbbk", new Ordinary("𝐤") },
    { "backprime", new Ordinary("‵") },
    { "varnothing", new Ordinary("∅") }, // Same as \emptyset
    { "blacktriangle", new Ordinary("▲") }, // ▴ not in Latin Modern Math
    { "blacktriangledown", new Ordinary("▼") }, // ▾ not in Latin Modern Math
    { "blacksquare", new Ordinary("▪") },
    { "blacklozenge", new Ordinary("♦") }, // ⧫ not in Latin Modern Math
    { "bigstar", new Ordinary("⋆") }, // ★ not in Latin Modern Math
    { "sphericalangle", new Ordinary("∢") },
    { "complement", new Ordinary("∁") },
    { "eth", new Ordinary("ð") }, // Same as \dh
    { "diagup", new Ordinary("/") }, // ╱ not in Latin Modern Math
    { "diagdown", new Ordinary("\\") }, // ╲ not in Latin Modern Math
    // Table 25: AMS Commands Defined to Work in Both Math and Text Mode
    { "checkmark", new Ordinary("✓") },
    { "circledR", new Ordinary("®") },
    { "maltese", new Ordinary("✠") },
    // Table 26: AMS Binary Operators
    { "dotplus", new BinaryOperator("∔") },
    { "smallsetminus", new BinaryOperator("∖") },
    { "Cap", new BinaryOperator("⋒") },
    { "Cup", new BinaryOperator("⋓") },
    { "barwedge", new BinaryOperator("⌅") },
    { "veebar", new BinaryOperator("⊻") },
    // { "doublebarwedge", new BinaryOperator("⩞") }, //Glyph not in Latin Modern Math
    { "boxminus", new BinaryOperator("⊟") },
    { "boxtimes", new BinaryOperator("⊠") },
    { "boxdot", new BinaryOperator("⊡") },
    { "boxplus", new BinaryOperator("⊞") },
    { "divideontimes", new BinaryOperator("⋇") },
    { "ltimes", new BinaryOperator("⋉") },
    { "rtimes", new BinaryOperator("⋊") },
    { "leftthreetimes", new BinaryOperator("⋋") },
    { "rightthreetimes", new BinaryOperator("⋌") },
    { "curlywedge", new BinaryOperator("⋏") },
    { "curlyvee", new BinaryOperator("⋎") },
    { "circleddash", new BinaryOperator("⊝") },
    { "circledast", new BinaryOperator("⊛") },
    { "circledcirc", new BinaryOperator("⊚") },
    { "centerdot", new BinaryOperator("·") }, // Same as \cdot
    { "intercal", new BinaryOperator("⊺") },
    // Table 27: AMS Binary Relations
    { "leqq", new Relation("≦") },
    { "leqslant", new Relation("⩽") },
    { "eqslantless", new Relation("⪕") },
    { "lesssim", new Relation("≲") },
    { "lessapprox", new Relation("⪅") },
    { "approxeq", new Relation("≊") },
    { "lessdot", new Relation("⋖") },
    { "lll", new Relation("⋘") },
    { "lessgtr", new Relation("≶") },
    { "lesseqgtr", new Relation("⋚") },
    { "lesseqqgtr", new Relation("⪋") },
    { "doteqdot", new Relation("≑") },
    { "risingdotseq", new Relation("≓") },
    { "fallingdotseq", new Relation("≒") },
    { "backsim", new Relation("∽") },
    { "backsimeq", new Relation("⋍") },
    // { "subseteqq", new Relation("⫅") }, // Glyph not in Latin Modern Math
    { "Subset", new Relation("⋐") },
    // \sqsubset is defined in Table 8
    { "preccurlyeq", new Relation("≼") },
    { "curlyeqprec", new Relation("⋞") },
    { "precsim", new Relation("≾") },
    // { "precapprox", new Relation("⪷") }, // Glyph not in Latin Modern Math
    { "vartriangleleft", new Relation("⊲") },
    { "trianglelefteq", new Relation("⊴") },
    { "vDash", new Relation("⊨") },
    { "Vvdash", new Relation("⊪") },
    { "smallsmile", new Relation("⌣") }, //Same as \smile
    { "smallfrown", new Relation("⌢") }, //Same as \frown
    { "bumpeq", new Relation("≏") },
    { "Bumpeq", new Relation("≎") },
    { "geqq", new Relation("≧") },
    { "geqslant", new Relation("⩾") },
    { "eqslantgtr", new Relation("⪖") },
    { "gtrsim", new Relation("≳") },
    { "gtrapprox", new Relation("⪆") },
    { "gtrdot", new Relation("⋗") },
    { "ggg", new Relation("⋙") },
    { "gtrless", new Relation("≷") },
    { "gtreqless", new Relation("⋛") },
    { "gtreqqless", new Relation("⪌") },
    { "eqcirc", new Relation("≖") },
    { "circeq", new Relation("≗") },
    { "triangleq", new Relation("≜") },
    { "thicksim", new Relation("∼") },
    { "thickapprox", new Relation("≈") },
    // { "supseteqq", new Relation("⫆") }, // Glyph not in Latin Modern Math
    { "Supset", new Relation("⋑") },
    // \sqsupset is defined in Table 8
    { "succcurlyeq", new Relation("≽") },
    { "curlyeqsucc", new Relation("⋟") },
    { "succsim", new Relation("≿") },
    // { "succapprox", new Relation("⪸") }, // Glyph not in Latin Modern Math
    { "vartriangleright", new Relation("⊳") },
    { "trianglerighteq", new Relation("⊵") },
    { "Vdash", new Relation("⊩") },
    { "shortmid", new Relation("∣") },
    { "shortparallel", new Relation("∥") },
    { "between", new Relation("≬") },
    // { "pitchfork", new Relation("⋔") }, // Glyph not in Latin Modern Math
    { "varpropto", new Relation("∝") },
    { "blacktriangleleft", new Relation("◀") }, // ◂ not in Latin Modern Math
    { "therefore", new Relation("∴") },
    // { "backepsilon", new Relation("϶") }, // Glyph not in Latin Modern Math
    { "blacktriangleright", new Relation("▶") }, // ▸ not in Latin Modern Math
    { "because", new Relation("∵") },
    // Table 28: AMS Negated Binary Relations
    // U+0338, an overlapping slant, is used as a workaround when Unicode has no matching character
    { "nless", new Relation("≮") },
    { "nleq", new Relation("≰") },
    { "nleqslant", new Relation("⩽\u0338") },
    { "nleqq", new Relation("≦\u0338") },
    { "lneq", new Relation("⪇") },
    { "lneqq", new Relation("≨") },
    // \lvertneqq -> ≨ + U+FE00 (Variation Selector 1) Not dealing with variation selectors, thank you very much
    { "lnsim", new Relation("⋦") },
    { "lnapprox", new Relation("⪉") },
    { "nprec", new Relation("⊀") },
    { "npreceq", new Relation("⪯\u0338") },
    { "precnsim", new Relation("⋨") },
    // { "precnapprox", new Relation("⪹") }, // Glyph not in Latin Modern Math
    { "nsim", new Relation("≁") },
    { "nshortmid", new Relation("∤") },
    { "nmid", new Relation("∤") },
    { "nvdash", new Relation("⊬") },
    { "nvDash", new Relation("⊭") },
    { "ntriangleleft", new Relation("⋪") },
    { "ntrianglelefteq", new Relation("⋬") },
    { "nsubseteq", new Relation("⊈") },
    { "subsetneq", new Relation("⊊") },
    // \varsubsetneq -> ⊊ + U+FE00 (Variation Selector 1) Not dealing with variation selectors, thank you very much
    // { "subsetneqq", new Relation("⫋") }, // Glyph not in Latin Modern Math
    // \varsubsetneqq -> ⫋ + U+FE00 (Variation Selector 1) Not dealing with variation selectors, thank you very much
    { "ngtr", new Relation("≯") },
    { "ngeq", new Relation("≱") },
    { "ngeqslant", new Relation("⩾\u0338") },
    { "ngeqq", new Relation("≧\u0338") },
    { "gneq", new Relation("⪈") },
    { "gneqq", new Relation("≩") },
    // \gvertneqq -> ≩ + U+FE00 (Variation Selector 1) Not dealing with variation selectors, thank you very much
    { "gnsim", new Relation("⋧") },
    { "gnapprox", new Relation("⪊") },
    { "nsucc", new Relation("⊁") },
    { "nsucceq", new Relation("⪰\u0338") },
    // Duplicate entry in LaTeX Symbol list: \nsucceq
    { "succnsim", new Relation("⋩") },
    // { "succnapprox", new Relation("⪺") }, // Glyph not in Latin Modern Math
    { "ncong", new Relation("≇") },
    { "nshortparallel", new Relation("∦") },
    { "nparallel", new Relation("∦") },
    { "nVdash", new Relation("⊮") }, // Error in LaTeX Symbol list: defined as \nvDash which duplicates above
    { "nVDash", new Relation("⊯") },
    { "ntriangleright", new Relation("⋫") },
    { "ntrianglerighteq", new Relation("⋭") },
    { "nsupseteq", new Relation("⊉") },
    // { "nsupseteqq", new Relation("⫆\u0338") }, // Glyph not in Latin Modern Math
    { "supsetneq", new Relation("⊋") },
    // \varsupsetneq -> ⊋ + U+FE00 (Variation Selector 1) Not dealing with variation selectors, thank you very much
    // { "supsetneqq", new Relation("⫌") }, // Glyph not in Latin Modern Math
    // \varsupsetneqq -> ⫌ + U+FE00 (Variation Selector 1) Not dealing with variation selectors, thank you very much
  5. \colorboxes!
    image
  6. More helpful error messages!
    image
  7. MathButton and TextButton!
  8. Built-in Cyrillic support!
    image
  9. Bugs fixed: Arrows over vectors #37, Round trip conversion leads to invalid LaTeX #59, Some math fonts not showing up in android device #77
  10. CI for CSharpMath
    image
  11. C# 8 nullable reference types enabled in the whole repo
  12. Removed dependency on the unmaintained SkiaSharp.Extended (Also fixes Some math fonts not showing up in android device #77)

What's next?

Since the exams, although delayed, are still coming up, I will need to temporarily leave once again. However, there are already a bunch of planned items for the next update once I come back. Stay tuned!

Leftovers from 0.2.0 checklist (see #104)

Item Comments
#4 Merge with wpf-math After looking into wpf-math, it depends heavily on the WPF infrastructure and is hard to make cross-platform. In contrast, CSharpMath is built with cross-platform in mind upon creation. A most probable resolution would be CSharpMath supporting the non-WPF platforms while wpf-math stays on WPF to facilitate division of labor.
F# instead of C# Not really feasible as rewriting an entire solution will be extremely time-consuming but for little benefit. A better way to introduce F# would be in an entirely new project - currently planned for 0.6.0
Refactor TextAtoms and MathAtoms to have common atoms The layout mechanism for MathAtoms and TextAtoms are too different for both atom hierarchies to unify. Not doing it.
Refactor MathAtoms to get rid of MathAtomType and AtomCloner Done. All atoms now have a Clone() method.
Unit tests (and picture comparisons) Done. Added as CSharpMath.Rendering.Tests
Tavis CI integration Done. Added as GitHub Actions
An intuitive README for getting started Will be done along with a new website. Currently planned for 0.6.0 - stay tuned!
Documentation on both NuGet and GitHub wiki A website will be so much better. It will be much more maintainable and customizable. Probably won't do this.
Document release procedure Done. Added as ReleaseProcedure.txt
Promote awareness!! Postponed to after 0.6.0 when the website is complete
Native platform support for the popular ones Maybe. Probably won't do every platform as utilizing CI to automatically run unit tests will be difficult.
Implement \middle Potential 0.5.0 candidate
Optimize loading times of the Android example project Potential 0.5.0 candidate

Stay safe🦺, 💪stay healthy🧼 and 🥚🐇Happy Easter🐣🐰!

Supersedes #104.

@algebrainx
Copy link

algebrainx commented Apr 10, 2020

Hi thanks for the update I update my Xamarin Forms Solution to 0.4.0.
Now I get an arrow for the function InitializeComponent():

'Could not set up parent class, due to: Generic type definition failed to init, due to: VTable setup of type CSharpMath.Forms.BaseView2[TPainter,TContent] failed assembly:/storage/emulated/0/Android/data/com.companyname.mathx/files/.__override__/CSharpMath.Forms.dll type:BaseView2 member:(null) assembly:/storage/emulated/0/Android/data/com.companyname.mathx/files/.__override__/CSharpMath.Forms.dll type:BaseView2 member:(null)'
`

@Happypig375
Copy link
Collaborator Author

try deleting bin/obj folders and rebuilding?

@algebrainx
Copy link

algebrainx commented Apr 10, 2020

tried it still not working also cleared nuget cache

@algebrainx
Copy link

When I reset to 0.3.0 it works for me I don't know if the issue is from my solution or the update

@Happypig375
Copy link
Collaborator Author

I can investigate if you send me your solution.

@algebrainx
Copy link

Sure check it https://we.tl/t-QoEgR1xKQL

@Happypig375
Copy link
Collaborator Author

Figured it out. Somehow CSharpMath.Forms 0.4.0 had a dependency on CSharpMath.SkiaSharp 0.4.0-beta instead of 0.4.0.
I have no idea how this happened.

@algebrainx
Copy link

Any suggestions to fix this? So the bug isn't from my solution?

@Happypig375
Copy link
Collaborator Author

Pushed a 0.4.0.1.

@Happypig375
Copy link
Collaborator Author

Or you can explicitly specify a dependency on CSharpMath.SkiaSharp 0.4.0.

@Happypig375
Copy link
Collaborator Author

I guess I have to add a test for loading and using the latest NuGet.

@charlesroddie
Copy link
Collaborator

charlesroddie commented Apr 13, 2020

@Happypig375 has there been a change to mathPainter.Draw or to the definition of .Measure?

All the mathPainter positioning is out of place now. I will need to work out what the current definition is, and how to fix all usages of Draw, if the new API is stable. I suspect the new one is incorrect though.

@charlesroddie
Copy link
Collaborator

charlesroddie commented Apr 13, 2020

It's looking like a change in the definition of Measure. I remember there were problems with the vertical coordinates of the measure in early releases.

We have the following code to adjust y positioning based on whether you want the lining to be at y or the center or the top. Only YTextAlign.Line works now which suggests a bug with measure.

let yCoordinateToDrawTo =
    y +
    match yAlign with
    | YTextAlign.Line -> 0.f // works
    | YTextAlign.Center -> -0.5f * (measure.Top + measure.Bottom) // fails
    | YTextAlign.Top -> - measure.Top // fails

@Happypig375
Copy link
Collaborator Author

The behavior of Measure has now been fixed and documented at

/// <summary>
/// CSharpMath and CSharpMath.Editor use the mathematical coordinate system,
/// i.e. the rectangle position is at the bottom-left.
/// </summary>
[Fact]
public void CoreMeasure_YIsNegDescent() {
Assert.Equal(new RectangleF(0, -3, 10, 15), new D().DisplayBounds());
Assert.Equal(new RectangleF(0, -3, 10, 15), new DEditorKeyboard().Measure);
}
/// <summary>
/// CSharpMath.Rendering and descendants use the graphical coordinate system,
/// i.e. the rectangle position is at the top-left.
/// </summary>
[Fact]
public void RenderingMeasure_YIsNegAscent() {
Assert.Equal(new RectangleF(0, -12, 10, 15), new DRenderingMath().Measure());
Assert.Equal(new RectangleF(0, -12, 10, 15), new DRenderingText().Measure(float.NaN));
Assert.Equal(new RectangleF(0, -12, 10, 15), new DRenderingKeyboard().Measure);
}

@charlesroddie
Copy link
Collaborator

charlesroddie commented Apr 14, 2020

Edit: sorry when you said has been fixed you meant you just fixed it. Testing now!

@charlesroddie
Copy link
Collaborator

Fix works. Thanks!

@angelklim
Copy link

angelklim commented Apr 14, 2020

Have been noticing missing text related to starting TeX with $$...$$ (and [...] has the same behavior).
For example, "$$p(x)=ax^2+bx+c, \text{ where } a \neq 0$$ A quadratic is a $2^{nd}$ degree polynomial." would only show "A quadratic is a 2nd degree polynomial."
And "$$x$$ $$y$$" will only show "y"

Just $$...$$ by itself or after regular seems to display correctly.

@Happypig375
Copy link
Collaborator Author

Fixed in v0.4.2
Added as test: https://github.com/verybadcat/CSharpMath/blob/a3d657815523684da10d096a8e04a9eeeaefc9b5/CSharpMath.Rendering.Tests/Text/QuadraticPolynomial.png

@Happypig375
Copy link
Collaborator Author

Superseded by #190.

@Happypig375 Happypig375 added the Resolution/Superceded The described announcement or pull request has been superceded. label Apr 20, 2021
@Happypig375 Happypig375 unpinned this issue May 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Resolution/Superceded The described announcement or pull request has been superceded. Type/Announcement
Projects
None yet
Development

No branches or pull requests

4 participants