verybadcat / CSharpMath

LaTeX. in C#. (ported from the wonderful iosMath project).
MIT License
384 stars 64 forks source link

0.4.0 Avalonia Update has been released! #112

Closed Happypig375 closed 3 years ago

Happypig375 commented 4 years ago

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

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
    • Enhanced slash (#109)
    • A blinking cursor
    • Inner atom editing
    • Large operator with limits editing Editor
  4. New math mode symbol commands! https://github.com/verybadcat/CSharpMath/blob/de1458afa2a2129cc928731885deb634205badc9/CSharpMath/Atom/LaTeXSettings.cs#L588-L818
  5. \colorboxes! image
  6. More helpful error messages! image
  7. MathButton and TextButton!
  8. Built-in Cyrillic support! image
  9. Bugs fixed: #37, #59, #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 #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 https://github.com/verybadcat/CSharpMath/issues/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 commented 4 years ago

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 commented 4 years ago

try deleting bin/obj folders and rebuilding?

algebrainx commented 4 years ago

tried it still not working also cleared nuget cache

algebrainx commented 4 years ago

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 commented 4 years ago

I can investigate if you send me your solution.

algebrainx commented 4 years ago

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

Happypig375 commented 4 years ago

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 commented 4 years ago

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

Happypig375 commented 4 years ago

Pushed a 0.4.0.1.

Happypig375 commented 4 years ago

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

Happypig375 commented 4 years ago

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

charlesroddie commented 4 years ago

@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 commented 4 years ago

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 commented 4 years ago

The behavior of Measure has now been fixed and documented at https://github.com/verybadcat/CSharpMath/blob/6678311f2f4f711ce6992e20ea31cd095205f651/CSharpMath.Rendering.Tests/TestMeasure.cs#L40-L58

charlesroddie commented 4 years ago

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

charlesroddie commented 4 years ago

Fix works. Thanks!

angelklim commented 4 years ago

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 commented 4 years ago

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

Happypig375 commented 3 years ago

Superseded by #190.