-
Notifications
You must be signed in to change notification settings - Fork 70
Open
Labels
Status/0. NewThis issue is new and is awaiting confirmation from the maintainers.This issue is new and is awaiting confirmation from the maintainers.Type/Bug
Description
Describe the bug
MathPainter generates an image that cuts off the right side of the equation.
To Reproduce
Compiled on Ubuntu 24.04.1
.NET 8.0.405
CSProj contents:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<SelfContained>true</SelfContained>
<PublishSingleFile>true</PublishSingleFile>
<PublishTrimmed>true</PublishTrimmed>
<IncludeNativeLibrariesForSelfExtract>true</IncludeNativeLibrariesForSelfExtract>
<DebugType>embedded</DebugType>
<ReadyToRun>true</ReadyToRun>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="CSharpMath.SkiaSharp" Version="0.5.1" />
<PackageReference Include="SkiaSharp" Version="3.116.1" />
<PackageReference Include="SkiaSharp.NativeAssets.Linux.NoDependencies" Version="3.116.1" />
</ItemGroup>
</Project>main.cs contents:
using CSharpMath.SkiaSharp;
using SkiaSharp;
// Render LaTeX to PNG
var painter = new MathPainter
{
LaTeX = @"\begin{aligned}
\nabla \cdot \vec{\bf E} & = \frac {\rho} {\varepsilon_0} \\
\nabla \cdot \vec{\bf B} & = 0 \\
\nabla \times \vec{\bf E} &= - \frac{\partial\vec{\bf B}}{\partial t} \\
\nabla \times \vec{\bf B} & = \mu_0\vec{\bf J} + \mu_0\varepsilon_0 \frac{\partial\vec{\bf E}}{\partial t}
\end{aligned}",
AntiAlias = true,
TextColor = SKColors.Green,
FontSize = 48,
PaintStyle = CSharpMath.Rendering.FrontEnd.PaintStyle.Fill,
GlyphBoxColor = (SKColors.Red, SKColors.Azure),
};
using var png = painter.DrawAsStream(format: SKEncodedImageFormat.Png, quality: 100);
if (png == null)
{
throw new InvalidOperationException("Failed to create PNG stream.");
}
using var file = File.OpenWrite("equation.png");
png.CopyTo(file);Compile, execute, and open the resulting equation.png and you can see the image of the equation.
The canvas is not wide enough for the generated latex image.
Expected behavior
Width of canvas should be as large as the latex image.
Environment (please complete the following information):
- Platform: CSharpMath.SkiaSharp
- Package Version or Commit: 0.5.11
- Device: Desktop PC, Ubuntu 24.04.1
Additional context
See attached image result.
Metadata
Metadata
Assignees
Labels
Status/0. NewThis issue is new and is awaiting confirmation from the maintainers.This issue is new and is awaiting confirmation from the maintainers.Type/Bug
