-
-
Couldn't load subscription status.
- Fork 3.6k
Description
Most appropriate sub-area of p5.js?
- Accessibility
- Color
- Core/Environment/Rendering
- Data
- DOM
- Events
- Image
- IO
- Math
- Typography
- Utilities
- WebGL
- Build process
- Unit testing
- Internationalization
- Friendly errors
- Other (specify if possible)
p5.js version
2.1.0-rc
Web browser and version
Version 141.0.7390.56 (Official Build) (arm64)
Operating system
MacOSX
Questions and Discussion
I am working on finishing a video (edited out of a live stream) about the new typography features in p5.js 2.0. Following are some issues/questions I encountered while making new examples and exploring the new features. I'll cover them all in this one issue, but would be happy to break them out separately if that is more helpful.
textToPoints()
Is textToPoints() still recommended to use for some cases? Is it deprecated? I am covering the new textToContours() but see that textToPoints() is still in the reference. Is the only difference is that it is a single array instead of array "per contour"?
loading font via URL or file
I understand that textToContours() will not work with a variable weight font, however, is it also true that it will only work with loading the font file directly (uploading to p5 web editor)? I tried loading a font from a URL with fixed weights and it does not work, however, loading the ttf file directly does work.
font = await loadFont("https://fonts.googleapis.com/css2?family=Grenze+Gotisch&family=STIX+Two+Text&display=swap");Also, the friendly error message incorrectly references textToPath(), perhaps this was the naming in earlier versions of p5 2?
simplifyThreshold
I am not able to get the simplifyThreshold property to work. Using a textSize() of 24 or higher and any angle other than 0.0 I get the error message:
ReferenceError: collinear is not defined
Here is a small sketch to show the error: https://editor.p5js.org/codingtrain/sketches/4_L_Uq_5Y
angle vs. alpha
The reference for textToContours() states:
Each point object in a contour array has three properties that describe the point's location and orientation, called its path angle. For example,
{ x: 10, y: 20, alpha: 450 }.
However, I see both an alpha and angle property. Is this intended?
For context, here is the full example from my video:
https://editor.p5js.org/codingtrain/sketches/e2_aSyk-U
