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

Artifact on a certain glyph #193

Open
bluebear94 opened this issue Dec 3, 2023 · 4 comments
Open

Artifact on a certain glyph #193

bluebear94 opened this issue Dec 3, 2023 · 4 comments

Comments

@bluebear94
Copy link

To reproduce: Save the following as shape.txt:

{
  26.3125, 9.5625;
  m;
  26.6875, 9.5625;
  c;
  26.6875, 4.8125;
  m;
  31.9375, 4.8125;
  y;
  31.9375, 27.8125;
  y(31.9375, 38.90625; 23.46875, 40.1875);
  19, 40.1875;
  y(13.75, 40.1875; 7.75, 38.34375);
  5, 32;
  m;
  10.125, 30.1875;
  c(11.28125, 32.71875; 14.09375, 35.4375);
  19.1875, 35.4375;
  c(24.125, 35.4375; 26.625, 32.84375);
  26.625, 28.375;
  c;
  26.625, 28.1875;
  c(26.625, 25.59375; 23.9375, 25.8125);
  17.5625, 25;
  c(11.09375, 24.15625; 4, 22.71875);
  4, 14.75;
  c(4, 7.90625; 9.28125, 4);
  15.9375, 4;
  c(22.03125, 4; 25.21875, 7.28125);
  #
}
{
  26.625, 22.375;
  m;
  26.625, 17.4375;
  m(26.625, 13.09375; 23.125, 8.8125);
  16.75, 8.8125;
  y(12.46875, 8.8125; 9.375, 10.71875);
  9.375, 14.4375;
  c(9.375, 18.53125; 13.125, 19.8125);
  17.3125, 20.375;
  c(19.5625, 20.625; 25.71875, 21.28125);
  #
}

(Taken from the a glyph in Inter. For various reasons, this isn’t reproducible by letting msdfgen load the glyph from the font file.)

Run:

./msdfgen msdf -shapedesc shape.txt -size 36 45 -testrender preview.png 360 450

When the resulting distance field is rendered, there is an artifact near the tail of the a:

rendered

The artifact is less pronounced when -scale 0.99 or -scale 1.01 is passed in.

@MomoDeve
Copy link

having similar issue with some letters
Font:
https://www.fontsquirrel.com/fonts/open-sans "OpenSans-Regular.ttf"
Command:
msdfgen.exe -font OpenSans-Regular.ttf 'M' -size 32 32 -testrender test.png 128 128
Output:
output
Render:
test

@AndrewPech6-dev
Copy link

symbol.txt

I have also been having some rendering glitches on symbols.
I have attached a shape file with the problematic symbol.
I don't use Skia, so I use the flag -nopreprocess, although there are different artefacts when using Skia.
I use a resolution of 126 by 126 to render this symbol.
I also don't use -autoframe.
There are limitations that prevent me from changing the resolution or from using -autoframe in my software environment.

msdfgen.exe -shapedesc shape_61498.shape -size 126 126 -testrender render.png 126 126 -testrendermulti output.png 126 126 -nopreprocess
output
render

@Chlumsky
Copy link
Owner

@AndrewPech6-dev If you don't use Skia preprocess, then you have to pass in a shape without self intersections:

self-intersect

But yes, distance fields can't deal very well with these angles:

angle

@AndrewPech6-dev
Copy link

Thank you, I did not see that intersection. I have other intersection tools that I can use to resolve this.
Thanks for the quick response, I'll know what to look for next time I come across similar issues.

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

No branches or pull requests

4 participants