4
$\begingroup$

I have a weird problem with antialiasing of small text and Polygons. If I use Polygon with holes poly1->poly2, Antialiasing doesn't work, although I used Antialiasing->True. See this example:

poly1 = {{0, 0}, {3, 3}, {6, 0}};
poly2 = {{2, 1}, {3, 2}, {4, 1}};
text = Column@Table[Style["FontSize: " <> ToString@i, i, Italic], {i, 2, 22, 2}];

Graphics[{Antialiasing -> True, Polygon[poly1 -> poly2], Red, Text[text, {6, 3}]}]

enter image description here

If I use two single Polygons, without using the hole option it suddenly works:

    Graphics[{Antialiasing -> True, Polygon[poly1], White, Polygon[poly2], Red, Text[text, {6, 3}]}]

enter image description here

I know, that the font antialiasing is system dependent, but why does it change if I use different polygon methods and how can I avoid it using the hole option?

I'm using Mathematica 12.1 on Windows 10 64-bit.

$\endgroup$
3
  • 1
    $\begingroup$ Wow, this is a cool bug. Have you reported it to Wolfram Support? I couldn't reproduce it on 13.0 on Linux, but I also have a very high-DPI screen and it could be hard for me to make out the distinctions. $\endgroup$
    – Carl Lange
    Commented Jan 5, 2022 at 11:34
  • 2
    $\begingroup$ Version 13.0. I get 2 identical pictures. $\endgroup$ Commented Jan 5, 2022 at 11:48
  • 1
    $\begingroup$ Maybe you can try go to : Edit -> Appearance -> Graphics -> Highest Quality and there move the slider to the right max. $\endgroup$ Commented Jan 5, 2022 at 13:08

1 Answer 1

4
$\begingroup$

A Work around. Add BoundaryDiscretizeRegion to Polygon

Graphics[{Antialiasing -> True, 
  Polygon[poly1 -> poly2] // BoundaryDiscretizeRegion, Red, 
  Text[text, {6, 3}]}]
$\endgroup$
1
  • $\begingroup$ Wow, this works. Thank you very much! $\endgroup$ Commented Jan 5, 2022 at 11:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.