Skip to content

Issue With TextSize() and StrokeWeight #3319

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

Closed
Bogdan740 opened this issue Nov 16, 2018 · 4 comments
Closed

Issue With TextSize() and StrokeWeight #3319

Bogdan740 opened this issue Nov 16, 2018 · 4 comments

Comments

@Bogdan740
Copy link

I don't know ifthis is happening due to the dis proportionality of strokeWeight() and textSize() but there is a problem with "A" in particular where it has a weird extra triangle at the top of the "A". You can check the enclosed file for a picture and p5.js sketch which shows the issue.

ISSUE EXAMPLE RUNABLE.zip

@TanviKumar
Copy link
Member

TanviKumar commented Nov 17, 2018

The error can be replicated in the p5.js Web Editor with just the sketch code.

Increasing the ratio of testSize to strokeWeight helps reduce the size of the weird triangle, so it does seem to be an issue with proportionality.

@vipulrawat
Copy link
Member

It's not a problem with p5.js.This thing happens with native canvas elements.
Also, the extra triangle's size and visibility highly depend on the typeface you are using.

Example: Using sans typefaces removes those extra triangle as sans doent have serifs (feet)

You may want to check this for reference.
In p5.js, you can use some good sans typefaces like textFont('Georgia'); this will remove the issue of extra triangle.

@limzykenneth
Copy link
Member

This is a known issue (#3035), it is related to the default miter limit set by the Canvas API. For now you can access the underlying canvas and set the miter limit on there.

PS. @vipulrawat Georgia is a serif typeface

@vipulrawat
Copy link
Member

Oh yes. Sorry, I think I missed this thing then. Also in Canavs API using only Georgia is solving the issue but in p5 both Georgia and Helvetica solved the issue. Then the miter limit is real solution by setting something like this

var context = canvas.getContext('2d');
context.miterLimit = 2 ; // default is 10

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

5 participants