Skip to content
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

changing fontStyle func to set all font attr and adding fontWeight func to set just font weight attr #394

Closed
studioijeoma opened this issue Oct 15, 2014 · 15 comments

Comments

@studioijeoma
Copy link

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.

@studioijeoma studioijeoma changed the title changing fontStyle to set all font attr and a new fontWeight to set just font weight attr changing fontStyle func to set all font attr and adding fontWeight func to set just font weight attr Oct 15, 2014
@lmccart
Copy link
Member

lmccart commented Sep 29, 2015

I'm not sure what this means exactly. I don't believe there is a fontStyle() function currently?

@dhowe
Copy link
Contributor

dhowe commented Sep 30, 2015

textStyle() ?

@lmccart
Copy link
Member

lmccart commented Oct 4, 2015

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?

@studioijeoma
Copy link
Author

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

@dhowe
Copy link
Contributor

dhowe commented Oct 5, 2015

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?

@brysonian
Copy link
Contributor

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? textFont(foo).textStyle(BOLD).textSize(40)

Also being able to set the weight with numbers rather than just BOLD and NORMAL might be useful.

@dhowe
Copy link
Contributor

dhowe commented Oct 5, 2015

I guess the intent here is something like below?

textStyle('italic bold 12px/30px Georgia, serif');
textStyle('italic 2em "Open Sans", sans-serif');
textStyle('italic small-caps bolder 16px/3 cursive');

@studioijeoma
Copy link
Author

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.

@studioijeoma
Copy link
Author

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.

@lmccart
Copy link
Member

lmccart commented Oct 12, 2015

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);
}

@studioijeoma
Copy link
Author

That works great for canvas but then what about WebGL? The problem is still
the same.

@lmccart
Copy link
Member

lmccart commented Oct 12, 2015

in webgl, couldn't you just use a canvas to create a texture that has text in it?

@lmccart
Copy link
Member

lmccart commented Oct 12, 2015

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?

@dhowe
Copy link
Contributor

dhowe commented Oct 12, 2015

sounds good to me
note: 3d text is another case where path-points for fonts comes in handy...

@studioijeoma
Copy link
Author

@dhowe right! you could also use divs which are usually better for labeling.

@lmccart lmccart closed this as completed Oct 25, 2015
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