Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ElementDrawer for barcodes with interpretation line throwing on OSX-Arm64/.NET 7.0 #145

Closed
christianklauss opened this issue Dec 11, 2022 · 2 comments · Fixed by #229
Closed
Assignees

Comments

@christianklauss
Copy link

Environment: OSX (Ventura) on Apple Silicon with .NET 7.0

I've worked on a REST wrapper around some ZPL/Label Printing functionality and I've noticed that using the Viewer library to generate barcodes that contain an interpretation line does not work on my dev machine even if making libgdiplus available (with that is running fine with the current /dotnet/sdk:7.0 docker image though, so it's not really a blocker for the project).

var labelFont = new SKFont(labelTypeFace, labelFontSize).ToSystemDrawingFont();
int labelHeight = barcode.PrintInterpretationLine ? labelFont.Height : 0;

int labelHeight = barcode.PrintInterpretationLine ? labelFont.Height : 0;

The labelFont.Height property is throwing in these cases. I also tried replacing the font loader with a custom one but it didn't change the outcome. Since MS is not pursuing cross-platform support for System.Common.Drawing I guess it would require dropping the dependency on that to support this scenario. I guess this might not be worth the effort given that the viewer is fine running in Docker but I just wanted to let you know (thanks for the whole library, was a huge time-saver).

@primo-ppcg
Copy link
Collaborator

@christianklauss thanks for the feedback.

For most barcode elements, a third-party library is used for rendering barnhill/barcodelib. Unfortunately, this library uses System.Drawing fonts for interpretation lines, rather than SkiaSharp types faces as are used by all other elements.

The resolution for this issue is to remove the dependency, and render barcodes directly from encoded data (which is already done for data matrices and QR codes).

@chrisandchris
Copy link

chrisandchris commented May 30, 2023

Just a heads-up, there was a PR that recently (a few days ago) got merged in barnhill/barcodelib that removed the dependency to System.Drawing and now uses SkiaSharp which made it into their 3.0.0 release.

See: barnhill/barcodelib#152

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants