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

Center label relative to barcode #198

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

mjamro
Copy link

@mjamro mjamro commented Mar 16, 2024

Bug: The label text is rendered relative to the middle of the image instead of the middle of the actual barcode.

This PR requires #196

Current behaviour

Label text not in the middle of the barcode.
Zrzut ekranu 2024-03-16 115046

After changes

Label text in the middle of the barcode.

image

@mjamro mjamro force-pushed the feature/center-label branch 3 times, most recently from 466f9cd to 244b421 Compare March 18, 2024 12:15

g.DrawRect(new SKRect(s1, img.Height - textBounds1.Height - textBounds1.Height / 4f, s1 + w1, img.Height), backBrush); // first guard bar cover

if (barcode.GuardBarsMode == GuardBarsMode.Enabled)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

did this leak in from the other change for guard bars?

@@ -207,7 +208,15 @@ public static SKImage Label_EAN13(Barcode barcode, SKBitmap img)
foreBrush.IsAutohinted = true;
foreBrush.FilterQuality = SKFilterQuality.High;

g.DrawText(first, s1 + (w1 / 2f - textBounds1.Width / 2f), img.Height, foreBrush);
if (barcode.GuardBarsMode == GuardBarsMode.Enabled)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here

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

Successfully merging this pull request may close these issues.

None yet

2 participants