-
-
Notifications
You must be signed in to change notification settings - Fork 3.5k
changing fontStyle func to set all font attr and adding fontWeight func to set just font weight attr #394
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
I'm not sure what this means exactly. I don't believe there is a |
textStyle() ? |
ah that must be it. there are no other comments on this so it seems not crucial enough to warrant deviating from the processing API. @dhowe what do you think, ok to close? |
I really cant remember what problems I was running into when I thought of it this. I think I meant it'd be good to be able to set the font, size, weight, and style in one call/func like in css with font property |
If we can clearly document this, it seems like a useful (additional) option at least for browser/system fonts, and we wouldn't have to change the API... @ekeneijeoma, maybe you can add a quick sketch to the examples/p5.Font dir to show a few examples of how it might work? |
i'm not sure supporting all the variations of the css font property is necessary, perhaps for one-line-ness, chaining would be a more javascripty way to do it? Also being able to set the weight with numbers rather than just BOLD and NORMAL might be useful. |
I guess the intent here is something like below?
|
I just found myself having to change the font and weight for a project with heavy text layout a lot and thought it'd be great if I could do it in 1 line. @dhowe I was thinking something more like textStyle(FONT,WEIGHT,SIZE) where the weights are numbers with constants (LIGHT, BOLD, and etc). I think it should only use params that are already in the api. |
Also as far as I know a lot of those params/styles are only used in HTML ex: em, px/px, small-caps, and cursive. |
I think this is easy enough to do manually using the underlying canvas api, I suggest we don't further bloat the API as there are already a lot of settings to keep track of. for example: function setup() {
createCanvas(200, 200);
drawingContext.font = 'italic small-caps bold 12px arial';
text('testing testing', 50, 50);
} |
That works great for canvas but then what about WebGL? The problem is still |
in webgl, couldn't you just use a canvas to create a texture that has text in it? |
ah, I didn't realize processing does support 3d text. I don't think p5.js does currently (except for the 2d canvas solution) but I suppose eventually it should. in any case, I'd really prefer to flesh out the existing API and fix type related bugs before adding more possible cases. so unless someone is volunteering to implement this right now, I'd suggest we close it for now and revisit at some future point. sound ok? |
sounds good to me |
@dhowe right! you could also use divs which are usually better for labeling. |
I think fontStyle should set all the font attributes in 1 line like css's font property and while a new function named fontWeight should set the font's weight.
The text was updated successfully, but these errors were encountered: