-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Fonts loaded by loadFont()
cannot be used in CSS styles
#2750
Comments
I would guess that the problem is in the part of the code where we map relative url paths like I was hoping this was a trivial fix where all we need to do is add
I'm looking through the p5.js-web-editor/client/modules/Preview/EmbedFrame.jsx Lines 36 to 270 in 41529a3
|
Hi @nickmcintyre , I tried to replicate this issue and I was ablle to load the fonts mentioned. Attaching a video for the same. Attaching the font file and the code I used. Please let me know if I am missing anything. // Load the font. function setup() { // Paint the background. // Use the font in the canvas. // Create a element. // Style the button. // Try to set the button's font-family. // This works locally. // The code below makes the font-family work // let f = new FontFace( p5-2750.mp4 |
@PradeepJ4u thanks for looking into this. The issue is that the button's font-family isn't set. |
I looked into this more and I can see the problem! The core p5.js But in the editor the
Where the I'm not sure if we would consider making any changes to the core p5.js code to support this use case. I think that we probably need to do something about it on our end, or with some sort of plugin around the p5 code. It cannot be handled with a simple find and replace because that |
loadFont()
cannot be used in CSS styles
p5.js version
1.9.0
What is your operating system?
Mac OS
Web browser and version
Chrome 120, Firefox 120, Safari 17.2
Actual Behavior
When I load a font with
loadFont()
, I can't use it to style HTML elements.Expected Behavior
I should be able to set the
font-family
for HTML elements as shown in the last example.Steps to reproduce
Here's a sketch that demonstrates the bug.
@raclim @lindapaiste @dhowe @paulaxisabel @SarveshLimaye @SkylerW99 @BamaCharanChhandogi @Obi-Engine10 @hannahvy @singshris @hiddenenigma I'm happy to help with this where I can!
The text was updated successfully, but these errors were encountered: