Skip to content

API Redesign #58

@Happypig375

Description

@Happypig375

Is your feature request related to a problem? Please describe.
Currently, the APIs for CSharpMath are not intuitive at all.
For example, to convert MathList->TeX, one has to call MathListBuilder.MathListToString which is a static method (not easy to discover), and its name doesn't imply anything about the result being a TeX string at all.

Describe the solution you'd like

  1. Streamline the use of CSharpMath APIs.
SkiaSharp.SKCanvas canvas =;
"\\frac{1}{2}"
.TeXToMathAtoms()
.ToDisplay()
.ToOutput(canvas);
  1. Replace mutable global variables with settings objects.
    e.g. CSharpMath.Atoms.MathAtoms contain multiple dictionaries that act as hidden dependencies. They should be made obvious.

  2. Reduce legacy boilerplate code from iosMath.
    e.g. Why do some math atoms have their respective interfaces? It's not like MathAtoms will have alternate implementations, they are just data containers. If they are to be extended, they can be inherited.
    e.g. Reduce boilerplate folders. They scare new contributors. Most folders in CSharpMath/ contain few files anyway.
    e.g. Remove CSharpMath.Enumerations.MathAtomType. Use pattern matching on types instead.

  3. Simplify the NuGet chain. It's not obvious what CSharpMath.Rendering does based on its name. CSharpMath, CSharpMath.Editor and CSharpMath.Rendering should be merged into one. Typography should be integrated directly into CSharpMath because

.NET font reader library name Can read math layout info for glyphs?
NRasterizer
SixLabors.Fonts
SharpFont
Typography ✔️
Source: https://github.com/Jolg42/awesome-typography#c-2

It's not like there is or will be any other implementations for font reading of math fonts.

Describe alternatives you've considered
Continuing the current API and result in a degraded user experience.

Difficulty: How difficult would it be? (Trivial, Very Easy, Easy, Moderate, Hard, Very Hard, Tedious, Backbreaking)
Very hard. A lot of time will be needed to achieve this.

Additional context
#57

Metadata

Metadata

Assignees

No one assigned

    Labels

    Status/1. BlockedRequires another issue or pull request to be completed before being ready.Type/Enhancement

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions