SixLabors/Fonts

TextLayout.ProcessText throws an unhandled exception while using Style Script font with specific text

Kizuto3 opened this issue · 7 comments

Description
I found a weird bug that occurs while using Style Script font and a specific text. An ArgumentOutOfRangeException is thrown.

Steps to Reproduce

var content = "Please enter the text";

var fontFamilies = new FontCollection();

var fontFamily = fontFamilies.Add(@"<full path>\Style Script.ttf");

var font = fontFamily.CreateFont(16, FontStyle.Regular);

var renderOptions = new TextOptions(font)
{
    Dpi = 96,
    WrappingLength = 0f,
    VerticalAlignment = VerticalAlignment.Top,
    HorizontalAlignment = HorizontalAlignment.Left,
    KerningMode = KerningMode.Auto
};

var textBox = TextLayout.ProcessText(content.AsSpan(), renderOptions);

However, no exception is thrown if content = "enter the text"

System Configuration

  • Fonts version: 1.0.0-beta18.2
  • Other Six Labors packages and versions: none
  • Environment (Operating system, version and so on): Win10
  • .NET Framework version: .Net 6.0

I attached the font that I am using:
Style Script.zip

Can you please fill in the issue form properly specifying version numbers etc?

I updated the issue form

Thanks for fixing out of range exception!
However, a new issue appeared (steps to reproduce are the same). For some reasons glyphs are not generated for some letters: 'r' in 'enter' and 'h' in 'the'. Can you please take a look at this?

image

I’m not seeing that on my machine. See the output from #303

Scratch that. I'll have a look, but I can't promise a result any time soon.

That's OK, thank you!

Please enter the text

The output is correct. What you're seeing in the debug code is the original code point at that position.