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

Another issue with line breaks #446

Open
4 tasks done
jez9999 opened this issue Jan 30, 2025 · 3 comments
Open
4 tasks done

Another issue with line breaks #446

jez9999 opened this issue Jan 30, 2025 · 3 comments

Comments

@jez9999
Copy link

jez9999 commented Jan 30, 2025

Prerequisites

  • I have written a descriptive issue title
  • I have verified that I am running the latest version of Fonts
  • I have verified if the problem exist in both DEBUG and RELEASE mode
  • I have searched open and closed issues to ensure it has not already been reported

Fonts version

2.1.1

Other Six Labors packages and versions

SixLabors.ImageSharp 3.1.6, SixLabors.ImageSharp.Drawing 2.1.5

Environment (Operating system, version and so on)

Windows 10

.NET Framework version

.NET 9

Description

@JimBobSquarePants Wish I could say I hadn't found another bug in the latest version of Fonts, but, see Steps to Reproduce...

Steps to Reproduce

using System.Numerics;
using SixLabors.ImageSharp;
using SixLabors.ImageSharp.Drawing.Processing;
using SixLabors.ImageSharp.PixelFormats;
using SixLabors.ImageSharp.Processing;
using SixLabors.Fonts;

namespace TextRunTest;

internal class Program {
	static void Main(string[] args) {
		Console.WriteLine("Rendering test images...");
		//test1();
		//test2();
		test3();

		Console.WriteLine("Done.");
	}

	private static void test3() {
		var fontManager = new FontManager();
		
		string text1 = "⇒ Tim Cook\n⇒ Jef Bezos\n⇒ Steve Jobs\n⇒ Mark Zuckerberg";
		string text2 = "⇒ Tim Cook\n⇒ Jeff Bezos\n⇒ Steve Jobs\n⇒ Mark Zuckerberg";
		var renderingFont = fontManager.GetFont("Charis SIL", 85, FontStyle.Bold);
		var options = new RichTextOptions(renderingFont) {
			Origin = new Vector2(50, 20),
			LayoutMode = LayoutMode.HorizontalTopBottom,
			VerticalAlignment = VerticalAlignment.Top,
			TextAlignment = TextAlignment.Start,
			WrappingLength = 860,
		};

		Image imgTest3 = new Image<Rgba32>(1100, 500, Color.White);
		imgTest3.Mutate(x =>
			x.DrawText(options, text1, Color.Black)
		);
		imgTest3.SaveAsPng("c:/development/diff/testImg1.png");
		// ^ renders normally

		Image imgTest4 = new Image<Rgba32>(1100, 500, Color.White);
		imgTest4.Mutate(x =>
			x.DrawText(options, text2, Color.Black)
		);
		imgTest4.SaveAsPng("c:/development/diff/testImg2.png");
		// ^ causes 4th line to disappear...?
	}
}

Images

Image
Image

@JimBobSquarePants
Copy link
Member

Image

I can’t keep doing releases like this. If you have tests please supply them all.

@JimBobSquarePants
Copy link
Member

@jez9999 I just reread what I wrote there, and I realised it might have come across wrong; I'm frustrated at myself not you. You've been incredibly helpful!

@jez9999
Copy link
Author

jez9999 commented Jan 30, 2025

I don't have tests, I just have software that I use regularly which renders stuff with Imagesharp and I happen to come across the bugs.

JimBobSquarePants added a commit that referenced this issue Jan 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants