Skip to content
Open
Show file tree
Hide file tree
Changes from 20 commits
Commits
Show all changes
121 commits
Select commit Hold shift + click to select a range
9893628
add workflows to sln
Dec 12, 2025
5e2f294
update versions in yml files
Dec 12, 2025
dd975ed
remove non-working workaround around coverlet (with github issue refe…
Dec 12, 2025
45b4a59
dotnet outdated is deprecated
Dec 12, 2025
2274297
copilot fix for error "The specified RuntimeIdentifier '.testcoverage…
Dec 12, 2025
d86ff0e
netcoreapp3.1 fails build so update
Dec 12, 2025
5b19ee5
fix yaml - nuget restore obsolete
Dec 12, 2025
12999db
newtonsoft not used outside ios
Dec 12, 2025
353ac51
nullable disable for apple - legacy project
Dec 12, 2025
90f0d6f
fix nullable issue
Dec 12, 2025
beda865
Update CSharpMath.Wiki submodule to latest commit
Dec 12, 2025
feccce7
Update Typography submodule to latest commit
Dec 12, 2025
abe3d0f
remove some typography tests from slnf since they cause a build failure
Dec 12, 2025
2d22e79
fix
Dec 12, 2025
b1e6f22
copilot submodule work
Dec 12, 2025
6c28e67
typography update fix
Dec 12, 2025
35936ae
Update Typography submodule to latest commit
Dec 12, 2025
3a70d26
nowarn about Typography
Dec 12, 2025
ce2234b
typography build fixes
Dec 12, 2025
5f073b2
steps towards a build
Dec 12, 2025
42d240a
try putting the input in as a manual handler
Dec 12, 2025
7779d49
ignore nullable warnings in test projs
Dec 12, 2025
c1999ff
remove a brittle smiley faces test
Dec 12, 2025
771f4bf
create an ios slnf to fix ios test stage (claude 4.5 commit)
Dec 12, 2025
207164e
use dotnet build
Dec 12, 2025
3584552
Remove ios projects
Dec 12, 2025
79abd33
craete a buildeverything slnf for use in pipeline
Dec 12, 2025
edca973
remove shared projects to fix build (claude)
Dec 12, 2025
02f6508
fix slnf error (claude)
Dec 12, 2025
5a40206
nowarn typography
Dec 12, 2025
239081e
wip interfaces
Dec 12, 2025
618b51c
wip test interfaces
Dec 12, 2025
8f3b3f4
separate project for shared test stuff
Dec 12, 2025
3baee53
create a Tests.Frontend project to put shared test files in
Dec 13, 2025
3a89582
update skiasharp
Dec 13, 2025
d1b6616
fix build
Dec 13, 2025
8757b72
rename to testutils
Dec 13, 2025
70a21f8
slnf copilot
Dec 13, 2025
1640671
put new project in right place
Dec 13, 2025
fee44b3
fix build
Dec 13, 2025
9f5e946
rename
Dec 13, 2025
28f5385
wiki update
Dec 13, 2025
744dcca
build fixes
Dec 13, 2025
0a5e6b3
fix warning
Dec 13, 2025
fe52930
Remove wiki submodule, add wiki files directly, and remove deprecated…
Copilot Dec 13, 2025
55ced85
claude build fix
Dec 13, 2025
61f08fd
try claude fix
Dec 13, 2025
dfba580
remove Forms WPF which doesn't build
Dec 13, 2025
3cba373
fix fsharp file
Dec 13, 2025
b2c6505
claude fixes
Dec 13, 2025
2d96954
disable Avalonia test
Dec 13, 2025
a99bfb1
remove avalonia reference to try to fix skiasharp versioning error
Dec 13, 2025
9c7bf74
copilot suggests adding skiasharp directly to the Rendering.Tests pro…
Dec 13, 2025
0b9d72f
try another copilot suggestion to include native assets explicitly
Dec 13, 2025
e158dea
revert avalonia removal
Dec 13, 2025
92a495b
Revert "disable Avalonia test"
Dec 13, 2025
14093bd
Reapply "disable Avalonia test"
Dec 13, 2025
7b1e81d
Revert "Reapply "disable Avalonia test""
Dec 13, 2025
5e0d634
updates
Dec 14, 2025
2bae526
claude fixes
Dec 14, 2025
87a7538
dotnet10 ymls
Dec 14, 2025
76c8877
skiasharp update and copilot fixes
Dec 14, 2025
a74ecc5
fixes
Dec 14, 2025
25495e2
comment out avalonia from rendering tests
Dec 14, 2025
aa92dd2
comment out avalonia tests
Dec 14, 2025
6d9f84f
allo updating baselines
Dec 14, 2025
c8a7b50
add comment
Dec 14, 2025
2c94e56
baseeline updates
Dec 14, 2025
7c6960e
icons aren't related to project
Dec 14, 2025
f3a0542
code coverage step failing, but don't fail CI
Dec 14, 2025
d8916f3
update system.memory
Dec 15, 2025
e07fd60
avalonia update (claude)
Dec 15, 2025
db4afbd
readd avalonia test
Dec 15, 2025
d4ae50e
re-add avalona tests
Dec 15, 2025
7ae7f07
Add MAUI
Happypig375 Dec 15, 2025
73f986b
Make Avalonia Example run again
Happypig375 Dec 16, 2025
2b08a17
WIP MAUI math keyboard
Happypig375 Dec 16, 2025
7e70e7a
Maybe stream position should be zero
Happypig375 Dec 16, 2025
1eba6e7
Editor now works
Happypig375 Dec 17, 2025
ad08b4a
Fix MAUI editor page
Happypig375 Dec 18, 2025
c14466f
Updated evaluation, pending tests update
Happypig375 Dec 18, 2025
574d4d2
CSharpMath.Evaluation.Tests now pass
Happypig375 Dec 19, 2025
1a0fd7e
Update AngouriMath and add logical operators
Happypig375 Jan 1, 2026
83d8c16
Make the editor page awesome to use with proper keyboard handling
Happypig375 Jan 1, 2026
255f1a0
Add light and dark theme switch
Happypig375 Jan 2, 2026
8f8654e
Port Text page over
Happypig375 Jan 3, 2026
3164661
Finalize MAUI port
Happypig375 Jan 3, 2026
5afbbcb
Examples settings
Happypig375 Jan 3, 2026
cb3566a
Updated AngouriMath to 1.4.0-preview.4
Happypig375 Jan 4, 2026
77caf2e
Fully remove Xamarin Forms
Happypig375 Jan 4, 2026
75def3f
All tests pass
Happypig375 Jan 4, 2026
24ce2be
Fix CI
Happypig375 Jan 4, 2026
eb228fe
Run dotnet workload restore
Happypig375 Jan 4, 2026
2895600
One solution for everything
Happypig375 Jan 4, 2026
ea5be8d
Delete shproj because dotnet command doesn't support it
Happypig375 Jan 4, 2026
19984a5
Don't keep the wiki
Happypig375 Jan 4, 2026
76445ba
Accommodate platforms
Happypig375 Jan 4, 2026
8960337
Only windows can build all
Happypig375 Jan 5, 2026
7cb48d8
Fix CI again
Happypig375 Jan 5, 2026
15d6468
Fix NoWarn
Happypig375 Jan 5, 2026
6a8fa99
Fix build
Happypig375 Jan 5, 2026
6742974
Fix Maui Example on cross platform build
Happypig375 Jan 5, 2026
ffab8a4
Set up XCode properly
Happypig375 Jan 5, 2026
faf1e7e
Set up xcode properly
Happypig375 Jan 5, 2026
c09a946
Run dotnet workload restore first
Happypig375 Jan 5, 2026
f27e9bf
Try using macos-26
Happypig375 Jan 5, 2026
aa78341
Update to xUnit v3 MTP
Happypig375 Jan 5, 2026
049c59b
Add global.json
Happypig375 Jan 5, 2026
dc90246
Use correct Xcode version
Happypig375 Jan 5, 2026
81dd250
Fix test call
Happypig375 Jan 5, 2026
fe0945d
Omit coverlet for now
Happypig375 Jan 5, 2026
2085aa7
Simplify Core tests and Visualizer for CI to not treat Visualizer as …
Happypig375 Jan 5, 2026
cc33917
Fix build
Happypig375 Jan 5, 2026
52f20cf
Further simplification
Happypig375 Jan 5, 2026
fd16ee5
Fix build conditions
Happypig375 Jan 5, 2026
e5103dd
Simplify projects
Happypig375 Jan 5, 2026
45e21a9
Pin release drafter version
Happypig375 Jan 5, 2026
5ebb8a5
Update benchmark action
Happypig375 Jan 5, 2026
3c29bf3
Remove CSharpMath.Structures namespace
Happypig375 Jan 6, 2026
3b3510b
Support chained comparisons
Happypig375 Jan 6, 2026
0d1b1e1
abs, sgn, lim
Happypig375 Jan 8, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions .github/workflows/Benchmark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@ jobs:
Rendering:
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
submodules: 'recursive'
- name: Setup .NET Core
uses: actions/setup-dotnet@v1
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 3.1.401
dotnet-version: |
3.1.x
6.0.x
- run: dotnet run -p CSharpMath.Rendering.Benchmarks
- name: Store benchmark result
uses: Happypig375/github-action-benchmark@v1
Expand Down
16 changes: 8 additions & 8 deletions .github/workflows/Build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,18 @@ jobs:
Everything:
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
submodules: 'recursive'
- name: Setup .NET Core
uses: actions/setup-dotnet@v1
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: '3.1.401'
- name: Setup NuGet
uses: NuGet/setup-nuget@v1.0.5
dotnet-version: |
6.0.x
10.0.x
- name: Setup MSBuild Path
uses: microsoft/setup-msbuild@v1.0.2
uses: microsoft/setup-msbuild@v2
- name: Restore NuGet Packages
run: nuget restore CSharpMath.sln
run: dotnet restore CSharpMath.sln
- name: Build Everything
run: msbuild CSharpMath.sln /p:Configuration=Release
10 changes: 6 additions & 4 deletions .github/workflows/Release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,15 @@ jobs:
CSharpMath:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
submodules: 'recursive'
- name: Setup .NET Core
uses: actions/setup-dotnet@v1
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: '3.1.401'
dotnet-version: |
3.1.x
6.0.x
- name: Build GitHub Releases draft artifacts
env:
RELEASE_NOTES: |
Expand Down
43 changes: 18 additions & 25 deletions .github/workflows/Test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,25 +7,18 @@ jobs:
steps:
- name: Update draft on GitHub Releases
id: release_drafter
uses: release-drafter/release-drafter@v5
uses: release-drafter/release-drafter@v6
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
submodules: 'recursive'
- name: Setup .NET Core # Required to execute ReportGenerator
uses: actions/setup-dotnet@v1
- name: Setup .NET # Required to execute ReportGenerator
uses: actions/setup-dotnet@v4
with:
dotnet-version: '3.1.401'
- name: Update dependencies in CSharpMath.Xaml.Tests.NuGet
run: |
dotnet tool install -g dotnet-outdated
update() {
dotnet outdated -u CSharpMath.Xaml.Tests.NuGet
dotnet outdated -pre Always -inc CSharpMath -u CSharpMath.Xaml.Tests.NuGet
}
# retry 5 times since dotnet outdated fails often: https://github.com/jerriep/dotnet-outdated/issues/299
update || update || update || update || update
dotnet-version: |
6.0.x
10.0.x
- name: Build and Test
env:
RELEASE_NOTES: |
Expand All @@ -35,46 +28,46 @@ jobs:
run: |
# .NET Core MSBuild cannot parse , and ; correctly so we replace them with substitutions: https://github.com/dotnet/msbuild/issues/471#issuecomment-366268743
# https://www.gnu.org/software/bash/manual/bash.html#Shell-Parameter-Expansion
# ${parameter/pattern/string} If pattern begins with ‘/’, all matches of pattern are replaced with string. Normally only the first match is replaced.
# ${parameter/pattern/string} If pattern begins with '/', all matches of pattern are replaced with string. Normally only the first match is replaced.
RELEASE_NOTES=${RELEASE_NOTES//,/%2C}
RELEASE_NOTES=${RELEASE_NOTES//;/%3B}

# --collect:"XPlat Code Coverage" means collect test coverage with https://github.com/coverlet-coverage/coverlet
# Coverlet settings come after --: https://github.com/coverlet-coverage/coverlet/blob/master/Documentation/VSTestIntegration.md#advanced-options-supported-via-runsettings
dotnet test CSharpMath.CrossPlatform.slnf -c Release -l GitHubActions --blame --collect:"XPlat Code Coverage" -r .testcoverage -p:PackageReleaseNotes="$RELEASE_NOTES" -p:PackageVersion=${{ steps.release_drafter.outputs.tag_name || format('{0}-pr', github.event.number) }}-ci-${{ github.sha }} -- DataCollectionRunSettings.DataCollectors.DataCollector.Configuration.IncludeTestAssembly=true
dotnet test CSharpMath.CrossPlatform.slnf -c Release -l GitHubActions --blame --collect:"XPlat Code Coverage" --results-directory .testcoverage -p:PackageReleaseNotes="$RELEASE_NOTES" -p:PackageVersion=${{ steps.release_drafter.outputs.tag_name || format('{0}-pr', github.event.number) }}-ci-${{ github.sha }} -- DataCollectionRunSettings.DataCollectors.DataCollector.Configuration.IncludeTestAssembly=true
- name: Run ReportGenerator on Test Coverage results
uses: danielpalme/ReportGenerator-GitHub-Action@4.6.7
uses: danielpalme/ReportGenerator-GitHub-Action@5
with:
reports: '.testcoverage/**/*.*' # REQUIRED # The coverage reports that should be parsed (separated by semicolon). Globbing is supported.
targetdir: '.testcoverage/report' # REQUIRED # The directory where the generated report should be saved.
reporttypes: 'Html' # The output formats and scope (separated by semicolon) Values: Badges, Clover, Cobertura, CsvSummary, Html, HtmlChart, HtmlInline, HtmlInline_AzurePipelines, HtmlInline_AzurePipelines_Dark, HtmlSummary, JsonSummary, Latex, LatexSummary, lcov, MHtml, PngChart, SonarQube, TeamCitySummary, TextSummary, Xml, XmlSummary
title: 'CSharpMath test coverage results' # Optional title.
tag: ${{ steps.release_drafter.outputs.tag_name || format('{0}-pr', github.event.number) }}-ci-${{ github.sha }} # Optional tag or build version.
- name: Upload CSharpMath test coverage results as CI artifacts
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: CSharpMath test coverage results
path: .testcoverage/
- name: Upload CSharpMath test coverage results to codecov.io
uses: codecov/codecov-action@v1
uses: codecov/codecov-action@v4
with:
file: .testcoverage/**/*.xml # optional
name: CSharpMath test coverage # optional
fail_ci_if_error: true # optional (default = false)
- name: Upload CSharpMath.Rendering.Tests results as CI artifacts
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
if: always() # Run even when a previous step failed: https://stackoverflow.com/a/58859404/5429648
with:
name: CSharpMath.Rendering.Tests results
path: CSharpMath.Rendering.Tests/*/*.png
- name: Upload CSharpMath.Xaml.Tests.NuGet results as CI artifacts
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
if: always()
with:
name: CSharpMath.Xaml.Tests.NuGet results
path: CSharpMath.Xaml.Tests.NuGet/*.png
- name: Upload NuGet packages as CI artifacts
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
if: always()
with:
name: NuGet packages
Expand All @@ -90,10 +83,10 @@ jobs:
Ios:
runs-on: macos-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
submodules: 'recursive'
- run: nuget restore CSharpMath.sln
- run: dotnet restore CSharpMath.sln
- run: msbuild CSharpMath.Ios.Tests
- name: Run tests
env:
Expand Down Expand Up @@ -171,7 +164,7 @@ jobs:
if [[ "$TESTS_OUTPUT" == *"[FAIL]"* ]]
then exit 1
fi
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v4
if: always() # Run even when a previous step failed: https://stackoverflow.com/a/58859404/5429648
with:
name: CSharpMath.Ios.Tests Results
Expand Down
4 changes: 3 additions & 1 deletion CSharpMath.Apple/BackEnd/JsonMathTable.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
using System.Collections.Generic;
using System.Linq;

# nullable disable

namespace CSharpMath.Apple {
/// <summary>Holds lots of constants for spacing between
/// various visible elements by reading a JSON file.</summary>
Expand Down Expand Up @@ -136,7 +138,7 @@ public override float RadicalExtraAscender(TFont font) =>
private const string _startConnectorKey = "startConnector";
private const string _extenderKey = "extender";
private const string _glyphKey = "glyph";
public override IEnumerable<GlyphPart<TGlyph>>? GetVerticalGlyphAssembly(TGlyph rawGlyph, TFont font) =>
public override IEnumerable<GlyphPart<TGlyph>> GetVerticalGlyphAssembly(TGlyph rawGlyph, TFont font) =>
_assemblyTable[GlyphNameProvider.GetGlyphName(rawGlyph)]?[_assemblyPartsKey] is JArray parts
? parts.Select(partInfo =>
new GlyphPart<TGlyph>(
Expand Down
2 changes: 1 addition & 1 deletion CSharpMath.Apple/Resources/ManifestResources.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public static JToken LatinMath {
using var textReader = new StreamReader(LatinMathContent);
using var reader = new Newtonsoft.Json.JsonTextReader(textReader);
_latinMath =
new Newtonsoft.Json.JsonSerializer().Deserialize<JObject>(reader).Root;
new Newtonsoft.Json.JsonSerializer().Deserialize<JObject>(reader)!.Root;
}
return _latinMath;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFramework>net10.0</TargetFramework>
<OutputType>WinExe</OutputType>
</PropertyGroup>

Expand Down
1 change: 0 additions & 1 deletion CSharpMath.CoreTests/CSharpMath.CoreTests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,5 @@
<Compile Include="..\CSharpMath.Apple\Resources\ManifestResourceProvider.cs" Link="_Helpers\Resources\ManifestResourceProvider.cs" />
<EmbeddedResource Include="_Helpers\Resources\latinmodern-math.json" />
<ProjectReference Include="..\CSharpMath\CSharpMath.csproj" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.2" />
</ItemGroup>
</Project>
3 changes: 0 additions & 3 deletions CSharpMath.CoreTests/MockTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,5 @@ public void TestGlyphBoundsWithM() {
[Fact]
public void ResourceProviderFindsResource() =>
Assert.NotNull(Resources.ManifestResources.LatinMathContent);
[Fact]
public void ResourceProviderFindsMathConfiguration() =>
Assert.IsType<Newtonsoft.Json.Linq.JObject>(Resources.ManifestResources.LatinMath["constants"]);
}
}
1 change: 0 additions & 1 deletion CSharpMath.CrossPlatform.slnf
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
"Typography/Typography.OpenFont/Typography.OpenFont.shproj",
"Typography/Typography.GlyphLayout/Typography.GlyphLayout.shproj",
"Typography/Typography.TextBreak/Typography.TextBreak/Typography.TextBreak.shproj",
"Typography/Typography.TextBreak/Typography.TextBreak.UnitTests/TextBreakTests.csproj",
"CSharpMath.Playground/CSharpMath.Playground.csproj",
"CSharpMath.Avalonia/CSharpMath.Avalonia.csproj",
"CSharpMath.Avalonia.Example/CSharpMath.Avalonia.Example.csproj",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFramework>net10.0</TargetFramework>
<StartupObject>CSharpMath.Editor.Tests.Visualizer.Checker</StartupObject>
</PropertyGroup>

Expand Down
2 changes: 1 addition & 1 deletion CSharpMath.Playground/CSharpMath.Playground.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFramework>net10.0</TargetFramework>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFramework>net10.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<Compile Include="..\CSharpMath.Rendering.Tests\TestRenderingMathData.cs" Link="TestRenderingMathData.cs" />
Expand Down
1 change: 1 addition & 0 deletions CSharpMath.Rendering/BackEnd/Fonts.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.Linq;
using Typography.OpenFont;
using Typography.OpenFont.Extensions;

namespace CSharpMath.Rendering.BackEnd {
public class Fonts : Display.FrontEnd.IFont<Glyph>, IEnumerable<Typeface> {
Expand Down
2 changes: 1 addition & 1 deletion CSharpMath.Rendering/BackEnd/GlyphBoundsProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ private GlyphBoundsProvider() { }
(Fonts font, IEnumerable<Glyph> glyphs, int nGlyphs) {
var advances = new List<float>(nGlyphs);
foreach (var glyph in glyphs)
advances.Add(glyph.Typeface.GetHAdvanceWidthFromGlyphIndex(glyph.Info.GlyphIndex) *
advances.Add(glyph.Typeface.GetAdvanceWidthFromGlyphIndex(glyph.Info.GlyphIndex) *
glyph.Typeface.CalculateScaleToPixelFromPointSize(font.PointSize));
return (advances, advances.Sum());
}
Expand Down
4 changes: 2 additions & 2 deletions CSharpMath.Rendering/BackEnd/GraphicsContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

namespace CSharpMath.Rendering.BackEnd {
public class GraphicsContext : IGraphicsContext<Fonts, Glyph> {
private class GlyphOutlineBuilder : Typography.Contours.GlyphOutlineBuilderBase {
private class GlyphOutlineBuilder : Typography.OpenFont.Contours.GlyphOutlineBuilderBase {
public GlyphOutlineBuilder(Typeface typeface) : base(typeface) { }
}
public GraphicsContext(ICanvas canvas, (Color glyph, Color textRun)? glyphBoxColor) {
Expand Down Expand Up @@ -72,7 +72,7 @@ public void DrawGlyphRunWithOffset
pathBuilder.BuildFromGlyph(glyph.Info, pointSize);
Canvas.CurrentColor = foreground ?? color;
pathBuilder.ReadShapes(Canvas.StartNewPath());
Canvas.Translate(typeface.GetHAdvanceWidthFromGlyphIndex(index) * scale + kernAfter, 0);
Canvas.Translate(typeface.GetAdvanceWidthFromGlyphIndex(index) * scale + kernAfter, 0);
}
Canvas.Restore();
}
Expand Down
8 changes: 4 additions & 4 deletions CSharpMath.Rendering/BackEnd/MathTable.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ float ReadRecord(MathValueRecord rec, Fonts fonts) =>
public override float FractionNumeratorShiftUp(Fonts fonts) => ReadRecord(fonts.MathConsts.FractionNumeratorShiftUp, fonts);
public override float FractionRuleThickness(Fonts fonts) => ReadRecord(fonts.MathConsts.FractionRuleThickness, fonts);
(IEnumerable<Glyph> variants, int count)? GetVariants(Typeface typeface, MathGlyphConstruction? glyphs) {
var records = glyphs?.GlyphVariantRecords;
var records = glyphs?.glyphVariantRecords;
if (records == null) return null;
return (records.Select(record => new Glyph(typeface, typeface.GetGlyph(record.VariantGlyph))), records.Length);
}
Expand All @@ -35,7 +35,7 @@ public override (IEnumerable<Glyph> variants, int count) GetVerticalVariantsForG
public override float GetItalicCorrection(Fonts fonts, Glyph glyph) =>
glyph.Info.MathGlyphInfo?.ItalicCorrection?.Value * glyph.Typeface.CalculateScaleToPixelFromPointSize(fonts.PointSize) ?? 0;
public override Glyph GetLargerGlyph(Fonts fonts, Glyph glyph) {
var variants = glyph.Info.MathGlyphInfo?.VertGlyphConstruction?.GlyphVariantRecords;
var variants = glyph.Info.MathGlyphInfo?.VertGlyphConstruction?.glyphVariantRecords;
var glyphIndex = glyph.Info.GlyphIndex;
foreach (var variant in variants ?? System.Array.Empty<MathGlyphVariantRecord>()) {
var variantIndex = variant.VariantGlyph;
Expand All @@ -50,7 +50,7 @@ public override Glyph GetLargerGlyph(Fonts fonts, Glyph glyph) {
public override IEnumerable<GlyphPart<Glyph>>? GetVerticalGlyphAssembly(Glyph rawGlyph, Fonts fonts) {
var scale = rawGlyph.Typeface.CalculateScaleToPixelFromPointSize(fonts.PointSize);
return
rawGlyph.Info.MathGlyphInfo?.VertGlyphConstruction?.GlyphAsm?.GlyphPartRecords.Select(record =>
rawGlyph.Info.MathGlyphInfo?.VertGlyphConstruction?.GlyphAsm_GlyphPartRecords.Select(record =>
new GlyphPart<Glyph>(
new Glyph(rawGlyph.Typeface, rawGlyph.Typeface.GetGlyph(record.GlyphId)),
record.FullAdvance * scale,
Expand Down Expand Up @@ -92,7 +92,7 @@ public override float MinConnectorOverlap(Fonts fonts) =>
public override float GetTopAccentAdjustment(Fonts fonts, Glyph glyph) =>
(glyph.Info.MathGlyphInfo?.TopAccentAttachment?.Value
// If no top accent is defined then it is the center of the advance width.
?? glyph.Typeface.GetHAdvanceWidthFromGlyphIndex(glyph.Info.GlyphIndex) / 2)
?? glyph.Typeface.GetAdvanceWidthFromGlyphIndex(glyph.Info.GlyphIndex) / 2)
//remember to scale the unit
* glyph.Typeface.CalculateScaleToPixelFromPointSize(fonts.PointSize);
public override float UnderbarRuleThickness(Fonts fonts) => ReadRecord(fonts.MathConsts.UnderbarRuleThickness, fonts);
Expand Down
2 changes: 2 additions & 0 deletions CSharpMath.Rendering/CSharpMath.Rendering.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
<TargetFramework>netstandard2.0</TargetFramework>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<Description>Rendering interface for CSharpMath using the Typography library.</Description>
<!-- Suppress nullable reference type warnings from Typography submodule -->
<NoWarn>$(NoWarn);CS8618;CS8603;CS8625;CS8600;CS8601;CS8602;CS8604</NoWarn>
</PropertyGroup>
<ItemGroup>
<EmbeddedResource Include="Reference Fonts\*.otf" />
Expand Down
15 changes: 15 additions & 0 deletions CSharpMath.Rendering/Text/BreakAtInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
using Typography.TextBreak;

// BreakAtInfo from Typography, moved here since this is now in a test project in Typography

namespace CSharpMath.Rendering.Text {
internal struct BreakAtInfo {
public readonly int breakAt;
public readonly WordKind wordKind;

public BreakAtInfo(int breakAt, WordKind wordKind) {
this.breakAt = breakAt;
this.wordKind = wordKind;
}
}
}
2 changes: 1 addition & 1 deletion CSharpMath.Rendering/Text/TextLaTeXParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public static Result<TextAtom> TextAtomFromLaTeX(string latexSource) {
int dollarCount = 0;
var globalAtoms = new TextAtomListBuilder();
List<BreakAtInfo> breakList = new List<BreakAtInfo>(); // Roslyn bug that assumes breakList is nullable resulting in warnings so var is not used
var breaker = new CustomBreaker(v => breakList.Add(new BreakAtInfo(v.LatestBreakAt, v.LatestWordKind))) {
var breaker = new CustomBreaker() { // v => breakList.Add(new BreakAtInfo(v.LatestBreakAt, v.LatestWordKind)) // The CustomBreaker constructor no longer takes an argument
BreakNumberAfterText = true,
ThrowIfCharOutOfRange = false
};
Expand Down
2 changes: 1 addition & 1 deletion CSharpMath.Wiki
2 changes: 1 addition & 1 deletion CSharpMath.Xaml.Tests/Test.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ IDisposable SetBinding<TView>(TView view, string propertyName, TBindingMode? bin
SetBinding(view,
(TProperty)typeof(TView)
.GetField(propertyName + "Property", BindingFlags.Public | BindingFlags.Static | BindingFlags.FlattenHierarchy)
?.GetValue(view) ?? throw new NotImplementedException($"Property not found in {typeof(TView)}: {propertyName}"),
?.GetValue(view)! ?? throw new NotImplementedException($"Property not found in {typeof(TView)}: {propertyName}"),
propertyName,
bindingMode ?? Default);
[Fact]
Expand Down
Loading
Loading