-
-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Issues with stroke join for text #5408
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
Comments
Is it the same problem as #3035? |
Definitely related, as noted above... |
Does it also happens if this font is rendered in something like Illustrator? Shall we reconsider adding a new miter limit function as proposed before? |
So, this visual glitch is 'expected behavior', as others have pointed out. If a font (or other shape) has a zig-zag with sufficiently pointy angles, then this is what will happen, period. It is a fundamental geometric property of 2D graphics. Just my two cents, but:
Possible solutions to the issue, from most to least preferable in my opinion, are:
|
I tend to lean towards adding a new function to control this as well. I found before that setting a lower default may cause other drawing issues such as not being able to draw star shape with strokes so I wouldn't recommend it. However also to add that with the native canvas API, the miter limit can be set with something like below: canvas = createCanvas(200, 200);
let context = canvas.elt.getContext("2d");
context.miterLimit = 2; |
Easy enough to add a strokeMiterLimit() or similar function... though, as there are existing options, setting strokeJoin() or canvas miter limit (also canvas lineJoin property), perhaps documentation somewhere would suffice (maybe an example on the strokeJoin page)? |
I'm on board with adding a new function for setting a stroke miter limit and adding documentation in
Are there any significant downsides to doing this? It seems like barely perceptible difference for the (probably) vast majority of cases and makes this not an issue folks would hit when playing with large stroke widths. I think configurability for this is good, but good defaults are good too! |
For a star shape it would mean the points are not "pointy" as they will be rounded, not inherently a problem but also not an uncommon thing that is expected by the user. It can work as a default but we may also need configurability for it. |
Hi! I'm working on this issue as part of my GSoC project. I think adding a |
@munusshih Instead of I would prefer leaving the HTML canvas default ( |
Although WebGL text doesn't support strokes, WebGL strokes for other shapes also have a bit of a miter limit going on in here: p5.js/src/webgl/shaders/line.vert Lines 178 to 186 in 6792185
It's probably fine to not implement this for WebGL too at the same time, but if we don't, we can maybe make an issue for it so that we remember to implement it there too eventually! |
This is in the making here #6331 |
Note that this only occurs when strokeWeight is large in relation to textSize
Setting strokeJoin(ROUND) or strokeJoin(BEVEL) eliminates the problem
Related to #3035 -- steps to reproduce: show font with stroke and large relative strokeWeight:
Most appropriate sub-area of p5.js?
Details about the bug:
The text was updated successfully, but these errors were encountered: