Fix browser DXF interactions and add cross-platform font rendering#26
Fix browser DXF interactions and add cross-platform font rendering#26wieslawsoltes wants to merge 12 commits into
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a06d0c9b57
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| ? cmd.Rect.Width | ||
| : 10000f; | ||
| var key = (cmd.Text, font, cmd.FontSize, maxWidth, TextAlignment.Left); | ||
| var key = (cmd.Text, font, cmd.FontSize, maxWidth, TextAlignment.Left, cmd.TextShapingOptions); |
There was a problem hiding this comment.
Use value identity for shaping options cache keys
When callers create an equivalent TextShapingOptions instance on each render (for example via TextShapingOptions.WithFeatures(...) in OnRender), this tuple compares the options object by reference because TextShapingOptions has no value equality. The same text/font/features then misses _layoutCache every frame and leaves a new TextLayout behind, so retained text with stable shaping settings can grow the compositor cache unbounded instead of reusing the layout.
Useful? React with 👍 / 👎.
| if (typeface.IsVariableFont) | ||
| { | ||
| return ApplyStyleVariations(typeface, style) ?? typeface; |
There was a problem hiding this comment.
Fall back to family matching for variable slant changes
When the current face is a variable font that does not have an ital/slnt axis but its family has a separate italic variable face (the bundled Inter Variable family is registered this way), this branch returns the original upright face after applying only the available axes and never searches the family for the italic face. Calls such as SKFontManager.MatchTypeface or rich text style resolution that request italic from the upright variable face therefore get synthetic skew instead of the registered true italic variable face.
Useful? React with 👍 / 👎.
Summary
This change fixes the browser DXF viewer regressions, restores reliable browser file selection, and replaces the previous platform-dependent text setup with a shared high-performance font, shaping, layout, and rendering pipeline.
It also bundles the official Inter 4.1 family and targeted Noto fallbacks, removes font-dependent UI chrome glyphs, and adds an interactive Inter specimen page that exercises the supported static, variable, and OpenType behavior in the sample gallery.
DXF interaction and browser platform fixes
OnRender.showOpenFilePickerwhen available and retain a cancellation-safe hidden-input fallback for browsers or origins where the native picker API is unavailable.Cross-platform font management
FontManagerused by ProGPU text, WinUI controls, and the SkiaSharp compatibility surface.SKFontManager,SKFontStyleSet, andSKTypefaceto use the same catalog and matching rules.Bundled font families
ProGPU.Fonts.InterandProGPU.Fonts.Notoprojects.Fonts.Avalonia.SourceHanSansJP.Liteentirely.OpenType shaping and variable fonts
aaltand all Inter character-variant tags, includingcv14.fvar,avar,gvar,HVAR,MVAR, GDEF variation stores, and variable GPOS adjustments.TextVisual,TextLayout, rich text, and fallback runs.Text and icon rendering quality
Inter specimen page
Inter Typefacepage to the browser and desktop sample navigation.wghtandopszaxes, language-sensitive forms, ligatures, kerning, fractions, numeric styles, alternates, stylistic sets, character variants, and slashed zero.Performance and quality safeguards
Validation
dotnet test src/ProGPU.Tests/ProGPU.Tests.csproj -c Release --no-restore --nologodotnet publish src/ProGPU.Samples.Browser/ProGPU.Samples.Browser.csproj -c Release -o artifacts/browser-aothttp://127.0.0.1:8081/.Notes
netDxf.netstandardremains in the documented mixed interpreter/AOT mode because of the existing .NET 10 Mono AOT compiler limitation; DXF rendering itself continues through the normal WebGPU path.